Merge lp:~kendling/docky/networkmanagerdocklet into lp:docky

Proposed by Kend
Status: Needs review
Proposed branch: lp:~kendling/docky/networkmanagerdocklet
Merge into: lp:docky
Diff against target: 310 lines (+42/-67)
9 files modified
StandardPlugins/NetworkManager/src/ConnectionManager.cs (+3/-31)
StandardPlugins/NetworkManager/src/Enums.cs (+12/-9)
StandardPlugins/NetworkManager/src/Interfaces/IConnectionManager.cs (+1/-1)
StandardPlugins/NetworkManager/src/Interfaces/INetworkConnection.cs (+1/-1)
StandardPlugins/NetworkManager/src/NetworkDevice.cs (+8/-7)
StandardPlugins/NetworkManager/src/NetworkManager.cs (+2/-9)
StandardPlugins/NetworkManager/src/WiredDevice.cs (+4/-2)
StandardPlugins/NetworkManager/src/WirelessAccessPoint.cs (+7/-5)
StandardPlugins/NetworkManager/src/WirelessDevice.cs (+4/-2)
To merge this branch: bzr merge lp:~kendling/docky/networkmanagerdocklet
Reviewer Review Type Date Requested Status
Docky Core Pending
Review via email: mp+166208@code.launchpad.net

Description of the change

Fixed the bug #734490 networkmanager docklet doesn't work with NetworkManager >= 0.9.0

But it still have an problem:
It's report error msg "org.freedesk.DBus.Error.UnknownMethod: Method "ActivateConnection" with signature "sooo" on interface "org.freedesktop.NetworkManager" doesn't exist" when I connect to AP.
I was check the code and args, it look's right.

To post a comment you must log in.

Unmerged revisions

1846. By Kend

