status menu hackery
This commit is contained in:
parent
fe265554a7
commit
d20789bc61
@ -697,7 +697,6 @@ const AggregateMenu = new Lang.Class({
|
|||||||
this.menu.addMenuItem(this._location.menu);
|
this.menu.addMenuItem(this._location.menu);
|
||||||
this.menu.addMenuItem(this._rfkill.menu);
|
this.menu.addMenuItem(this._rfkill.menu);
|
||||||
this.menu.addMenuItem(this._power.menu);
|
this.menu.addMenuItem(this._power.menu);
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
|
||||||
this.menu.addMenuItem(this._system.menu);
|
this.menu.addMenuItem(this._system.menu);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1059,11 +1059,6 @@ const PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
let expander = new St.Bin({ style_class: 'popup-menu-item-expander' });
|
let expander = new St.Bin({ style_class: 'popup-menu-item-expander' });
|
||||||
this.actor.add(expander, { expand: true });
|
this.actor.add(expander, { expand: true });
|
||||||
|
|
||||||
this.status = new St.Label({ style_class: 'popup-status-menu-item',
|
|
||||||
y_expand: true,
|
|
||||||
y_align: Clutter.ActorAlign.CENTER });
|
|
||||||
this.actor.add_child(this.status);
|
|
||||||
|
|
||||||
this._triangle = arrowIcon(St.Side.RIGHT);
|
this._triangle = arrowIcon(St.Side.RIGHT);
|
||||||
this._triangle.pivot_point = new Clutter.Point({ x: 0.5, y: 0.6 });
|
this._triangle.pivot_point = new Clutter.Point({ x: 0.5, y: 0.6 });
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ const Indicator = new Lang.Class({
|
|||||||
this._item.actor.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode;
|
this._item.actor.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode;
|
||||||
|
|
||||||
if (nDevices > 0)
|
if (nDevices > 0)
|
||||||
this._item.status.text = ngettext("%d Connected Device", "%d Connected Devices", nDevices).format(nDevices);
|
this._item.label.text = ngettext("%d Connected Device", "%d Connected Devices", nDevices).format(nDevices);
|
||||||
else
|
else
|
||||||
this._item.status.text = _("Not Connected");
|
this._item.label.text = _("Not Connected");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -68,7 +68,7 @@ const Indicator = new Lang.Class({
|
|||||||
this._agent = Gio.DBusExportedObject.wrapJSObject(AgentIface, this);
|
this._agent = Gio.DBusExportedObject.wrapJSObject(AgentIface, this);
|
||||||
this._agent.export(Gio.DBus.system, '/org/freedesktop/GeoClue2/Agent');
|
this._agent.export(Gio.DBus.system, '/org/freedesktop/GeoClue2/Agent');
|
||||||
|
|
||||||
this._item.status.text = _("Enabled");
|
this._item.label.text = _("Location Services in Use");
|
||||||
this._onOffAction = this._item.menu.addAction(_("Disable"), Lang.bind(this, this._onOnOffAction));
|
this._onOffAction = this._item.menu.addAction(_("Disable"), Lang.bind(this, this._onOnOffAction));
|
||||||
this._item.menu.addSettingsAction(_("Privacy Settings"), 'gnome-privacy-panel.desktop');
|
this._item.menu.addSettingsAction(_("Privacy Settings"), 'gnome-privacy-panel.desktop');
|
||||||
|
|
||||||
@ -112,7 +112,6 @@ const Indicator = new Lang.Class({
|
|||||||
|
|
||||||
this._indicator.visible = this._proxy.InUse;
|
this._indicator.visible = this._proxy.InUse;
|
||||||
this._item.actor.visible = this._indicator.visible;
|
this._item.actor.visible = this._indicator.visible;
|
||||||
this._updateMenuLabels();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectToGeoclue: function() {
|
_connectToGeoclue: function() {
|
||||||
@ -171,19 +170,7 @@ const Indicator = new Lang.Class({
|
|||||||
this.menu.setSensitive(sensitive);
|
this.menu.setSensitive(sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMenuLabels: function() {
|
|
||||||
if (this._settings.get_boolean(ENABLED)) {
|
|
||||||
this._item.status.text = this._indicator.visible ? _("In Use") : _("Enabled");
|
|
||||||
this._onOffAction.label.text = _("Disable");
|
|
||||||
} else {
|
|
||||||
this._item.status.text = _("Disabled");
|
|
||||||
this._onOffAction.label.text = _("Enable");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_onMaxAccuracyLevelChanged: function() {
|
_onMaxAccuracyLevelChanged: function() {
|
||||||
this._updateMenuLabels();
|
|
||||||
|
|
||||||
// Gotta ensure geoclue is up and we are registered as agent to it
|
// Gotta ensure geoclue is up and we are registered as agent to it
|
||||||
// before we emit the notify for this property change.
|
// before we emit the notify for this property change.
|
||||||
if (!this._connectToGeoclue())
|
if (!this._connectToGeoclue())
|
||||||
|
@ -257,16 +257,8 @@ const NMConnectionSection = new Lang.Class({
|
|||||||
this._radioSection.actor.visible = (nItems > 1);
|
this._radioSection.actor.visible = (nItems > 1);
|
||||||
this._labelSection.actor.visible = (nItems == 1);
|
this._labelSection.actor.visible = (nItems == 1);
|
||||||
|
|
||||||
this.item.status.text = this._getStatus();
|
this.item.label.text = this._getStatus();
|
||||||
this.item.icon.icon_name = this._getMenuIcon();
|
this.item.icon.icon_name = this._getMenuIcon();
|
||||||
|
|
||||||
// desc can be undefined at cold-plug, before we called
|
|
||||||
// NMGtk.disambiguate_device_names() at least once
|
|
||||||
let desc = this._getDescription();
|
|
||||||
if (desc)
|
|
||||||
this.item.label.text = desc;
|
|
||||||
else
|
|
||||||
this.item.label.text = '';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMenuIcon: function() {
|
_getMenuIcon: function() {
|
||||||
@ -1282,9 +1274,8 @@ const NMDeviceWireless = new Lang.Class({
|
|||||||
this._toggleItem.label.text = this._client.wireless_enabled ? _("Turn Off") : _("Turn On");
|
this._toggleItem.label.text = this._client.wireless_enabled ? _("Turn Off") : _("Turn On");
|
||||||
this._toggleItem.actor.visible = this._client.wireless_hardware_enabled;
|
this._toggleItem.actor.visible = this._client.wireless_hardware_enabled;
|
||||||
|
|
||||||
this.item.status.text = this._getStatus();
|
|
||||||
this.item.icon.icon_name = this._getMenuIcon();
|
this.item.icon.icon_name = this._getMenuIcon();
|
||||||
this.item.label.text = this._description;
|
this.item.label.text = this._getStatus();
|
||||||
},
|
},
|
||||||
|
|
||||||
setDeviceDescription: function(desc) {
|
setDeviceDescription: function(desc) {
|
||||||
|
@ -112,12 +112,6 @@ const Indicator = new Lang.Class({
|
|||||||
this._item.icon.icon_name = icon;
|
this._item.icon.icon_name = icon;
|
||||||
|
|
||||||
// The status label
|
// The status label
|
||||||
this._item.status.text = this._getStatus();
|
this._item.label.text = this._getStatus();
|
||||||
|
|
||||||
// The sub-menu heading
|
|
||||||
if (this._proxy.Type == UPower.DeviceKind.UPS)
|
|
||||||
this._item.label.text = _("UPS");
|
|
||||||
else
|
|
||||||
this._item.label.text = _("Battery");
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -85,9 +85,8 @@ const Indicator = new Lang.Class({
|
|||||||
// The menu only appears when airplane mode is on, so just
|
// The menu only appears when airplane mode is on, so just
|
||||||
// statically build it as if it was on, rather than dynamically
|
// statically build it as if it was on, rather than dynamically
|
||||||
// changing the menu contents.
|
// changing the menu contents.
|
||||||
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode"), true);
|
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
|
||||||
this._item.icon.icon_name = 'airplane-mode-symbolic';
|
this._item.icon.icon_name = 'airplane-mode-symbolic';
|
||||||
this._item.status.text = _("On");
|
|
||||||
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
|
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
|
||||||
this._manager.airplaneMode = false;
|
this._manager.airplaneMode = false;
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user