-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnotes_view.js
89 lines (81 loc) · 2.5 KB
/
notes_view.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const St = imports.gi.St;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Panel = imports.ui.panel;
const Params = imports.misc.params;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Utils = Me.imports.utils;
const EverpadSnippets = Me.imports.snippets;
const EverpadNotesView = new Lang.Class({
Name: "EverpadNotesView",
_init: function(params) {
this._params = Params.parse(params, {
box_style_class: "everpad-notes-box",
label_style_class: "everpad-notes-label",
width: 0,
height: 0,
default_label: "Notes",
reactive: true
});
this.actor = new St.Table({
style_class: this._params.box_style_class,
width: this._params.width,
height: this._params.height,
homogeneous: false,
reactive: this._params.reactive
});
this._label = new St.Label({
text: this._params.default_label,
style_class: this._params.label_style_class
});
this._spinner = new Panel.AnimatedIcon('process-working.svg', 24);
this.snippets_view = new EverpadSnippets.EverpadSnippetsView();
this.actor.add(this._label, {
row: 0,
col: 0,
y_fill: false,
y_expand: false,
y_align: St.Align.MIDDLE,
x_fill: false,
x_expand: false,
x_align: St.Align.START
});
this.actor.add(this._spinner.actor, {
row: 0,
col: 1,
y_fill: false,
y_expand: false,
y_align: St.Align.MIDDLE,
x_fill: true,
x_expand: false,
x_align: St.Align.START
});
this.actor.add(this.snippets_view.actor, {
row: 1,
col: 0,
col_span: 2,
y_expand: true,
y_fill: true,
y_align: St.Align.START,
x_expand: true,
x_fill: true,
x_align: St.Align.START
});
},
set_label: function(text, show_spinner) {
if(Utils.is_blank(text)) return;
this._label.text = text;
show_spinner = show_spinner || false;
if(show_spinner) {
this._spinner.actor.show();
}
else {
this._spinner.actor.hide();
}
},
destroy: function() {
this.actor.destroy();
this.snippets_view.destroy();
}
});