-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmenu_items.js
65 lines (52 loc) · 2.36 KB
/
menu_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
63
64
65
/**
AUTHOR: Mario Wenzel
LICENSE: GPL3.0
**/
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import St from 'gi://St';
import GObject from 'gi://GObject';
import * as Icons from './icons.js';
export var StreamerMenuItem = GObject.registerClass(
{GTypeName: 'StreamerMenuItem'},
class StreamerMenuItem extends PopupMenu.PopupBaseMenuItem {
_init(streamername, login, game, viewer_count, title, is_playlist=false, HIDESTATUS=false, uptime) {
super._init();
this._streamer = streamername;
this._layout = {};
this._wrapBox = new St.BoxLayout({ vertical: true });
this._firstLine = new St.BoxLayout();
this._layout.streamer_icon = Icons.get_streamericon(login, "streamer-icon streamer-menuitem");
this._layout.name = new St.Label({ text: streamername, style_class : "name streamer-menuitem"});
this._layout.game = new St.Label({ text: game, style_class : "game streamer-menuitem"});
this._layout.viewer_count = new St.Label({ text: viewer_count.toString(), style_class : "viewer-count streamer-menuitem"});
if (uptime) {
this._layout.uptime = new St.Label({ text: uptime, style_class : "uptime streamer-menuitem"});
}
let info_icon = 'avatar-default-symbolic';
if (is_playlist) {
info_icon = 'media-playlist-repeat-symbolic';
}
this._layout.viewer_icon = new St.Icon({ icon_name: info_icon, style_class: 'viewer-icon streamer-menuitem' });
this._firstLine.add_child(this._layout.streamer_icon);
this._firstLine.add_child(this._layout.name);
this._firstLine.add_child(this._layout.game);
this._firstLine.add_child(this._layout.viewer_count);
this._firstLine.add_child(this._layout.viewer_icon);
if (uptime) {
this._firstLine.add_child(this._layout.uptime);
}
this._wrapBox.add_child(this._firstLine);
if (!HIDESTATUS) {
this._layout.title = new St.Label({ text: title, style_class : "title streamer-menuitem"});
this._wrapBox.add_child(this._layout.title);
}
this.add_child(this._wrapBox); // this.actor.add(this._wrapBox) seems deprecated
};
});
export const NobodyMenuItem = GObject.registerClass(
class NobodyMenuItem extends PopupMenu.PopupBaseMenuItem {
_init(nobodytext) {
super._init({ reactive: false, can_focus: false });
this.actor.add(new St.Label({ text: nobodytext, style_class : "nobody-menuitem"}));
}
});