| 1 |
const Gdk = imports.gi.Gdk; |
| 2 |
const Gtk = imports.gi.Gtk; |
| 3 |
const Lang = imports.lang; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class: TopbarHomeButton |
| 7 |
* Generic button widget to re-direct the user to the home page |
| 8 |
* |
| 9 |
* This is a generic button widget to be used by all applications. |
| 10 |
* It must be placed at the top left corner of the window. When |
| 11 |
* clicked, the user must be re-directed to the home page of the |
| 12 |
* application. |
| 13 |
*/ |
| 14 |
var TopbarHomeButton = new Lang.Class({ |
| 15 |
Name: 'TopbarHomeButton', |
| 16 |
GTypeName: 'EosTopbarHomeButton', |
| 17 |
Extends: Gtk.Button, |
| 18 |
|
| 19 |
_init: function(props={}) { |
| 20 |
this.parent(props); |
| 21 |
|
| 22 |
let icon_name = 'go-home-symbolic'; |
| 23 |
let image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.SMALL_TOOLBAR); |
| 24 |
this.set_image(image); |
| 25 |
|
| 26 |
this.get_style_context().add_class('home'); |
| 27 |
this.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED); |
| 28 |
|
| 29 |
this.can_focus = false; |
| 30 |
}, |
| 31 |
}); |