Merge lp:~kvalo/indicator-network/settings-tech-control into lp:~indicator-applet-developers/indicator-network/indicator-network
- settings-tech-control
- Merge into indicator-network
Proposed by
Kalle Valo
Status: | Merged |
---|---|
Merged at revision: | 153 |
Proposed branch: | lp:~kvalo/indicator-network/settings-tech-control |
Merge into: | lp:~indicator-applet-developers/indicator-network/indicator-network |
Diff against target: |
579 lines (+197/-160) 8 files modified
src/settings/backend/device.vala (+103/-53) src/settings/frontend/pages/connections.vala (+23/-32) src/settings/frontend/widgets/device-boxes/base.vala (+0/-1) src/settings/frontend/widgets/device-boxes/bluetooth.vala (+3/-6) src/settings/frontend/widgets/device-boxes/flightmode.vala (+19/-19) src/settings/frontend/widgets/device-boxes/mobile.vala (+29/-26) src/settings/frontend/widgets/device-boxes/wired.vala (+3/-6) src/settings/frontend/widgets/device-boxes/wireless.vala (+17/-17) |
To merge this branch: | bzr merge lp:~kvalo/indicator-network/settings-tech-control |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Conor Curran (community) | Approve | ||
Andrew (community) | Needs Fixing | ||
Review via email: mp+50972@code.launchpad.net |
Commit message
Description of the change
Connect device on/off buttons to libconnman. Also the icons on the left show now real state.
Wired, mobile and bluetooth boxes still are not implemented.
To post a comment you must log in.
- 159. By Kalle Valo
-
settings: fix spelling of word flight
My most common spelling error :)
Revision history for this message
Kalle Valo (kvalo) wrote : | # |
Andrew <email address hidden> writes:
> Review: Needs Fixing
> This all looks great Kalle!
Thanks for review!
> Just one small issue, FligthModeDevice should be FlightModeDevice :)
Haha, I always do the same mistake :) I should make emacs warn about
this...
> The fact that this is the only issue is a credit to your work!
No, this is all credit to your work. The architecture for the settings
app is just excellent, it was extremely simple to connect libconnman to
it.
--
Kalle Valo
Revision history for this message
Conor Curran (cjcurran) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/settings/backend/device.vala' |
2 | --- src/settings/backend/device.vala 2011-01-24 17:15:22 +0000 |
3 | +++ src/settings/backend/device.vala 2011-02-24 08:05:23 +0000 |
4 | @@ -18,57 +18,107 @@ |
5 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
6 | */ |
7 | |
8 | -public class Device : GLib.Object { |
9 | - |
10 | - public DeviceType type_ { get; set; } |
11 | - public DeviceState state { get; set; } |
12 | - |
13 | - public Device() { |
14 | - } |
15 | -} |
16 | - |
17 | -public static Device[] get_wired_devices() { |
18 | - // Populate Device View (temporary) |
19 | - var device1 = new Device(); |
20 | - device1.type_ = DeviceType.WIRED; |
21 | - device1.state = DeviceState.OFFLINE; |
22 | - // |
23 | - return {device1}; |
24 | -} |
25 | - |
26 | -public static Device[] get_wireless_devices() { |
27 | - // Populate Device View (temporary) |
28 | - var device1 = new Device(); |
29 | - device1.type_ = DeviceType.WIRELESS; |
30 | - device1.state = DeviceState.ONLINE; |
31 | - var device2 = new Device(); |
32 | - device2.type_ = DeviceType.WIRELESS; |
33 | - device2.state = DeviceState.OFF; |
34 | - // |
35 | - return {device1, device2}; |
36 | -} |
37 | - |
38 | -public static Device[] get_mobile_devices() { |
39 | - // Populate Device View (temporary) |
40 | - var device3 = new Device(); |
41 | - device3.type_ = DeviceType.MOBILE; |
42 | - device3.state = DeviceState.CONNECTED; |
43 | - // |
44 | - return {device3}; |
45 | -} |
46 | - |
47 | -public static Device[] get_bluetooth_devices() { |
48 | - // Populate Device View (temporary) |
49 | - var device4 = new Device(); |
50 | - device4.type_ = DeviceType.BLUETOOTH; |
51 | - device4.state = DeviceState.OFF; |
52 | - // |
53 | - return {device4}; |
54 | -} |
55 | - |
56 | -public static Device get_flightmode_device() { |
57 | - var device = new Device(); |
58 | - device.type_ = DeviceType.FLIGHTMODE; |
59 | - device.state = DeviceState.OFF; |
60 | - return device; |
61 | +public abstract class Device : GLib.Object { |
62 | + |
63 | + public DeviceType type_ { get; protected set; } |
64 | + public DeviceState state { get; protected set; } |
65 | + |
66 | + protected Connman.Manager connman; |
67 | + |
68 | + protected DeviceState convert_state(Connman.TechnologyState state) { |
69 | + |
70 | + switch (state) { |
71 | + case Connman.TechnologyState.CONNECTED: |
72 | + return DeviceState.CONNECTED; |
73 | + case Connman.TechnologyState.ENABLED: |
74 | + return DeviceState.ONLINE; |
75 | + case Connman.TechnologyState.OFFLINE: |
76 | + return DeviceState.OFFLINE; |
77 | + case Connman.TechnologyState.AVAILABLE: |
78 | + default: |
79 | + return DeviceState.OFF; |
80 | + } |
81 | + } |
82 | + |
83 | + protected void update_state(Connman.TechnologyState state) { |
84 | + this.state = convert_state(state); |
85 | + } |
86 | +} |
87 | + |
88 | +public class WifiDevice : Device { |
89 | + |
90 | + public WifiDevice(Connman.Manager connman) { |
91 | + this.type_ = DeviceType.WIRELESS; |
92 | + this.connman = connman; |
93 | + |
94 | + this.connman.notify["wifi-state"].connect((s, p) => { |
95 | + update_state(this.connman.get_wifi_state()); |
96 | + }); |
97 | + |
98 | + update_state(this.connman.get_wifi_state()); |
99 | + } |
100 | +} |
101 | + |
102 | +public class EthernetDevice : Device { |
103 | + |
104 | + public EthernetDevice(Connman.Manager connman) { |
105 | + this.type_ = DeviceType.WIRED; |
106 | + this.connman = connman; |
107 | + |
108 | + this.connman.notify["ethernet-state"].connect((s, p) => { |
109 | + update_state(this.connman.get_ethernet_state()); |
110 | + }); |
111 | + |
112 | + update_state(this.connman.get_ethernet_state()); |
113 | + } |
114 | +} |
115 | + |
116 | +public class CellularDevice : Device { |
117 | + |
118 | + public CellularDevice(Connman.Manager connman) { |
119 | + this.type_ = DeviceType.MOBILE; |
120 | + this.connman = connman; |
121 | + |
122 | + this.connman.notify["cellular-state"].connect((s, p) => { |
123 | + update_state(this.connman.get_cellular_state()); |
124 | + }); |
125 | + |
126 | + update_state(this.connman.get_cellular_state()); |
127 | + } |
128 | +} |
129 | + |
130 | +public class BluetoothDevice : Device { |
131 | + |
132 | + public BluetoothDevice(Connman.Manager connman) { |
133 | + this.type_ = DeviceType.BLUETOOTH; |
134 | + this.connman = connman; |
135 | + |
136 | + this.connman.notify["bluetooth-state"].connect((s, p) => { |
137 | + update_state(this.connman.get_bluetooth_state()); |
138 | + }); |
139 | + |
140 | + update_state(this.connman.get_bluetooth_state()); |
141 | + } |
142 | +} |
143 | + |
144 | +public class FlightModeDevice : Device { |
145 | + |
146 | + public FlightModeDevice(Connman.Manager connman) { |
147 | + this.type_ = DeviceType.FLIGHTMODE; |
148 | + this.connman = connman; |
149 | + |
150 | + this.connman.notify["offline-mode"].connect((s, p) => { |
151 | + update_mode(this.connman.offline_mode); |
152 | + }); |
153 | + |
154 | + update_mode(this.connman.offline_mode); |
155 | + } |
156 | + |
157 | + private void update_mode(bool mode) { |
158 | + |
159 | + if (mode) |
160 | + this.state = DeviceState.OFFLINE; |
161 | + else |
162 | + this.state = DeviceState.ONLINE; |
163 | + } |
164 | } |
165 | |
166 | === modified file 'src/settings/frontend/pages/connections.vala' |
167 | --- src/settings/frontend/pages/connections.vala 2011-02-01 12:59:54 +0000 |
168 | +++ src/settings/frontend/pages/connections.vala 2011-02-24 08:05:23 +0000 |
169 | @@ -47,43 +47,34 @@ |
170 | this.treeview_devices.reordered.connect( |
171 | this.on_treeview_devices_reordered); |
172 | |
173 | - Device[] wired_devices = get_wired_devices(); |
174 | - Device[] wireless_devices = get_wireless_devices(); |
175 | - Device[] mobile_devices = get_mobile_devices(); |
176 | - Device[] bluetooth_devices = get_bluetooth_devices(); |
177 | - |
178 | - foreach (var device in wireless_devices) { |
179 | - var box = new WirelessBox(device, connman, datadir); |
180 | - notebook_right.append_page(box, null); |
181 | - this.add_device(device, box); |
182 | - } |
183 | - |
184 | - foreach (var device in mobile_devices) { |
185 | - var box = new MobileBox(device, datadir); |
186 | - notebook_right.append_page(box, null); |
187 | - this.add_device(device, box); |
188 | - } |
189 | - |
190 | - foreach (var device in wired_devices) { |
191 | - var box = new WiredBox(device, datadir); |
192 | - notebook_right.append_page(box, null); |
193 | - this.add_device(device, box); |
194 | - } |
195 | - |
196 | - foreach (var device in bluetooth_devices) { |
197 | - var box = new BluetoothBox(device, datadir); |
198 | - notebook_right.append_page(box, null); |
199 | - this.add_device(device, box); |
200 | - } |
201 | - |
202 | - var flightmode_device = get_flightmode_device(); |
203 | - var flightmode_box = new FlightModeBox(flightmode_device, datadir); |
204 | + var wifi = new WifiDevice(connman); |
205 | + var wifi_box = new WirelessBox(connman, datadir); |
206 | + notebook_right.append_page(wifi_box, null); |
207 | + this.add_device(wifi, wifi_box); |
208 | + |
209 | + var ethernet = new EthernetDevice(connman); |
210 | + var ethernet_box = new WiredBox(connman, datadir); |
211 | + notebook_right.append_page(ethernet_box, null); |
212 | + this.add_device(ethernet, ethernet_box); |
213 | + |
214 | + var cellular = new CellularDevice(connman); |
215 | + var cellular_box = new MobileBox(connman, datadir); |
216 | + notebook_right.append_page(cellular_box, null); |
217 | + this.add_device(cellular, cellular_box); |
218 | + |
219 | + var bluetooth = new BluetoothDevice(connman); |
220 | + var bluetooth_box = new BluetoothBox(connman, datadir); |
221 | + notebook_right.append_page(bluetooth_box, null); |
222 | + this.add_device(bluetooth, bluetooth_box); |
223 | + |
224 | + var flightmode_device = new FlightModeDevice(connman); |
225 | + var flightmode_box = new FlightModeBox(flightmode_device, connman, |
226 | + datadir); |
227 | notebook_right.append_page(flightmode_box, null); |
228 | this.add_device(flightmode_device, flightmode_box); |
229 | |
230 | // Order the RHS notebook pages inaccordance with the deviceview |
231 | this.on_treeview_devices_reordered(); |
232 | - |
233 | } |
234 | |
235 | public void add_device(Device device, DeviceBox box) { |
236 | |
237 | === modified file 'src/settings/frontend/widgets/device-boxes/base.vala' |
238 | --- src/settings/frontend/widgets/device-boxes/base.vala 2011-01-10 17:35:19 +0000 |
239 | +++ src/settings/frontend/widgets/device-boxes/base.vala 2011-02-24 08:05:23 +0000 |
240 | @@ -22,5 +22,4 @@ |
241 | /* A gtk.VBox which holds all of the widgets to control a device */ |
242 | |
243 | public DeviceBox() {} |
244 | - public abstract void on_device_state_changed(ParamSpec p); |
245 | } |
246 | |
247 | === modified file 'src/settings/frontend/widgets/device-boxes/bluetooth.vala' |
248 | --- src/settings/frontend/widgets/device-boxes/bluetooth.vala 2011-01-10 17:35:19 +0000 |
249 | +++ src/settings/frontend/widgets/device-boxes/bluetooth.vala 2011-02-24 08:05:23 +0000 |
250 | @@ -23,13 +23,10 @@ |
251 | /* A Gtk.VBox which holds all of the widgets to control a bluetooth |
252 | device. */ |
253 | |
254 | - private Device device; |
255 | + private Connman.Manager connman; |
256 | |
257 | - public BluetoothBox(Device device, string datadir) { |
258 | + public BluetoothBox(Connman.Manager connman, string datadir) { |
259 | this.set_spacing(12); |
260 | - this.device = device; |
261 | - this.device.notify["state"].connect(this.on_device_state_changed); |
262 | + this.connman = connman; |
263 | } |
264 | - |
265 | - public override void on_device_state_changed(ParamSpec p) {} |
266 | } |
267 | |
268 | === modified file 'src/settings/frontend/widgets/device-boxes/flightmode.vala' |
269 | --- src/settings/frontend/widgets/device-boxes/flightmode.vala 2011-01-24 17:15:22 +0000 |
270 | +++ src/settings/frontend/widgets/device-boxes/flightmode.vala 2011-02-24 08:05:23 +0000 |
271 | @@ -26,6 +26,7 @@ |
272 | |
273 | private string datadir; |
274 | private Device device; |
275 | + private Connman.Manager connman; |
276 | private InfoBox infobox; |
277 | private ToggleSwitch toggleswitch; |
278 | private Gtk.Label label_status; |
279 | @@ -35,11 +36,13 @@ |
280 | private Gtk.Button button_more_information; |
281 | private Gtk.CheckButton checkbutton_show; |
282 | |
283 | - public FlightModeBox(Device device, string datadir) { |
284 | + public FlightModeBox(Device device, Connman.Manager connman, |
285 | + string datadir) { |
286 | this.set_spacing(12); |
287 | this.datadir = datadir; |
288 | this.device = device; |
289 | - this.device.notify["state"].connect(this.on_device_state_changed); |
290 | + this.connman = connman; |
291 | + this.connman.notify["offline-mode"].connect(this.offline_mode_changed); |
292 | |
293 | // Infobox and Togglswitch |
294 | /// Creation |
295 | @@ -64,7 +67,7 @@ |
296 | /// Packing |
297 | this.pack_start(this.vbox_information, true, true); |
298 | |
299 | - this.update_widget_states(this.device.state); |
300 | + this.update_widget_states(this.connman.offline_mode); |
301 | } |
302 | |
303 | private void get_widgets() { |
304 | @@ -76,34 +79,31 @@ |
305 | private void connect_signals() { |
306 | } |
307 | |
308 | - private void update_widget_states(DeviceState state) { |
309 | + private void update_widget_states(bool offline) { |
310 | bool toggleswitch_state = false; |
311 | string status_text = ""; |
312 | - |
313 | - switch (state) { |
314 | - case DeviceState.ONLINE: |
315 | - toggleswitch_state = true; |
316 | - status_text = ("Flight Mode is on."); |
317 | - break; |
318 | - case DeviceState.OFF: |
319 | - toggleswitch_state = false; |
320 | - status_text = ("Flight Mode is off."); |
321 | - break; |
322 | + |
323 | + if (offline) { |
324 | + toggleswitch_state = true; |
325 | + status_text = ("Flight Mode is on."); |
326 | + } else { |
327 | + toggleswitch_state = false; |
328 | + status_text = ("Flight Mode is off."); |
329 | } |
330 | |
331 | this.toggleswitch.set_active(toggleswitch_state); |
332 | this.label_status.set_text(status_text); |
333 | } |
334 | - |
335 | - public override void on_device_state_changed(ParamSpec p) { |
336 | - this.update_widget_states(this.device.state); |
337 | + |
338 | + private void offline_mode_changed(ParamSpec p) { |
339 | + this.update_widget_states(this.connman.offline_mode); |
340 | } |
341 | |
342 | private void on_toggleswitch_toggled() { |
343 | if (this.toggleswitch.get_active()) { |
344 | - this.device.state = DeviceState.ONLINE; |
345 | + this.connman.offline_mode = true; |
346 | } else { |
347 | - this.device.state = DeviceState.OFF; |
348 | + this.connman.offline_mode = false; |
349 | } |
350 | } |
351 | } |
352 | |
353 | === modified file 'src/settings/frontend/widgets/device-boxes/mobile.vala' |
354 | --- src/settings/frontend/widgets/device-boxes/mobile.vala 2011-01-10 17:35:19 +0000 |
355 | +++ src/settings/frontend/widgets/device-boxes/mobile.vala 2011-02-24 08:05:23 +0000 |
356 | @@ -25,7 +25,7 @@ |
357 | monitor the state of the mobile device, and a set of widgets |
358 | to enter details about the mobile network to connect to. */ |
359 | |
360 | - private Device device; |
361 | + private Connman.Manager connman; |
362 | private InfoBox infobox; |
363 | private ToggleSwitch toggleswitch; |
364 | private Gtk.Label label_status; |
365 | @@ -40,10 +40,11 @@ |
366 | private const string[] sensitive_widgets = {"label_apn_place", "label_apn", |
367 | "label_pin_auth", "checkbutton_show_pin"}; |
368 | |
369 | - public MobileBox(Device device, string datadir) { |
370 | + public MobileBox(Connman.Manager connman, string datadir) { |
371 | this.set_spacing(12); |
372 | - this.device = device; |
373 | - this.device.notify["state"].connect(this.on_device_state_changed); |
374 | + this.connman = connman; |
375 | + |
376 | + this.connman.notify["cellular-state"].connect(this.on_cellular_state_changed); |
377 | |
378 | // Infobox and Togglswitch |
379 | /// Creation |
380 | @@ -68,7 +69,7 @@ |
381 | /// Packing |
382 | this.pack_start(this.table_settings, true, true); |
383 | |
384 | - this.update_widget_states(this.device.state); |
385 | + this.update_widget_states(this.connman.get_cellular_state()); |
386 | this.on_checkbutton_show_pin_toggled(); |
387 | } |
388 | |
389 | @@ -82,32 +83,32 @@ |
390 | this.checkbutton_show_pin.toggled.connect(this.on_checkbutton_show_pin_toggled); |
391 | } |
392 | |
393 | - private void update_widget_states(DeviceState state) { |
394 | + private void update_widget_states(Connman.TechnologyState state) { |
395 | bool toggleswitch_state = false; |
396 | string status_text = ""; |
397 | |
398 | switch (state) { |
399 | - case DeviceState.CONNECTED: |
400 | - this.device_editable = true; |
401 | - this.settings_editable = false; |
402 | - toggleswitch_state = true; |
403 | - status_text = ("Connected to “Vodafone UK”."); |
404 | - break; |
405 | - case DeviceState.ONLINE: |
406 | - this.device_editable = true; |
407 | - this.settings_editable = false; |
408 | - toggleswitch_state = true; |
409 | - status_text = ("Connected to the Internet on “Vodafone UK”."); |
410 | - break; |
411 | - case DeviceState.OFF: |
412 | - this.device_editable = false; |
413 | + case Connman.TechnologyState.ENABLED: |
414 | + this.device_editable = true; |
415 | this.settings_editable = true; |
416 | + toggleswitch_state = true; |
417 | + status_text = ("Mobile Broadband is enabled."); |
418 | + break; |
419 | + case Connman.TechnologyState.CONNECTED: |
420 | + this.device_editable = true; |
421 | + this.settings_editable = false; |
422 | + toggleswitch_state = true; |
423 | + status_text = ("Connected to the Internet."); |
424 | + break; |
425 | + case Connman.TechnologyState.AVAILABLE: |
426 | + this.device_editable = true; |
427 | + this.settings_editable = false; |
428 | toggleswitch_state = false; |
429 | status_text = ("The Mobile Broadband device is powered off."); |
430 | break; |
431 | - case DeviceState.OFFLINE: |
432 | + case Connman.TechnologyState.OFFLINE: |
433 | this.device_editable = true; |
434 | - this.settings_editable = true; |
435 | + this.settings_editable = false; |
436 | toggleswitch_state = false; |
437 | status_text = ("Mobile Broadband is offline."); |
438 | break; |
439 | @@ -133,15 +134,17 @@ |
440 | } |
441 | } |
442 | |
443 | - public override void on_device_state_changed(ParamSpec p) { |
444 | - this.update_widget_states(this.device.state); |
445 | + private void on_cellular_state_changed(ParamSpec p) { |
446 | + this.update_widget_states(this.connman.get_cellular_state()); |
447 | } |
448 | |
449 | private void on_toggleswitch_toggled() { |
450 | if (this.toggleswitch.get_active()) { |
451 | - this.device.state = DeviceState.CONNECTED; |
452 | + this.connman.enable_technology(Connman.TechnologyType.CELLULAR, |
453 | + null); |
454 | } else { |
455 | - this.device.state = DeviceState.OFFLINE; |
456 | + this.connman.disable_technology(Connman.TechnologyType.CELLULAR, |
457 | + null); |
458 | } |
459 | } |
460 | |
461 | |
462 | === modified file 'src/settings/frontend/widgets/device-boxes/wired.vala' |
463 | --- src/settings/frontend/widgets/device-boxes/wired.vala 2011-01-10 17:35:19 +0000 |
464 | +++ src/settings/frontend/widgets/device-boxes/wired.vala 2011-02-24 08:05:23 +0000 |
465 | @@ -23,13 +23,10 @@ |
466 | /* A Gtk.VBox which holds all of the widgets to control a wired |
467 | device. */ |
468 | |
469 | - private Device device; |
470 | + private Connman.Manager connman; |
471 | |
472 | - public WiredBox(Device device, string datadir) { |
473 | + public WiredBox(Connman.Manager connman, string datadir) { |
474 | this.set_spacing(12); |
475 | - this.device = device; |
476 | - this.device.notify["state"].connect(this.on_device_state_changed); |
477 | + this.connman = connman; |
478 | } |
479 | - |
480 | - public override void on_device_state_changed(ParamSpec p) {} |
481 | } |
482 | |
483 | === modified file 'src/settings/frontend/widgets/device-boxes/wireless.vala' |
484 | --- src/settings/frontend/widgets/device-boxes/wireless.vala 2011-02-01 13:29:19 +0000 |
485 | +++ src/settings/frontend/widgets/device-boxes/wireless.vala 2011-02-24 08:05:23 +0000 |
486 | @@ -27,7 +27,7 @@ |
487 | wireless networks. */ |
488 | |
489 | private string datadir; |
490 | - private Device device; |
491 | + private Connman.Manager connman; |
492 | private InfoBox infobox; |
493 | private ToggleSwitch toggleswitch; |
494 | private Gtk.Label label_status; |
495 | @@ -39,12 +39,12 @@ |
496 | private Gtk.Button button_edit; |
497 | private Gtk.ScrolledWindow scrolledwindow_connections; |
498 | |
499 | - public WirelessBox(Device device, Connman.Manager connman, |
500 | - string datadir) { |
501 | + public WirelessBox(Connman.Manager connman, string datadir) { |
502 | this.set_spacing(12); |
503 | this.datadir = datadir; |
504 | - this.device = device; |
505 | - this.device.notify["state"].connect(this.on_device_state_changed); |
506 | + this.connman = connman; |
507 | + |
508 | + this.connman.notify["wifi-state"].connect(this.wifi_state_changed); |
509 | |
510 | // Infobox and Togglswitch |
511 | /// Creation |
512 | @@ -85,7 +85,7 @@ |
513 | this.add_service(service); |
514 | } |
515 | |
516 | - this.update_widget_states(this.device.state); |
517 | + this.update_widget_states(this.connman.get_wifi_state()); |
518 | this.on_treeview_connections_selection_changed(); |
519 | } |
520 | |
521 | @@ -102,32 +102,32 @@ |
522 | this.button_edit.clicked.connect(this.on_button_edit_clicked); |
523 | } |
524 | |
525 | - private void update_widget_states(DeviceState state) { |
526 | + private void update_widget_states(Connman.TechnologyState state) { |
527 | bool device_editable = false; |
528 | bool settings_editable = false; |
529 | bool toggleswitch_state = false; |
530 | string status_text = ""; |
531 | - |
532 | + |
533 | switch (state) { |
534 | - case DeviceState.CONNECTED: |
535 | + case Connman.TechnologyState.ENABLED: |
536 | device_editable = true; |
537 | settings_editable = true; |
538 | toggleswitch_state = true; |
539 | status_text = ("Wi-fi is on but not connected to the Internet."); |
540 | break; |
541 | - case DeviceState.ONLINE: |
542 | + case Connman.TechnologyState.CONNECTED: |
543 | device_editable = true; |
544 | settings_editable = true; |
545 | toggleswitch_state = true; |
546 | status_text = ("Wi-fi is on and connected to the Internet."); |
547 | break; |
548 | - case DeviceState.OFF: |
549 | - device_editable = false; |
550 | + case Connman.TechnologyState.AVAILABLE: |
551 | + device_editable = true; |
552 | settings_editable = false; |
553 | toggleswitch_state = false; |
554 | status_text = ("The Wi-fi device is powered off."); |
555 | break; |
556 | - case DeviceState.OFFLINE: |
557 | + case Connman.TechnologyState.OFFLINE: |
558 | device_editable = true; |
559 | settings_editable = false; |
560 | toggleswitch_state = false; |
561 | @@ -150,15 +150,15 @@ |
562 | liststore.add_service(service, name, signal, last_used); |
563 | } |
564 | |
565 | - public override void on_device_state_changed(ParamSpec p) { |
566 | - this.update_widget_states(this.device.state); |
567 | + private void wifi_state_changed(ParamSpec p) { |
568 | + this.update_widget_states(this.connman.get_wifi_state()); |
569 | } |
570 | |
571 | private void on_toggleswitch_toggled() { |
572 | if (this.toggleswitch.get_active()) { |
573 | - this.device.state = DeviceState.CONNECTED; |
574 | + this.connman.enable_technology(Connman.TechnologyType.WIFI, null); |
575 | } else { |
576 | - this.device.state = DeviceState.OFFLINE; |
577 | + this.connman.disable_technology(Connman.TechnologyType.WIFI, null); |
578 | } |
579 | } |
580 |
This all looks great Kalle!
Just one small issue, FligthModeDevice should be FlightModeDevice :) The fact that this is the only issue is a credit to your work!