mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-14 00:14:14 +09:00
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
const Lang = imports.lang;
|
|
const St = imports.gi.St;
|
|
const PopupMenu = imports.ui.popupMenu;
|
|
|
|
const FreonItem = new Lang.Class({
|
|
Name: 'FreonItem',
|
|
Extends: PopupMenu.PopupBaseMenuItem,
|
|
|
|
_init: function(gIcon, label, value) {
|
|
this.parent();
|
|
this._main = false;
|
|
this._label = label;
|
|
this._gIcon = gIcon;
|
|
|
|
this.actor.add(new St.Icon({ style_class: 'popup-menu-icon', gicon : gIcon}));
|
|
this.actor.add(new St.Label({text: label}), {x_fill: true, expand: true});
|
|
this._valueLabel = new St.Label({text: value});
|
|
this.actor.add(this._valueLabel);
|
|
},
|
|
|
|
set main(main) {
|
|
if(main)
|
|
this.setOrnament(PopupMenu.Ornament.DOT);
|
|
else
|
|
this.setOrnament(PopupMenu.Ornament.NONE);
|
|
this._main = main;
|
|
},
|
|
|
|
get main() {
|
|
return this._main;
|
|
},
|
|
|
|
get label() {
|
|
return this._label;
|
|
},
|
|
|
|
get gicon() {
|
|
return this._gIcon;
|
|
},
|
|
|
|
set value(value) {
|
|
this._valueLabel.text = value;
|
|
}
|
|
});
|