-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgnote_toolbar.js
74 lines (62 loc) · 2.12 KB
/
gnote_toolbar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const Lang = imports.lang;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Utils = Me.imports.utils;
const ButtonsBar = Me.imports.buttons_bar;
const GnoteToolbar = new Lang.Class({
Name: "GnoteToolbar",
_init: function(gnote_integration) {
this._gnote_integration = gnote_integration;
this._buttons_bar = new ButtonsBar.ButtonsBar();
this._init_gnote_button();
this._init_prefs_button();
},
_init_gnote_button: function() {
let button_params = {
icon_name: Utils.ICONS.INDICATOR,
label_text: '',
tip_text: 'Open editor',
button_style_class: 'gnote-button',
action: Lang.bind(this, function() {
let search_text = this._gnote_integration.search_text;
if(!Utils.is_blank(search_text)) {
Utils.get_client().display_search_with_text(
search_text
);
}
else {
Utils.get_client().display_search();
}
this._gnote_integration.hide(false);
})
};
this._gnote_btn = new ButtonsBar.ButtonsBarButton(button_params);
this._buttons_bar.add_button(this._gnote_btn);
},
_init_prefs_button: function() {
let button_params = {
icon_name: Utils.ICONS.PREFERENCES,
label_text: '',
tip_text: 'Preferences',
button_style_class: 'gnote-button',
action: Lang.bind(this, function() {
Utils.launch_extension_prefs(Me.uuid);
this._gnote_integration.hide(false);
})
};
this._prefs_btn = new ButtonsBar.ButtonsBarButton(button_params);
this._buttons_bar.add_button(this._prefs_btn);
},
destroy: function() {
this._buttons_bar.destroy();
},
get actor() {
return this._buttons_bar.actor;
},
get clear_btn() {
return this._clear_btn;
},
get prefs_btn() {
return this._prefs_btn;
}
});