Merge lp:~philip.scott/wingpanel-indicator-network/secure-icons into lp:~wingpanel-devs/wingpanel-indicator-network/trunk

Proposed by Felipe Escoto
Status: Merged
Approved by: Danielle Foré
Approved revision: 205
Merged at revision: 205
Proposed branch: lp:~philip.scott/wingpanel-indicator-network/secure-icons
Merge into: lp:~wingpanel-devs/wingpanel-indicator-network/trunk
Diff against target: 170 lines (+48/-15)
3 files modified
src/Indicator.vala (+2/-1)
src/Widgets/DisplayWidget.vala (+7/-8)
src/common/Widgets/NMVisualizer.vala (+39/-6)
To merge this branch: bzr merge lp:~philip.scott/wingpanel-indicator-network/secure-icons
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+311360@code.launchpad.net

Commit message

Use -secure icons for VPN

To post a comment you must log in.
205. By Felipe Escoto

Use -secure icons for VPN

Revision history for this message
Danielle Foré (danrabbit) wrote :

I can confirm that this branch works as expected :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Indicator.vala'
2--- src/Indicator.vala 2016-11-03 21:58:12 +0000
3+++ src/Indicator.vala 2016-11-21 02:42:26 +0000
4@@ -46,6 +46,7 @@
5 if (popover_widget == null) {
6 popover_widget = new Widgets.PopoverWidget ();
7 popover_widget.notify["state"].connect (on_state_changed);
8+ popover_widget.notify["secure"].connect (on_state_changed);
9 popover_widget.settings_shown.connect (() => { close (); });
10
11 on_state_changed ();
12@@ -59,7 +60,7 @@
13 assert (popover_widget != null);
14 assert (display_widget != null);
15
16- display_widget.update_state (popover_widget.state);
17+ display_widget.update_state (popover_widget.state, popover_widget.secure);
18 }
19
20 private void start_monitor () {
21
22=== modified file 'src/Widgets/DisplayWidget.vala'
23--- src/Widgets/DisplayWidget.vala 2016-11-03 22:24:46 +0000
24+++ src/Widgets/DisplayWidget.vala 2016-11-21 02:42:26 +0000
25@@ -33,8 +33,7 @@
26 pack_start (image);
27 }
28
29- public void update_state (Network.State state) {
30-
31+ public void update_state (Network.State state, bool secure) {
32 if (animation_timeout > 0) {
33 Source.remove (animation_timeout);
34 animation_timeout = 0;
35@@ -45,22 +44,22 @@
36 image.icon_name = "network-wired-acquiring-symbolic";
37 break;
38 case Network.State.CONNECTED_WIRED:
39- image.icon_name = "network-wired-symbolic";
40+ image.icon_name = "network-wired-%ssymbolic".printf (secure? "secure-" : "");
41 break;
42 case Network.State.CONNECTED_WIFI:
43 image.icon_name = "network-wireless-connected-symbolic";
44 break;
45 case Network.State.CONNECTED_WIFI_WEAK:
46- image.icon_name = "network-wireless-signal-weak-symbolic";
47+ image.icon_name = "network-wireless-signal-weak-%ssymbolic".printf (secure? "secure-" : "");
48 break;
49 case Network.State.CONNECTED_WIFI_OK:
50- image.icon_name = "network-wireless-signal-ok-symbolic";
51+ image.icon_name = "network-wireless-signal-ok-%ssymbolic".printf (secure? "secure-" : "");
52 break;
53 case Network.State.CONNECTED_WIFI_GOOD:
54- image.icon_name = "network-wireless-signal-good-symbolic";
55+ image.icon_name = "network-wireless-signal-good-%ssymbolic".printf (secure? "secure-" : "");
56 break;
57 case Network.State.CONNECTED_WIFI_EXCELLENT:
58- image.icon_name = "network-wireless-signal-excellent-symbolic";
59+ image.icon_name = "network-wireless-signal-excellent-%ssymbolic".printf (secure? "secure-" : "");
60 break;
61 case Network.State.CONNECTING_WIFI:
62 animation_timeout = Timeout.add (300, () => {
63@@ -80,7 +79,7 @@
64 strength = "excellent";
65 break;
66 }
67- image.icon_name = "network-wireless-signal-" + strength + "-symbolic";
68+ image.icon_name = "network-wireless-signal-" + strength + (secure? "-secure" : "") + "-symbolic";
69 return true;
70 });
71 break;
72
73=== modified file 'src/common/Widgets/NMVisualizer.vala'
74--- src/common/Widgets/NMVisualizer.vala 2016-11-04 01:58:51 +0000
75+++ src/common/Widgets/NMVisualizer.vala 2016-11-21 02:42:26 +0000
76@@ -18,28 +18,33 @@
77 public abstract class Network.Widgets.NMVisualizer : Gtk.Grid {
78 protected NM.Client nm_client;
79 protected NM.RemoteSettings nm_settings;
80+ protected NM.VPNConnection? active_vpn_connection = null;
81
82 protected GLib.List<WidgetNMInterface>? network_interface;
83
84+ public bool secure { private set; get; default = false; }
85 public Network.State state { private set; get; default = Network.State.CONNECTING_WIRED; }
86
87 construct {
88 network_interface = new GLib.List<WidgetNMInterface>();
89
90 build_ui ();
91-
92+
93 /* Monitor network manager */
94 nm_client = new NM.Client ();
95 nm_settings = new NM.RemoteSettings (null);
96
97+ nm_client.notify["active-connections"].connect (update_vpn_connection);
98+
99 nm_client.device_added.connect (device_added_cb);
100 nm_client.device_removed.connect (device_removed_cb);
101-
102+
103 var devices = nm_client.get_devices ();
104 for (var i = 0; i < devices.length; i++)
105 device_added_cb (devices.get (i));
106-
107+
108 show_all();
109+ update_vpn_connection ();
110 }
111
112 protected abstract void build_ui ();
113@@ -50,13 +55,13 @@
114 foreach (var widget_interface in network_interface) {
115 if (widget_interface.is_device (device)) {
116 network_interface.remove (widget_interface);
117-
118+
119 // Implementation call
120 remove_interface (widget_interface);
121 break;
122 }
123 }
124-
125+
126 update_interfaces_names ();
127 }
128
129@@ -119,7 +124,7 @@
130
131 }
132 #endif
133-
134+
135 update_interfaces_names ();
136 update_all ();
137 show_all ();
138@@ -142,4 +147,32 @@
139 state = next_state;
140 }
141
142+ void update_vpn_connection () {
143+ active_vpn_connection = null;
144+
145+ nm_client.get_active_connections ().foreach ((ac) => {
146+ if (active_vpn_connection == null && ac.get_vpn ()) {
147+ active_vpn_connection = (NM.VPNConnection) ac;
148+ update_vpn_state (active_vpn_connection.get_vpn_state ());
149+ active_vpn_connection.vpn_state_changed.connect (() => {
150+ update_vpn_state (active_vpn_connection.get_vpn_state ());
151+ });
152+ }
153+ });
154+ }
155+
156+ void update_vpn_state (NM.VPNConnectionState state) {
157+ switch (state) {
158+ case NM.VPNConnectionState.DISCONNECTED:
159+ case NM.VPNConnectionState.PREPARE:
160+ case NM.VPNConnectionState.IP_CONFIG_GET:
161+ case NM.VPNConnectionState.CONNECT:
162+ case NM.VPNConnectionState.FAILED:
163+ secure = false;
164+ break;
165+ case NM.VPNConnectionState.ACTIVATED:
166+ secure = true;
167+ break;
168+ }
169+ }
170 }

Subscribers

People subscribed via source and target branches

to all changes: