Merge lp:~kvalo/indicator-network/settings-tech-control into lp:~indicator-applet-developers/indicator-network/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
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Andrew (community) Needs Fixing
Review via email: mp+50972@code.launchpad.net

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.
Revision history for this message
Andrew (and471) wrote :

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!

review: Needs Fixing
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
=== modified file 'src/settings/backend/device.vala'
--- src/settings/backend/device.vala 2011-01-24 17:15:22 +0000
+++ src/settings/backend/device.vala 2011-02-24 08:05:23 +0000
@@ -18,57 +18,107 @@
18 * with this program. If not, see <http://www.gnu.org/licenses/>.18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */19 */
2020
21public class Device : GLib.Object {21public abstract class Device : GLib.Object {
22 22
23 public DeviceType type_ { get; set; }23 public DeviceType type_ { get; protected set; }
24 public DeviceState state { get; set; }24 public DeviceState state { get; protected set; }
25 25
26 public Device() {26 protected Connman.Manager connman;
27 }27
28}28 protected DeviceState convert_state(Connman.TechnologyState state) {
2929
30public static Device[] get_wired_devices() {30 switch (state) {
31 // Populate Device View (temporary)31 case Connman.TechnologyState.CONNECTED:
32 var device1 = new Device();32 return DeviceState.CONNECTED;
33 device1.type_ = DeviceType.WIRED;33 case Connman.TechnologyState.ENABLED:
34 device1.state = DeviceState.OFFLINE;34 return DeviceState.ONLINE;
35 //35 case Connman.TechnologyState.OFFLINE:
36 return {device1};36 return DeviceState.OFFLINE;
37}37 case Connman.TechnologyState.AVAILABLE:
38 38 default:
39public static Device[] get_wireless_devices() {39 return DeviceState.OFF;
40 // Populate Device View (temporary)40 }
41 var device1 = new Device();41 }
42 device1.type_ = DeviceType.WIRELESS;42
43 device1.state = DeviceState.ONLINE;43 protected void update_state(Connman.TechnologyState state) {
44 var device2 = new Device();44 this.state = convert_state(state);
45 device2.type_ = DeviceType.WIRELESS;45 }
46 device2.state = DeviceState.OFF;46}
47 //47
48 return {device1, device2};48public class WifiDevice : Device {
49}49
50 50 public WifiDevice(Connman.Manager connman) {
51public static Device[] get_mobile_devices() {51 this.type_ = DeviceType.WIRELESS;
52 // Populate Device View (temporary)52 this.connman = connman;
53 var device3 = new Device();53
54 device3.type_ = DeviceType.MOBILE;54 this.connman.notify["wifi-state"].connect((s, p) => {
55 device3.state = DeviceState.CONNECTED;55 update_state(this.connman.get_wifi_state());
56 //56 });
57 return {device3};57
58} 58 update_state(this.connman.get_wifi_state());
59 59 }
60public static Device[] get_bluetooth_devices() {60}
61 // Populate Device View (temporary)61
62 var device4 = new Device();62public class EthernetDevice : Device {
63 device4.type_ = DeviceType.BLUETOOTH;63
64 device4.state = DeviceState.OFF;64 public EthernetDevice(Connman.Manager connman) {
65 //65 this.type_ = DeviceType.WIRED;
66 return {device4};66 this.connman = connman;
67}67
6868 this.connman.notify["ethernet-state"].connect((s, p) => {
69public static Device get_flightmode_device() {69 update_state(this.connman.get_ethernet_state());
70 var device = new Device();70 });
71 device.type_ = DeviceType.FLIGHTMODE;71
72 device.state = DeviceState.OFF;72 update_state(this.connman.get_ethernet_state());
73 return device;73 }
74}
75
76public class CellularDevice : Device {
77
78 public CellularDevice(Connman.Manager connman) {
79 this.type_ = DeviceType.MOBILE;
80 this.connman = connman;
81
82 this.connman.notify["cellular-state"].connect((s, p) => {
83 update_state(this.connman.get_cellular_state());
84 });
85
86 update_state(this.connman.get_cellular_state());
87 }
88}
89
90public class BluetoothDevice : Device {
91
92 public BluetoothDevice(Connman.Manager connman) {
93 this.type_ = DeviceType.BLUETOOTH;
94 this.connman = connman;
95
96 this.connman.notify["bluetooth-state"].connect((s, p) => {
97 update_state(this.connman.get_bluetooth_state());
98 });
99
100 update_state(this.connman.get_bluetooth_state());
101 }
102}
103
104public class FlightModeDevice : Device {
105
106 public FlightModeDevice(Connman.Manager connman) {
107 this.type_ = DeviceType.FLIGHTMODE;
108 this.connman = connman;
109
110 this.connman.notify["offline-mode"].connect((s, p) => {
111 update_mode(this.connman.offline_mode);
112 });
113
114 update_mode(this.connman.offline_mode);
115 }
116
117 private void update_mode(bool mode) {
118
119 if (mode)
120 this.state = DeviceState.OFFLINE;
121 else
122 this.state = DeviceState.ONLINE;
123 }
74}124}
75125
=== modified file 'src/settings/frontend/pages/connections.vala'
--- src/settings/frontend/pages/connections.vala 2011-02-01 12:59:54 +0000
+++ src/settings/frontend/pages/connections.vala 2011-02-24 08:05:23 +0000
@@ -47,43 +47,34 @@
47 this.treeview_devices.reordered.connect(47 this.treeview_devices.reordered.connect(
48 this.on_treeview_devices_reordered);48 this.on_treeview_devices_reordered);
4949
50 Device[] wired_devices = get_wired_devices();50 var wifi = new WifiDevice(connman);
51 Device[] wireless_devices = get_wireless_devices();51 var wifi_box = new WirelessBox(connman, datadir);
52 Device[] mobile_devices = get_mobile_devices();52 notebook_right.append_page(wifi_box, null);
53 Device[] bluetooth_devices = get_bluetooth_devices();53 this.add_device(wifi, wifi_box);
5454
55 foreach (var device in wireless_devices) {55 var ethernet = new EthernetDevice(connman);
56 var box = new WirelessBox(device, connman, datadir);56 var ethernet_box = new WiredBox(connman, datadir);
57 notebook_right.append_page(box, null);57 notebook_right.append_page(ethernet_box, null);
58 this.add_device(device, box);58 this.add_device(ethernet, ethernet_box);
59 }59
6060 var cellular = new CellularDevice(connman);
61 foreach (var device in mobile_devices) {61 var cellular_box = new MobileBox(connman, datadir);
62 var box = new MobileBox(device, datadir);62 notebook_right.append_page(cellular_box, null);
63 notebook_right.append_page(box, null);63 this.add_device(cellular, cellular_box);
64 this.add_device(device, box);64
65 }65 var bluetooth = new BluetoothDevice(connman);
66 66 var bluetooth_box = new BluetoothBox(connman, datadir);
67 foreach (var device in wired_devices) {67 notebook_right.append_page(bluetooth_box, null);
68 var box = new WiredBox(device, datadir);68 this.add_device(bluetooth, bluetooth_box);
69 notebook_right.append_page(box, null);69
70 this.add_device(device, box);70 var flightmode_device = new FlightModeDevice(connman);
71 }71 var flightmode_box = new FlightModeBox(flightmode_device, connman,
72 72 datadir);
73 foreach (var device in bluetooth_devices) {
74 var box = new BluetoothBox(device, datadir);
75 notebook_right.append_page(box, null);
76 this.add_device(device, box);
77 }
78
79 var flightmode_device = get_flightmode_device();
80 var flightmode_box = new FlightModeBox(flightmode_device, datadir);
81 notebook_right.append_page(flightmode_box, null);73 notebook_right.append_page(flightmode_box, null);
82 this.add_device(flightmode_device, flightmode_box);74 this.add_device(flightmode_device, flightmode_box);
8375
84 // Order the RHS notebook pages inaccordance with the deviceview76 // Order the RHS notebook pages inaccordance with the deviceview
85 this.on_treeview_devices_reordered();77 this.on_treeview_devices_reordered();
86
87 }78 }
8879
89 public void add_device(Device device, DeviceBox box) {80 public void add_device(Device device, DeviceBox box) {
9081
=== modified file 'src/settings/frontend/widgets/device-boxes/base.vala'
--- src/settings/frontend/widgets/device-boxes/base.vala 2011-01-10 17:35:19 +0000
+++ src/settings/frontend/widgets/device-boxes/base.vala 2011-02-24 08:05:23 +0000
@@ -22,5 +22,4 @@
22 /* A gtk.VBox which holds all of the widgets to control a device */22 /* A gtk.VBox which holds all of the widgets to control a device */
2323
24 public DeviceBox() {}24 public DeviceBox() {}
25 public abstract void on_device_state_changed(ParamSpec p);
26}25}
2726
=== modified file 'src/settings/frontend/widgets/device-boxes/bluetooth.vala'
--- src/settings/frontend/widgets/device-boxes/bluetooth.vala 2011-01-10 17:35:19 +0000
+++ src/settings/frontend/widgets/device-boxes/bluetooth.vala 2011-02-24 08:05:23 +0000
@@ -23,13 +23,10 @@
23 /* A Gtk.VBox which holds all of the widgets to control a bluetooth23 /* A Gtk.VBox which holds all of the widgets to control a bluetooth
24 device. */24 device. */
2525
26 private Device device;26 private Connman.Manager connman;
2727
28 public BluetoothBox(Device device, string datadir) {28 public BluetoothBox(Connman.Manager connman, string datadir) {
29 this.set_spacing(12);29 this.set_spacing(12);
30 this.device = device;30 this.connman = connman;
31 this.device.notify["state"].connect(this.on_device_state_changed);
32 }31 }
33
34 public override void on_device_state_changed(ParamSpec p) {}
35}32}
3633
=== modified file 'src/settings/frontend/widgets/device-boxes/flightmode.vala'
--- src/settings/frontend/widgets/device-boxes/flightmode.vala 2011-01-24 17:15:22 +0000
+++ src/settings/frontend/widgets/device-boxes/flightmode.vala 2011-02-24 08:05:23 +0000
@@ -26,6 +26,7 @@
2626
27 private string datadir;27 private string datadir;
28 private Device device;28 private Device device;
29 private Connman.Manager connman;
29 private InfoBox infobox;30 private InfoBox infobox;
30 private ToggleSwitch toggleswitch;31 private ToggleSwitch toggleswitch;
31 private Gtk.Label label_status;32 private Gtk.Label label_status;
@@ -35,11 +36,13 @@
35 private Gtk.Button button_more_information;36 private Gtk.Button button_more_information;
36 private Gtk.CheckButton checkbutton_show;37 private Gtk.CheckButton checkbutton_show;
3738
38 public FlightModeBox(Device device, string datadir) {39 public FlightModeBox(Device device, Connman.Manager connman,
40 string datadir) {
39 this.set_spacing(12);41 this.set_spacing(12);
40 this.datadir = datadir;42 this.datadir = datadir;
41 this.device = device;43 this.device = device;
42 this.device.notify["state"].connect(this.on_device_state_changed);44 this.connman = connman;
45 this.connman.notify["offline-mode"].connect(this.offline_mode_changed);
4346
44 // Infobox and Togglswitch47 // Infobox and Togglswitch
45 /// Creation48 /// Creation
@@ -64,7 +67,7 @@
64 /// Packing67 /// Packing
65 this.pack_start(this.vbox_information, true, true);68 this.pack_start(this.vbox_information, true, true);
6669
67 this.update_widget_states(this.device.state);70 this.update_widget_states(this.connman.offline_mode);
68 }71 }
6972
70 private void get_widgets() {73 private void get_widgets() {
@@ -76,34 +79,31 @@
76 private void connect_signals() {79 private void connect_signals() {
77 }80 }
7881
79 private void update_widget_states(DeviceState state) {82 private void update_widget_states(bool offline) {
80 bool toggleswitch_state = false;83 bool toggleswitch_state = false;
81 string status_text = "";84 string status_text = "";
82 85
83 switch (state) {86 if (offline) {
84 case DeviceState.ONLINE:87 toggleswitch_state = true;
85 toggleswitch_state = true;88 status_text = ("Flight Mode is on.");
86 status_text = ("Flight Mode is on.");89 } else {
87 break;90 toggleswitch_state = false;
88 case DeviceState.OFF:91 status_text = ("Flight Mode is off.");
89 toggleswitch_state = false;
90 status_text = ("Flight Mode is off.");
91 break;
92 }92 }
9393
94 this.toggleswitch.set_active(toggleswitch_state);94 this.toggleswitch.set_active(toggleswitch_state);
95 this.label_status.set_text(status_text);95 this.label_status.set_text(status_text);
96 }96 }
97 97
98 public override void on_device_state_changed(ParamSpec p) {98 private void offline_mode_changed(ParamSpec p) {
99 this.update_widget_states(this.device.state);99 this.update_widget_states(this.connman.offline_mode);
100 }100 }
101101
102 private void on_toggleswitch_toggled() {102 private void on_toggleswitch_toggled() {
103 if (this.toggleswitch.get_active()) {103 if (this.toggleswitch.get_active()) {
104 this.device.state = DeviceState.ONLINE;104 this.connman.offline_mode = true;
105 } else {105 } else {
106 this.device.state = DeviceState.OFF;106 this.connman.offline_mode = false;
107 }107 }
108 }108 }
109}109}
110110
=== modified file 'src/settings/frontend/widgets/device-boxes/mobile.vala'
--- src/settings/frontend/widgets/device-boxes/mobile.vala 2011-01-10 17:35:19 +0000
+++ src/settings/frontend/widgets/device-boxes/mobile.vala 2011-02-24 08:05:23 +0000
@@ -25,7 +25,7 @@
25 monitor the state of the mobile device, and a set of widgets25 monitor the state of the mobile device, and a set of widgets
26 to enter details about the mobile network to connect to. */26 to enter details about the mobile network to connect to. */
2727
28 private Device device;28 private Connman.Manager connman;
29 private InfoBox infobox;29 private InfoBox infobox;
30 private ToggleSwitch toggleswitch;30 private ToggleSwitch toggleswitch;
31 private Gtk.Label label_status;31 private Gtk.Label label_status;
@@ -40,10 +40,11 @@
40 private const string[] sensitive_widgets = {"label_apn_place", "label_apn",40 private const string[] sensitive_widgets = {"label_apn_place", "label_apn",
41 "label_pin_auth", "checkbutton_show_pin"};41 "label_pin_auth", "checkbutton_show_pin"};
4242
43 public MobileBox(Device device, string datadir) {43 public MobileBox(Connman.Manager connman, string datadir) {
44 this.set_spacing(12);44 this.set_spacing(12);
45 this.device = device;45 this.connman = connman;
46 this.device.notify["state"].connect(this.on_device_state_changed);46
47 this.connman.notify["cellular-state"].connect(this.on_cellular_state_changed);
4748
48 // Infobox and Togglswitch49 // Infobox and Togglswitch
49 /// Creation50 /// Creation
@@ -68,7 +69,7 @@
68 /// Packing69 /// Packing
69 this.pack_start(this.table_settings, true, true);70 this.pack_start(this.table_settings, true, true);
7071
71 this.update_widget_states(this.device.state);72 this.update_widget_states(this.connman.get_cellular_state());
72 this.on_checkbutton_show_pin_toggled();73 this.on_checkbutton_show_pin_toggled();
73 }74 }
7475
@@ -82,32 +83,32 @@
82 this.checkbutton_show_pin.toggled.connect(this.on_checkbutton_show_pin_toggled);83 this.checkbutton_show_pin.toggled.connect(this.on_checkbutton_show_pin_toggled);
83 }84 }
8485
85 private void update_widget_states(DeviceState state) {86 private void update_widget_states(Connman.TechnologyState state) {
86 bool toggleswitch_state = false;87 bool toggleswitch_state = false;
87 string status_text = "";88 string status_text = "";
8889
89 switch (state) {90 switch (state) {
90 case DeviceState.CONNECTED:91 case Connman.TechnologyState.ENABLED:
91 this.device_editable = true;92 this.device_editable = true;
92 this.settings_editable = false;
93 toggleswitch_state = true;
94 status_text = ("Connected to “Vodafone UK”.");
95 break;
96 case DeviceState.ONLINE:
97 this.device_editable = true;
98 this.settings_editable = false;
99 toggleswitch_state = true;
100 status_text = ("Connected to the Internet on “Vodafone UK”.");
101 break;
102 case DeviceState.OFF:
103 this.device_editable = false;
104 this.settings_editable = true;93 this.settings_editable = true;
94 toggleswitch_state = true;
95 status_text = ("Mobile Broadband is enabled.");
96 break;
97 case Connman.TechnologyState.CONNECTED:
98 this.device_editable = true;
99 this.settings_editable = false;
100 toggleswitch_state = true;
101 status_text = ("Connected to the Internet.");
102 break;
103 case Connman.TechnologyState.AVAILABLE:
104 this.device_editable = true;
105 this.settings_editable = false;
105 toggleswitch_state = false;106 toggleswitch_state = false;
106 status_text = ("The Mobile Broadband device is powered off.");107 status_text = ("The Mobile Broadband device is powered off.");
107 break;108 break;
108 case DeviceState.OFFLINE:109 case Connman.TechnologyState.OFFLINE:
109 this.device_editable = true;110 this.device_editable = true;
110 this.settings_editable = true;111 this.settings_editable = false;
111 toggleswitch_state = false;112 toggleswitch_state = false;
112 status_text = ("Mobile Broadband is offline.");113 status_text = ("Mobile Broadband is offline.");
113 break;114 break;
@@ -133,15 +134,17 @@
133 }134 }
134 }135 }
135 136
136 public override void on_device_state_changed(ParamSpec p) {137 private void on_cellular_state_changed(ParamSpec p) {
137 this.update_widget_states(this.device.state);138 this.update_widget_states(this.connman.get_cellular_state());
138 }139 }
139 140
140 private void on_toggleswitch_toggled() {141 private void on_toggleswitch_toggled() {
141 if (this.toggleswitch.get_active()) {142 if (this.toggleswitch.get_active()) {
142 this.device.state = DeviceState.CONNECTED;143 this.connman.enable_technology(Connman.TechnologyType.CELLULAR,
144 null);
143 } else {145 } else {
144 this.device.state = DeviceState.OFFLINE;146 this.connman.disable_technology(Connman.TechnologyType.CELLULAR,
147 null);
145 }148 }
146 }149 }
147150
148151
=== modified file 'src/settings/frontend/widgets/device-boxes/wired.vala'
--- src/settings/frontend/widgets/device-boxes/wired.vala 2011-01-10 17:35:19 +0000
+++ src/settings/frontend/widgets/device-boxes/wired.vala 2011-02-24 08:05:23 +0000
@@ -23,13 +23,10 @@
23 /* A Gtk.VBox which holds all of the widgets to control a wired23 /* A Gtk.VBox which holds all of the widgets to control a wired
24 device. */24 device. */
2525
26 private Device device;26 private Connman.Manager connman;
2727
28 public WiredBox(Device device, string datadir) {28 public WiredBox(Connman.Manager connman, string datadir) {
29 this.set_spacing(12);29 this.set_spacing(12);
30 this.device = device;30 this.connman = connman;
31 this.device.notify["state"].connect(this.on_device_state_changed);
32 }31 }
33
34 public override void on_device_state_changed(ParamSpec p) {}
35}32}
3633
=== modified file 'src/settings/frontend/widgets/device-boxes/wireless.vala'
--- src/settings/frontend/widgets/device-boxes/wireless.vala 2011-02-01 13:29:19 +0000
+++ src/settings/frontend/widgets/device-boxes/wireless.vala 2011-02-24 08:05:23 +0000
@@ -27,7 +27,7 @@
27 wireless networks. */27 wireless networks. */
2828
29 private string datadir;29 private string datadir;
30 private Device device;30 private Connman.Manager connman;
31 private InfoBox infobox;31 private InfoBox infobox;
32 private ToggleSwitch toggleswitch;32 private ToggleSwitch toggleswitch;
33 private Gtk.Label label_status;33 private Gtk.Label label_status;
@@ -39,12 +39,12 @@
39 private Gtk.Button button_edit;39 private Gtk.Button button_edit;
40 private Gtk.ScrolledWindow scrolledwindow_connections;40 private Gtk.ScrolledWindow scrolledwindow_connections;
4141
42 public WirelessBox(Device device, Connman.Manager connman,42 public WirelessBox(Connman.Manager connman, string datadir) {
43 string datadir) {
44 this.set_spacing(12);43 this.set_spacing(12);
45 this.datadir = datadir;44 this.datadir = datadir;
46 this.device = device;45 this.connman = connman;
47 this.device.notify["state"].connect(this.on_device_state_changed);46
47 this.connman.notify["wifi-state"].connect(this.wifi_state_changed);
4848
49 // Infobox and Togglswitch49 // Infobox and Togglswitch
50 /// Creation50 /// Creation
@@ -85,7 +85,7 @@
85 this.add_service(service);85 this.add_service(service);
86 }86 }
8787
88 this.update_widget_states(this.device.state);88 this.update_widget_states(this.connman.get_wifi_state());
89 this.on_treeview_connections_selection_changed();89 this.on_treeview_connections_selection_changed();
90 }90 }
9191
@@ -102,32 +102,32 @@
102 this.button_edit.clicked.connect(this.on_button_edit_clicked);102 this.button_edit.clicked.connect(this.on_button_edit_clicked);
103 }103 }
104104
105 private void update_widget_states(DeviceState state) {105 private void update_widget_states(Connman.TechnologyState state) {
106 bool device_editable = false;106 bool device_editable = false;
107 bool settings_editable = false;107 bool settings_editable = false;
108 bool toggleswitch_state = false;108 bool toggleswitch_state = false;
109 string status_text = "";109 string status_text = "";
110 110
111 switch (state) {111 switch (state) {
112 case DeviceState.CONNECTED:112 case Connman.TechnologyState.ENABLED:
113 device_editable = true;113 device_editable = true;
114 settings_editable = true;114 settings_editable = true;
115 toggleswitch_state = true;115 toggleswitch_state = true;
116 status_text = ("Wi-fi is on but not connected to the Internet.");116 status_text = ("Wi-fi is on but not connected to the Internet.");
117 break;117 break;
118 case DeviceState.ONLINE:118 case Connman.TechnologyState.CONNECTED:
119 device_editable = true;119 device_editable = true;
120 settings_editable = true;120 settings_editable = true;
121 toggleswitch_state = true;121 toggleswitch_state = true;
122 status_text = ("Wi-fi is on and connected to the Internet.");122 status_text = ("Wi-fi is on and connected to the Internet.");
123 break;123 break;
124 case DeviceState.OFF:124 case Connman.TechnologyState.AVAILABLE:
125 device_editable = false;125 device_editable = true;
126 settings_editable = false;126 settings_editable = false;
127 toggleswitch_state = false;127 toggleswitch_state = false;
128 status_text = ("The Wi-fi device is powered off.");128 status_text = ("The Wi-fi device is powered off.");
129 break;129 break;
130 case DeviceState.OFFLINE:130 case Connman.TechnologyState.OFFLINE:
131 device_editable = true;131 device_editable = true;
132 settings_editable = false;132 settings_editable = false;
133 toggleswitch_state = false;133 toggleswitch_state = false;
@@ -150,15 +150,15 @@
150 liststore.add_service(service, name, signal, last_used);150 liststore.add_service(service, name, signal, last_used);
151 }151 }
152 152
153 public override void on_device_state_changed(ParamSpec p) {153 private void wifi_state_changed(ParamSpec p) {
154 this.update_widget_states(this.device.state);154 this.update_widget_states(this.connman.get_wifi_state());
155 }155 }
156156
157 private void on_toggleswitch_toggled() {157 private void on_toggleswitch_toggled() {
158 if (this.toggleswitch.get_active()) {158 if (this.toggleswitch.get_active()) {
159 this.device.state = DeviceState.CONNECTED;159 this.connman.enable_technology(Connman.TechnologyType.WIFI, null);
160 } else {160 } else {
161 this.device.state = DeviceState.OFFLINE;161 this.connman.disable_technology(Connman.TechnologyType.WIFI, null);
162 }162 }
163 }163 }
164164

Subscribers

People subscribed via source and target branches