[gnome-shell/wip/aggregate-menu: 30/36] network: Merge NMConnectionBased back into NMDevice
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 30/36] network: Merge NMConnectionBased back into NMDevice
- Date: Wed, 29 May 2013 20:18:46 +0000 (UTC)
commit b27e5d3bb96ada0a1edfebb4c8edd7c842e47275
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Apr 26 19:28:48 2013 -0400
network: Merge NMConnectionBased back into NMDevice
js/ui/status/network.js | 64 +++++++++++++++++++---------------------------
1 files changed, 27 insertions(+), 37 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index e61ea7e..9065136 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -112,13 +112,35 @@ const NMNetworkMenuItem = new Lang.Class({
}
});
-const NMConnectionBased = new Lang.Class({
- Name: 'NMConnectionBased',
+const NMDevice = new Lang.Class({
+ Name: 'NMDevice',
Abstract: true,
- _init: function(connections) {
- this._connections = [ ];
+ _init: function(client, device, connections) {
+ this._client = client;
+ this._setDevice(device);
+ this._connections = [];
connections.forEach(Lang.bind(this, this.checkConnection));
+
+ this._activeConnection = null;
+ this._activeConnectionItem = null;
+
+ this.statusItem = new PopupMenu.PopupSwitchMenuItem('', this.connected, { style_class:
'popup-subtitle-menu-item' });
+ this._statusChanged = this.statusItem.connect('toggled', Lang.bind(this, function(item, state) {
+ let ok;
+ if (state)
+ ok = this.activate();
+ else
+ ok = this.deactivate();
+
+ if (!ok)
+ item.setToggleState(!state);
+ }));
+
+ this._updateStatusItem();
+ this.section = new PopupMenu.PopupMenuSection();
+
+ this._deferredWorkId = Main.initializeDeferredWork(this.section.actor, Lang.bind(this,
this._createSection));
},
checkConnection: function(connection) {
@@ -194,39 +216,6 @@ const NMConnectionBased = new Lang.Class({
return two.timestamp - one.timestamp;
},
-});
-Signals.addSignalMethods(NMConnectionBased.prototype);
-
-const NMDevice = new Lang.Class({
- Name: 'NMDevice',
- Abstract: true,
- Extends: NMConnectionBased,
-
- _init: function(client, device, connections) {
- this._client = client;
- this._setDevice(device);
- this.parent(connections);
-
- this._activeConnection = null;
- this._activeConnectionItem = null;
-
- this.statusItem = new PopupMenu.PopupSwitchMenuItem('', this.connected, { style_class:
'popup-subtitle-menu-item' });
- this._statusChanged = this.statusItem.connect('toggled', Lang.bind(this, function(item, state) {
- let ok;
- if (state)
- ok = this.activate();
- else
- ok = this.deactivate();
-
- if (!ok)
- item.setToggleState(!state);
- }));
-
- this._updateStatusItem();
- this.section = new PopupMenu.PopupMenuSection();
-
- this._deferredWorkId = Main.initializeDeferredWork(this.section.actor, Lang.bind(this,
this._createSection));
- },
destroy: function() {
this._setDevice(null);
@@ -484,6 +473,7 @@ const NMDevice = new Lang.Class({
this.emit('state-changed');
}
});
+Signals.addSignalMethods(NMDevice.prototype);
const NMDeviceSimple = new Lang.Class({
Name: 'NMDeviceSimple',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]