Merge lp:~donadigo/switchboard-plug-networking/use-client-signals into lp:~elementary-pantheon/switchboard-plug-networking/trunk

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Danielle Foré
Approved revision: 116
Merged at revision: 116
Proposed branch: lp:~donadigo/switchboard-plug-networking/use-client-signals
Merge into: lp:~elementary-pantheon/switchboard-plug-networking/trunk
Diff against target: 69 lines (+9/-12)
2 files modified
src/Plug.vala (+6/-8)
src/Widgets/Footer.vala (+3/-4)
To merge this branch: bzr merge lp:~donadigo/switchboard-plug-networking/use-client-signals
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+266461@code.launchpad.net

Commit message

* Use client signals to replace the old signals and help the plug integrate better with the OS by not depending on it's switches / settings.
* Rename switch_wifi_status to update_wifi_status.

Description of the change

Using client signals will replace the old signals and help the plug integrate better with the OS by not depending on it's switches / settings.

* Rename switch_wifi_status to update_wifi_status.

This branch solves not updating wifi item state in page-cleanup branch and should be merged *before* parent branch will be merged.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

There's an odd interaction between the network indicator and plug where if I disable wifi from the indicator, the switch won't be changed in the plug.

But I can also reproduce this with trunk, so I won't consider it a blocker for this branch and file it separately :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Plug.vala'
2--- src/Plug.vala 2015-07-23 21:29:23 +0000
3+++ src/Plug.vala 2015-07-30 19:27:30 +0000
4@@ -119,7 +119,8 @@
5 string string_id = "wifi-page-%i".printf (wifi_page_id);
6 content.add_named (wifi_page, string_id);
7
8- switch_wifi_status (wifi_page);
9+ update_wifi_status ();
10+ client.notify["wireless-enabled"].connect (update_wifi_status);
11
12 device_list.wifi.activate.connect (() => {
13 if (content.get_visible_child_name () != string_id)
14@@ -182,14 +183,11 @@
15 }
16 });
17
18- footer.on_switch_mode.connect ((switched) => {
19- if (!switched) {
20- if (!client.networking_get_enabled ())
21- client.networking_set_enabled (true);
22+ client.notify["networking-enabled"].connect (() => {
23+ if (client.networking_get_enabled ()) {
24 device_list.select_first_item ();
25 content.set_visible_child (page);
26 } else {
27- client.networking_set_enabled (false);
28 content.set_visible_child_name ("airplane-mode-info");
29 current_device = null;
30 device_list.select_row (null);
31@@ -197,8 +195,8 @@
32 });
33 }
34
35- private void switch_wifi_status (Widgets.WiFiPage wifi_page) {
36- if (wifi_page.control_switch.get_active ()) {
37+ private void update_wifi_status () {
38+ if (client.wireless_get_enabled ()) {
39 device_list.wifi.switch_status (null, "wifi-enabled");
40 } else {
41 device_list.wifi.switch_status (null, "wifi-disabled");
42
43=== modified file 'src/Widgets/Footer.vala'
44--- src/Widgets/Footer.vala 2015-07-18 16:56:50 +0000
45+++ src/Widgets/Footer.vala 2015-07-30 19:27:30 +0000
46@@ -22,8 +22,6 @@
47
48 namespace Network {
49 public class Widgets.Footer : Gtk.Box {
50- public signal void on_switch_mode (bool switched);
51-
52 public Footer (NM.Client client) {
53 this.margin_top = 12;
54 this.margin_bottom = 12;
55@@ -38,11 +36,12 @@
56 this.pack_end (airplane_switch, false, false, 0);
57
58 airplane_switch.notify["active"].connect (() => {
59- this.on_switch_mode (airplane_switch.get_active ());
60+ client.networking_set_enabled (!client.networking_get_enabled ());
61 });
62
63- if (!airplane_switch.get_active () && !client.networking_get_enabled ())
64+ if (!airplane_switch.get_active () && !client.networking_get_enabled ()) {
65 airplane_switch.activate ();
66+ }
67 }
68 }
69 }

Subscribers

People subscribed via source and target branches

to all changes: