status menu hackery

This commit is contained in:
Jasper St. Pierre 2015-06-23 10:25:29 -07:00
parent fe265554a7
commit d20789bc61
7 changed files with 7 additions and 42 deletions

View File

@ -697,7 +697,6 @@ const AggregateMenu = new Lang.Class({
this.menu.addMenuItem(this._location.menu);
this.menu.addMenuItem(this._rfkill.menu);
this.menu.addMenuItem(this._power.menu);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this._system.menu);
},
});

View File

@ -1059,11 +1059,6 @@ const PopupSubMenuMenuItem = new Lang.Class({
let expander = new St.Bin({ style_class: 'popup-menu-item-expander' });
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.pivot_point = new Clutter.Point({ x: 0.5, y: 0.6 });

View File

@ -101,8 +101,8 @@ const Indicator = new Lang.Class({
this._item.actor.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode;
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
this._item.status.text = _("Not Connected");
this._item.label.text = _("Not Connected");
},
});

View File

@ -68,7 +68,7 @@ const Indicator = new Lang.Class({
this._agent = Gio.DBusExportedObject.wrapJSObject(AgentIface, this);
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._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._item.actor.visible = this._indicator.visible;
this._updateMenuLabels();
},
_connectToGeoclue: function() {
@ -171,19 +170,7 @@ const Indicator = new Lang.Class({
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() {
this._updateMenuLabels();
// Gotta ensure geoclue is up and we are registered as agent to it
// before we emit the notify for this property change.
if (!this._connectToGeoclue())

View File

@ -257,16 +257,8 @@ const NMConnectionSection = new Lang.Class({
this._radioSection.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();
// 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() {
@ -1282,9 +1274,8 @@ const NMDeviceWireless = new Lang.Class({
this._toggleItem.label.text = this._client.wireless_enabled ? _("Turn Off") : _("Turn On");
this._toggleItem.actor.visible = this._client.wireless_hardware_enabled;
this.item.status.text = this._getStatus();
this.item.icon.icon_name = this._getMenuIcon();
this.item.label.text = this._description;
this.item.label.text = this._getStatus();
},
setDeviceDescription: function(desc) {

View File

@ -112,12 +112,6 @@ const Indicator = new Lang.Class({
this._item.icon.icon_name = icon;
// The status label
this._item.status.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");
this._item.label.text = this._getStatus();
},
});

View File

@ -85,9 +85,8 @@ const Indicator = new Lang.Class({
// The menu only appears when airplane mode is on, so just
// statically build it as if it was on, rather than dynamically
// 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.status.text = _("On");
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
this._manager.airplaneMode = false;
}));