status: Port to a new SystemIndicator framework
We can't silently replace the old behavior of separate status icons into a new system. Replace SystemStatusButton with a new SystemIndicator class which will allow for the flexibility we need. For now, make it a subclass of Button so that it mostly feels the same, but we'll soon be swapping it out with a dummy implementation that the aggregate menu will use. I think the code cleanup here is worth it. https://bugzilla.gnome.org/show_bug.cgi?id=705845
This commit is contained in:
@ -1152,12 +1152,13 @@ Signals.addSignalMethods(NMVPNSection.prototype);
|
||||
|
||||
const NMApplet = new Lang.Class({
|
||||
Name: 'NMApplet',
|
||||
Extends: PanelMenu.SystemStatusButton,
|
||||
Extends: PanelMenu.SystemIndicator,
|
||||
|
||||
_init: function() {
|
||||
this.parent('network-offline-symbolic', _('Network'));
|
||||
this.parent();
|
||||
|
||||
this._vpnIcon = this.addIcon(null);
|
||||
this._primaryIndicator = this.addIndicator(null);
|
||||
this._vpnIndicator = this.addIndicator(null);
|
||||
|
||||
// Device types
|
||||
this._dtypes = { };
|
||||
@ -1579,29 +1580,27 @@ const NMApplet = new Lang.Class({
|
||||
},
|
||||
|
||||
_syncNMState: function() {
|
||||
this.mainIcon.visible = this._client.manager_running;
|
||||
this.actor.visible = this.mainIcon.visible;
|
||||
|
||||
this._syncActiveConnections();
|
||||
|
||||
this.indicators.visible = this._client.manager_running;
|
||||
this._section.actor.visible = this._client.networking_enabled;
|
||||
},
|
||||
|
||||
_updateIcon: function() {
|
||||
let hasApIcon = false;
|
||||
let hasMobileIcon = false;
|
||||
let mc = this._mainConnection;
|
||||
|
||||
if (!this._client.networking_enabled || !this._mainConnection) {
|
||||
this.setIcon('network-offline-symbolic');
|
||||
if (!this._client.networking_enabled || !mc) {
|
||||
this._primaryIndicator.icon_name = 'network-offline-symbolic';
|
||||
} else {
|
||||
let dev = this._mainConnection._primaryDevice;
|
||||
if (!dev) {
|
||||
log('Active connection with no primary device?');
|
||||
return;
|
||||
}
|
||||
this.setIcon(dev.getIndicatorIcon());
|
||||
this._primaryIndicator.icon_name = dev.getIndicatorIcon(mc);
|
||||
}
|
||||
|
||||
this._vpnIcon.icon_name = this._vpnSection.getIndicatorIcon();
|
||||
this._vpnIcon.visible = (this._vpnIcon.icon_name != '');
|
||||
this._vpnIndicator.icon_name = this._vpnSection.getIndicatorIcon();
|
||||
this._vpnIndicator.visible = (this._vpnIndicator.icon_name != '');
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user