Add a new lock screen menu to combine volume network and power

The design has a combined volume-network-power indicator in the lock
screen, which when opened shows a volume slider. Implement it by abstracting
the volume menu into a PopupMenuSection, and by creating three StIcons
bound to the real ones.

https://bugzilla.gnome.org/show_bug.cgi?id=682540
This commit is contained in:
Giovanni Campagna
2012-08-26 16:05:46 +02:00
parent 41dc9e0894
commit c1de2788b1
8 changed files with 172 additions and 68 deletions

View File

@ -56,6 +56,7 @@ const Indicator = new Lang.Class({
this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
this._isLocked = false;
this._deviceItems = [ ];
this._hasPrimary = false;
this._primaryDeviceId = null;
@ -77,9 +78,8 @@ const Indicator = new Lang.Class({
},
setLockedState: function(locked) {
if (locked)
this.menu.close();
this.actor.reactive = !locked;
this._isLocked = locked;
this._syncIcon();
},
_readPrimaryDevice: function() {
@ -150,16 +150,20 @@ const Indicator = new Lang.Class({
}));
},
_devicesChanged: function() {
_syncIcon: function() {
let icon = this._proxy.Icon;
if (icon) {
let hasIcon = (icon != null);
if (hasIcon) {
let gicon = Gio.icon_new_for_string(icon);
this.setGIcon(gicon);
this.actor.show();
} else {
this.menu.close();
this.actor.hide();
}
this.mainIcon.visible = hasIcon;
this.actor.visible = hasIcon && !this._isLocked;
},
_devicesChanged: function() {
this._syncIcon();
this._readPrimaryDevice();
this._readOtherDevices();
}