-
Notifications
You must be signed in to change notification settings - Fork 2
/
mitems.js
161 lines (139 loc) · 3.36 KB
/
mitems.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import Clutter from "gi://Clutter";
import GObject from "gi://GObject";
import St from "gi://St";
export const MultiStatItem = GObject.registerClass(
{
GTypeName: "MultiStatItem",
},
class MultiStatItem extends St.BoxLayout {
_init(label) {
super._init({
style_class: "menu-item",
});
this._label1 = new St.Label({
text: label,
x_align: Clutter.ActorAlign.START,
x_expand: true,
style_class: "stat-name",
});
this._label2 = new St.Label({
style_class: "stat-value",
});
this._label3 = new St.Label({
style_class: "stat-value",
});
this.add_child(this._label1);
this.add_child(this._label2);
this.add_child(this._label3);
}
/**
* @param {string} value
*/
set text1(value) {
this._label2.text = value;
}
/**
* @param {string} value
*/
set text2(value) {
this._label3.text = value;
}
}
);
export const HeaderItem = GObject.registerClass(
{
GTypeName: "HeaderItem",
},
class HeaderItem extends St.BoxLayout {
_init(name1, name2) {
super._init({
style_class: "menu-item",
});
this._label = new St.Label({
text: _("Pi-hole Status"),
x_align: Clutter.ActorAlign.START,
x_expand: true,
y_align: Clutter.ActorAlign.CENTER,
style_class: "stat-name",
});
this._box1 = new St.BoxLayout({
style_class: "stat-value",
});
this._box2 = new St.BoxLayout({
style_class: "stat-value",
});
this._button1 = new St.Button({
label: name1,
style_class: "phi-button disabled",
x_align: Clutter.ActorAlign.END,
x_expand: true,
});
this._button2 = new St.Button({
label: name2,
style_class: "phi-button disabled",
x_align: Clutter.ActorAlign.END,
x_expand: true,
});
this._box1.add_child(this._button1);
this._box2.add_child(this._button2);
this.state1 = false;
this.state2 = false;
this.add_child(this._label);
this.add_child(this._box1);
this.add_child(this._box2);
}
}
);
export const TailItem = GObject.registerClass(
{
GTypeName: "TailItem",
},
class TailItem extends St.BoxLayout {
_init() {
super._init({
style_class: "menu-item",
});
this._button = new St.Button({
label: _("Settings"),
x_align: Clutter.ActorAlign.START,
x_expand: true,
style_class: "phi-button settings",
});
this._label1 = new St.Label({
style_class: "stat-value ver-value",
y_align: Clutter.ActorAlign.CENTER,
});
this._label2 = new St.Label({
style_class: "stat-value ver-value",
y_align: Clutter.ActorAlign.CENTER,
});
this.add_child(this._button);
this.add_child(this._label1);
this.add_child(this._label2);
}
/**
* @param {string} value
*/
set text1(value) {
this._label1.text = value;
}
/**
* @param {string} value
*/
set text2(value) {
this._label2.text = value;
}
}
);
export const Line = GObject.registerClass(
{
GTypeName: "Line",
},
class Line extends St.BoxLayout {
_init() {
super._init({
style_class: "menu-item pihole-line",
});
}
}
);