-
Notifications
You must be signed in to change notification settings - Fork 2
/
items.js
62 lines (52 loc) · 1.25 KB
/
items.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
import Clutter from "gi://Clutter";
import GObject from "gi://GObject";
import St from "gi://St";
import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js";
export const ItemContext = {
SUCCESS: 0,
ERROR: 1,
PREF: 2,
};
export const StatsItem = GObject.registerClass(
{
GTypeName: "StatsItem",
},
class StatsItem extends PopupMenu.PopupBaseMenuItem {
_init(statsName) {
super._init();
this._nameLabel = new St.Label({
text: statsName,
x_align: Clutter.ActorAlign.START,
x_expand: true,
style_class: "stat-name",
});
this._valueLabel = new St.Label({
text: "",
});
this.actor.add_child(this._nameLabel);
this.actor.add_child(this._valueLabel);
this.itemContext = ItemContext.SUCCESS;
}
get text() {
return this._valueLabel.text;
}
/**
* @param {string} value
*/
set text(value) {
this._valueLabel.text = value;
}
}
);
export const PrefsItem = GObject.registerClass(
{
GTypeName: "PrefsItem",
},
class PrefsItem extends StatsItem {
_init() {
super._init(_("Settings"));
this._valueLabel.set_style_class_name("ver-value");
this.itemContext = ItemContext.PREF;
}
}
);