1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
From 7051411be7bbfd9e0c2e831762c87872e5bde468 Mon Sep 17 00:00:00 2001
From: "Jasper St. Pierre" <jstpierre@mecheye.net>
Date: Thu, 23 Jan 2014 14:25:06 -0500
Subject: network: Add a Wired device
This isn't quite like the design, as we don't show icons for other
devices when wired is in an error state.
https://bugzilla.gnome.org/show_bug.cgi?id=708966
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index a3de3dd..3dc694e 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -21,6 +21,7 @@ const Util = imports.misc.util;
const NMConnectionCategory = {
INVALID: 'invalid',
+ WIRED: 'wired',
WIRELESS: 'wireless',
WWAN: 'wwan',
VPN: 'vpn'
@@ -296,6 +297,11 @@ const NMConnectionDevice = new Lang.Class({
this._activeConnectionChangedId = this._device.connect('notify::active-connection', Lang.bind(this, this._activeConnectionChanged));
},
+ _autoConnect: function() {
+ let connection = new NetworkManager.Connection();
+ this._client.add_and_activate_connection(connection, this._device, null, null);
+ },
+
destroy: function() {
if (this._stateChangedId) {
GObject.Object.prototype.disconnect.call(this._device, this._stateChangedId);
@@ -413,6 +419,48 @@ const NMConnectionDevice = new Lang.Class({
},
});
+const NMDeviceWired = new Lang.Class({
+ Name: 'NMDeviceWired',
+ Extends: NMConnectionDevice,
+ category: NMConnectionCategory.WIRED,
+
+ _init: function(client, device, settings) {
+ this.parent(client, device, settings);
+
+ this.item.menu.addMenuItem(createSettingsAction(_("Wired Settings"), device));
+ },
+
+ _isConnected: function() {
+ if (!this._device.active_connection)
+ return false;
+
+ let state = this._device.active_connection.state;
+ return state >= NetworkManager.ActiveConnectionState.ACTIVATING;
+ },
+
+ _sync: function() {
+ this.item.actor.visible = this._isConnected();
+ this.parent();
+ },
+
+ _getMenuIcon: function() {
+ if (this._device.active_connection)
+ return this.getIndicatorIcon();
+ else
+ return 'network-wired-disconnected-symbolic';
+ },
+
+ getIndicatorIcon: function() {
+ let state = this._device.active_connection.state;
+ if (state == NetworkManager.ActiveConnectionState.ACTIVATING)
+ return 'network-wired-acquiring-symbolic';
+ else if (state == NetworkManager.ActiveConnectionState.ACTIVATED)
+ return 'network-wired-symbolic';
+ else
+ return 'network-wired-disconnected-symbolic';
+ }
+});
+
const NMDeviceModem = new Lang.Class({
Name: 'NMDeviceModem',
Extends: NMConnectionDevice,
@@ -510,18 +558,6 @@ const NMDeviceBluetooth = new Lang.Class({
this.item.menu.addMenuItem(createSettingsAction(_("Mobile Broadband Settings"), device));
},
- _autoConnect: function() {
- // FIXME: DUN devices are configured like modems, so
- // We need to spawn the mobile wizard
- // but the network panel doesn't support bluetooth at the moment
- // so we just create an empty connection and hope
- // that this phone supports PAN
-
- let connection = new NetworkManager.Connection();
- this._client.add_and_activate_connection(connection, this._device, null, null);
- return true;
- },
-
_getMenuIcon: function() {
if (this._device.active_connection)
return this.getIndicatorIcon();
@@ -1266,6 +1302,7 @@ const NMApplet = new Lang.Class({
// Device types
this._dtypes = { };
+ this._dtypes[NetworkManager.DeviceType.ETHERNET] = NMDeviceWired;
this._dtypes[NetworkManager.DeviceType.WIFI] = NMDeviceWireless;
this._dtypes[NetworkManager.DeviceType.MODEM] = NMDeviceModem;
this._dtypes[NetworkManager.DeviceType.BT] = NMDeviceBluetooth;
@@ -1273,6 +1310,7 @@ const NMApplet = new Lang.Class({
// Connection types
this._ctypes = { };
+ this._ctypes[NetworkManager.SETTING_WIRED_SETTING_NAME] = NMConnectionCategory.WIRED;
this._ctypes[NetworkManager.SETTING_WIRELESS_SETTING_NAME] = NMConnectionCategory.WIRELESS;
this._ctypes[NetworkManager.SETTING_BLUETOOTH_SETTING_NAME] = NMConnectionCategory.WWAN;
this._ctypes[NetworkManager.SETTING_CDMA_SETTING_NAME] = NMConnectionCategory.WWAN;
@@ -1295,6 +1333,15 @@ const NMApplet = new Lang.Class({
this._tryLateInit();
},
+ _createDeviceCategory: function() {
+ let category = {
+ section: new PopupMenu.PopupMenuSection(),
+ devices: [ ],
+ };
+ this.menu.addMenuItem(category.section);
+ return category;
+ },
+
_tryLateInit: function() {
if (!this._client || !this._settings)
return;
@@ -1310,17 +1357,9 @@ const NMApplet = new Lang.Class({
this._nmDevices = [];
this._devices = { };
- this._devices.wireless = {
- section: new PopupMenu.PopupMenuSection(),
- devices: [ ],
- };
- this.menu.addMenuItem(this._devices.wireless.section);
-
- this._devices.wwan = {
- section: new PopupMenu.PopupMenuSection(),
- devices: [ ],
- };
- this.menu.addMenuItem(this._devices.wwan.section);
+ this._devices.wired = this._createDeviceCategory();
+ this._devices.wireless = this._createDeviceCategory();
+ this._devices.wwan = this._createDeviceCategory();
this._vpnSection = new NMVPNSection(this._client);
this._vpnSection.connect('activation-failed', Lang.bind(this, this._onActivationFailed));
--
cgit v0.10.1
|