Fixed the NetworkManager docklet can't work at NetworkManager >= 0.9

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'StandardPlugins/NetworkManager/src/ConnectionManager.cs'
2--- StandardPlugins/NetworkManager/src/ConnectionManager.cs 2010-10-09 12:54:14 +0000
3+++ StandardPlugins/NetworkManager/src/ConnectionManager.cs 2013-05-29 10:25:31 +0000
4@@ -29,18 +29,14 @@
5 {
6 public class ConnectionManager
7 {
8- const string SettingsObjectPath = "/org/freedesktop/NetworkManagerSettings";
9- const string SystemBus = "org.freedesktop.NetworkManagerSystemSettings";
10- const string UserBus = "org.freedesktop.NetworkManagerUserSettings";
11+ const string SettingsObjectPath = "/org/freedesktop/NetworkManager/Settings";
12+ const string SystemBus = "org.freedesktop.NetworkManager";
13
14 public ConnectionManager()
15 {
16 SystemConnectionManager = new DBusObject<IConnectionManager> (SystemBus, SettingsObjectPath);
17 //SystemConnectionManager.BusObject.NewConnection += OnConnectionAdded;
18- UserConnectionManager = new DBusObject<IConnectionManager> (UserBus, SettingsObjectPath);
19- //UserConnectionManager.BusObject.NewConnection += OnConnectionAdded;
20
21- UserConnections = new List<NetworkConnection> ();
22 SystemConnections = new List<NetworkConnection> ();
23
24 UpdateConnections ();
25@@ -49,11 +45,9 @@
26 }
27
28 DBusObject<IConnectionManager> SystemConnectionManager { get; set; }
29- DBusObject<IConnectionManager> UserConnectionManager { get; set; }
30- public List<NetworkConnection> UserConnections { get; private set; }
31 public List<NetworkConnection> SystemConnections { get; private set; }
32 public IEnumerable<NetworkConnection> AllConnections {
33- get { return UserConnections.Union (SystemConnections); }
34+ get { return SystemConnections; }
35 }
36
37
38@@ -92,28 +86,6 @@
39 Log<ConnectionManager>.Debug (e.StackTrace);
40 }
41 }
42-
43- lock (UserConnections) {
44- UserConnections.Clear ();
45- try {
46- foreach (string con in UserConnectionManager.BusObject.ListConnections ())
47- {
48- NetworkConnection connection = new NetworkConnection (UserBus, con, ConnectionOwner.User);
49- if (connection.Settings.ContainsKey ("802-11-wireless"))
50- connection = new WirelessConnection (UserBus, con, ConnectionOwner.User);
51- else if (connection.Settings.ContainsKey ("802-3-ethernet"))
52- connection = new WiredConnection (UserBus, con, ConnectionOwner.User);
53- else
54- continue;
55-
56- //connection.ConnectionRemoved += OnNetworkConnectionRemoved;
57- UserConnections.Add (connection);
58- }
59- } catch (Exception e) {
60- Log<ConnectionManager>.Error (e.Message);
61- Log<ConnectionManager>.Debug (e.StackTrace);
62- }
63- }
64 }
65 }
66 }
67
68=== modified file 'StandardPlugins/NetworkManager/src/Enums.cs'
69--- StandardPlugins/NetworkManager/src/Enums.cs 2009-11-25 15:37:53 +0000
70+++ StandardPlugins/NetworkManager/src/Enums.cs 2013-05-29 10:25:31 +0000
71@@ -27,15 +27,18 @@
72
73 public enum DeviceState {
74 Unknown = 0,
75- Unmanaged,
76- Unavailable,
77- Disconnected,
78- Preparing,
79- Configuring,
80- NeedsAuth,
81- IPConfiguring,
82- Active,
83- Failed
84+ Unmanaged = 10,
85+ Unavailable = 20,
86+ Disconnected = 30,
87+ Preparing = 40,
88+ Configuring = 50,
89+ NeedsAuth = 60,
90+ IPConfiguring = 70,
91+ IPChecking = 80,
92+ SecondAries = 90,
93+ Active = 100,
94+ Deactivating = 110,
95+ Failed = 120
96 }
97
98 public enum ConnectionOwner {
99
100=== modified file 'StandardPlugins/NetworkManager/src/Interfaces/IConnectionManager.cs'
101--- StandardPlugins/NetworkManager/src/Interfaces/IConnectionManager.cs 2010-10-09 12:54:14 +0000
102+++ StandardPlugins/NetworkManager/src/Interfaces/IConnectionManager.cs 2013-05-29 10:25:31 +0000
103@@ -24,7 +24,7 @@
104 {
105 public delegate void ConnectionAddedHandler (string objectPath);
106
107- [Interface ("org.freedesktop.NetworkManagerSettings")]
108+ [Interface ("org.freedesktop.NetworkManager.Settings")]
109 public interface IConnectionManager
110 {
111 string[] ListConnections ();
112
113=== modified file 'StandardPlugins/NetworkManager/src/Interfaces/INetworkConnection.cs'
114--- StandardPlugins/NetworkManager/src/Interfaces/INetworkConnection.cs 2010-10-09 12:54:14 +0000
115+++ StandardPlugins/NetworkManager/src/Interfaces/INetworkConnection.cs 2013-05-29 10:25:31 +0000
116@@ -23,7 +23,7 @@
117
118 namespace NetworkManagerDocklet
119 {
120- [Interface("org.freedesktop.NetworkManagerSettings.Connection")]
121+ [Interface("org.freedesktop.NetworkManager.Settings.Connection")]
122 public interface INetworkConnection
123 {
124 IDictionary<string, IDictionary<string, object>> GetSettings();
125
126=== modified file 'StandardPlugins/NetworkManager/src/NetworkDevice.cs'
127--- StandardPlugins/NetworkManager/src/NetworkDevice.cs 2011-01-09 18:02:06 +0000
128+++ StandardPlugins/NetworkManager/src/NetworkDevice.cs 2013-05-29 10:25:31 +0000
129@@ -47,6 +47,7 @@
130 }
131
132 const string NMBusName = "org.freedesktop.NetworkManager";
133+ const string NMDBusName = "org.freedesktop.NetworkManager.Device";
134
135 public delegate void DeviceStateChangedHandler (object o, DeviceStateChangedArgs args);
136
137@@ -63,7 +64,7 @@
138 public DeviceType DType {
139 get {
140 try {
141- return (DeviceType) Enum.ToObject (typeof (DeviceType), BusObject.Get (BusName, "DeviceType"));
142+ return (DeviceType) Enum.ToObject (typeof (DeviceType), BusObject.Get (NMDBusName, "DeviceType"));
143 } catch (Exception e) {
144 Log<NetworkDevice>.Error (e.Message);
145 Log<NetworkDevice>.Debug (e.StackTrace);
146@@ -75,7 +76,7 @@
147 public DeviceState State {
148 get {
149 try {
150- return (DeviceState) Enum.ToObject (typeof (DeviceState), BusObject.Get (BusName, "State"));
151+ return (DeviceState) Enum.ToObject (typeof (DeviceState), BusObject.Get (NMDBusName, "State"));
152 } catch (Exception e) {
153 Log<NetworkDevice>.Error (e.Message);
154 Log<NetworkDevice>.Debug (e.StackTrace);
155@@ -93,16 +94,16 @@
156 void SetIPs ()
157 {
158 if (State == DeviceState.Active) {
159- if (BusObject.Get (BusName, "Dhcp4Config").ToString () != "/")
160+ if (BusObject.Get (NMDBusName, "Dhcp4Config").ToString () != "/")
161 ConType = ConnectionType.Manaul;
162 else
163 ConType = ConnectionType.DHCP;
164- IP4Config = new DBusObject<IIP4Config> (NMBusName, BusObject.Get (BusName, "Ip4Config").ToString ());
165- IP4Address = new IPAddress (long.Parse (BusObject.Get (BusName, "Ip4Address").ToString ()));
166- uint[][] Addresses = (uint[][]) IP4Config.BusObject.Get (IP4Config.BusName, "Addresses");
167+ IP4Config = new DBusObject<IIP4Config> (NMBusName, BusObject.Get (NMDBusName, "Ip4Config").ToString ());
168+ IP4Address = new IPAddress (long.Parse (BusObject.Get (NMDBusName, "Ip4Address").ToString ()));
169+ uint[][] Addresses = (uint[][]) IP4Config.BusObject.Get ("org.freedesktop.NetworkManager.IP4Config", "Addresses");
170 Gateway = new IPAddress (Addresses[0][2]);
171 SubnetMask = ConvertPrefixToIp ((int) Addresses[0][1]);
172- uint[] NameServers = (uint[]) IP4Config.BusObject.Get (IP4Config.BusName, "Nameservers");
173+ uint[] NameServers = (uint[]) IP4Config.BusObject.Get ("org.freedesktop.NetworkManager.IP4Config", "Nameservers");
174 if (NameServers.Length > 0)
175 PrimaryDNS = new IPAddress (NameServers[0]);
176 else
177
178=== modified file 'StandardPlugins/NetworkManager/src/NetworkManager.cs'
179--- StandardPlugins/NetworkManager/src/NetworkManager.cs 2010-10-09 12:54:14 +0000
180+++ StandardPlugins/NetworkManager/src/NetworkManager.cs 2013-05-29 10:25:31 +0000
181@@ -38,10 +38,7 @@
182 get {
183 foreach (string active in DevManager.ActiveConnections) {
184 DBusObject<IActiveConnection> ActiveConnection = new DBusObject<IActiveConnection> ("org.freedesktop.NetworkManager", active);
185- if (ActiveConnection.BusObject.Get (ActiveConnection.BusName, "ServiceName").ToString ().Contains ("System"))
186- yield return ConManager.SystemConnections.Where (con => con.ObjectPath == ActiveConnection.BusObject.Get (ActiveConnection.BusName, "Connection").ToString ()).First ();
187- else
188- yield return ConManager.UserConnections.Where (con => con.ObjectPath == ActiveConnection.BusObject.Get (ActiveConnection.BusName, "Connection").ToString ()).First ();
189+ yield return ConManager.SystemConnections.Where (con => con.ObjectPath == ActiveConnection.BusObject.Get ("org.freedesktop.NetworkManager.Connection.Active", "Connection").ToString ()).First ();
190 }
191 }
192 }
193@@ -86,11 +83,7 @@
194 return;
195 }
196
197- string serviceName;
198- if (con.Owner == ConnectionOwner.System)
199- serviceName = "org.freedesktop.NetworkManagerSystemSettings";
200- else
201- serviceName = "org.freedesktop.NetworkManagerUserSettings";
202+ string serviceName = "org.freedesktop.NetworkManager";
203 string conStr = con.ObjectPath;
204
205 DevManager.BusObject.ActivateConnection(serviceName, new ObjectPath (conStr), new ObjectPath (dev.ObjectPath), new ObjectPath (specObj));
206
207=== modified file 'StandardPlugins/NetworkManager/src/WiredDevice.cs'
208--- StandardPlugins/NetworkManager/src/WiredDevice.cs 2010-10-09 12:54:14 +0000
209+++ StandardPlugins/NetworkManager/src/WiredDevice.cs 2013-05-29 10:25:31 +0000
210@@ -33,15 +33,17 @@
211
212 public DBusObject<IWiredDevice> WiredProperties { get; private set; }
213
214+ const string WiredBusName = "org.freedesktop.NetworkManager.Device.Wired";
215+
216 public bool Carrier {
217 get {
218- return Boolean.Parse (WiredProperties.BusObject.Get (WiredProperties.BusName, "Carrier").ToString ());
219+ return Boolean.Parse (WiredProperties.BusObject.Get (WiredBusName, "Carrier").ToString ());
220 }
221 }
222
223 public string HWAddresss {
224 get {
225- return WiredProperties.BusObject.Get (WiredProperties.BusName, "HwAddress").ToString ();
226+ return WiredProperties.BusObject.Get (WiredBusName, "HwAddress").ToString ();
227 }
228 }
229 }
230
231=== modified file 'StandardPlugins/NetworkManager/src/WirelessAccessPoint.cs'
232--- StandardPlugins/NetworkManager/src/WirelessAccessPoint.cs 2009-11-28 23:36:17 +0000
233+++ StandardPlugins/NetworkManager/src/WirelessAccessPoint.cs 2013-05-29 10:25:31 +0000
234@@ -47,11 +47,13 @@
235 public WirelessAccessPoint (string objectPath) : base("org.freedesktop.NetworkManager", objectPath)
236 {
237 }
238+
239+ const string APBusName = "org.freedesktop.NetworkManager.AccessPoint";
240
241 public string SSID {
242 get {
243 try {
244- return System.Text.ASCIIEncoding.ASCII.GetString ((byte[]) BusObject.Get (BusName, "Ssid"));
245+ return System.Text.ASCIIEncoding.ASCII.GetString ((byte[]) BusObject.Get (APBusName, "Ssid"));
246 } catch (Exception e) {
247 Log<WirelessAccessPoint>.Error (ObjectPath);
248 Log<WirelessAccessPoint>.Error (e.Message);
249@@ -64,7 +66,7 @@
250 public byte Strength {
251 get {
252 try {
253- return (byte) BusObject.Get (BusName, "Strength");
254+ return (byte) BusObject.Get (APBusName, "Strength");
255 } catch (Exception e) {
256 Log<WirelessAccessPoint>.Error (ObjectPath);
257 Log<WirelessAccessPoint>.Error (e.Message);
258@@ -77,7 +79,7 @@
259 public APFlags Flags {
260 get {
261 try {
262- return (APFlags) Convert.ToInt32 (BusObject.Get (BusName, "Flags"));
263+ return (APFlags) Convert.ToInt32 (BusObject.Get (APBusName, "Flags"));
264 } catch (Exception e) {
265 Log<WirelessAccessPoint>.Error (ObjectPath);
266 Log<WirelessAccessPoint>.Error (e.Message);
267@@ -90,7 +92,7 @@
268 public AccessPointSecurity RsnFlags {
269 get {
270 try {
271- return (AccessPointSecurity) Convert.ToInt32 (BusObject.Get (BusName, "RsnFlags"));
272+ return (AccessPointSecurity) Convert.ToInt32 (BusObject.Get (APBusName, "RsnFlags"));
273 } catch (Exception e) {
274 Log<WirelessAccessPoint>.Error (ObjectPath);
275 Log<WirelessAccessPoint>.Error (e.Message);
276@@ -103,7 +105,7 @@
277 public AccessPointSecurity WpaFlags {
278 get {
279 try {
280- return (AccessPointSecurity) Convert.ToInt32 (BusObject.Get (BusName, "WpaFlags"));
281+ return (AccessPointSecurity) Convert.ToInt32 (BusObject.Get (APBusName, "WpaFlags"));
282 } catch (Exception e) {
283 Log<WirelessAccessPoint>.Error (ObjectPath);
284 Log<WirelessAccessPoint>.Error (e.Message);
285
286=== modified file 'StandardPlugins/NetworkManager/src/WirelessDevice.cs'
287--- StandardPlugins/NetworkManager/src/WirelessDevice.cs 2010-10-09 12:54:14 +0000
288+++ StandardPlugins/NetworkManager/src/WirelessDevice.cs 2013-05-29 10:25:31 +0000
289@@ -74,9 +74,11 @@
290 return null;
291 }
292
293+ const string WirelessBusName = "org.freedesktop.NetworkManager.Device.Wireless";
294+
295 public WirelessAccessPoint ActiveAccessPoint {
296 get {
297- string access = WirelessProperties.BusObject.Get (WirelessProperties.BusName, "ActiveAccessPoint").ToString ();
298+ string access = WirelessProperties.BusObject.Get (WirelessBusName, "ActiveAccessPoint").ToString ();
299 return AccessPoints
300 .Where (ap => ap.ObjectPath == access)
301 .DefaultIfEmpty (null)
302@@ -85,7 +87,7 @@
303 }
304
305 public string HWAddress {
306- get { return WirelessProperties.BusObject.Get (WirelessProperties.BusName, "HwAddress").ToString (); }
307+ get { return WirelessProperties.BusObject.Get (WirelessBusName, "HwAddress").ToString (); }
308 }
309 }
310 }

Subscribers

People subscribed via source and target branches

to status/vote changes: