Merge lp:~donadigo/switchboard-plug-networking/wifi-radiobuttons into lp:~elementary-pantheon/switchboard-plug-networking/trunk
- wifi-radiobuttons
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Adam Bieńkowski |
Proposed branch: | lp:~donadigo/switchboard-plug-networking/wifi-radiobuttons |
Merge into: | lp:~elementary-pantheon/switchboard-plug-networking/trunk |
Diff against target: |
405 lines (+162/-93) 3 files modified
src/Widgets/WiFi/WiFiEntry.vala (+45/-38) src/Widgets/WiFi/WiFiPage.vala (+110/-47) src/libnm-gtk.vapi (+7/-8) |
To merge this branch: | bzr merge lp:~donadigo/switchboard-plug-networking/wifi-radiobuttons |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
xapantu (community) | Needs Fixing | ||
Danielle Foré | Needs Fixing | ||
Review via email: mp+266475@code.launchpad.net |
Commit message
* Add new radiobuttons to WiFi list instead of setting the text on the item.
* get_strenth_image replaced with get_strength_icon
* Strength boundaries are now taken from Indicator Network
* Update strength when it changes
* Add spinner that signals that the connection is in progress
* RSN flags now also for checking if the entry is secured.
Description of the change
* Add new radiobuttons to WiFi list instead of setting the text on the item.
* get_strenth_image replaced with get_strength_icon
* Strength boundaries are now taken from Indicator Network
* Update strength when it changes
* Add spinner that signals that the connection is in progress
* RSN flags now also for checking if the entry is secured.
xapantu (xapantu) wrote : | # |
There is definitively a problem with the spinner, it does not show as often as the spinner in the indicator.
I also have the problem with the password protected networks, a password is asked even if it is already registered.
xapantu (xapantu) wrote : | # |
So, I wrote more inline comments. Some are maybe arguable. You don't need to fix every item marked as "not important", but that would be better if the other were :)
Other than that, it is great to see that this plug is quickly progressing :)
Adam Bieńkowski (donadigo) wrote : | # |
xapantu: Okay, I fixed some problems with this branch, there is only one dumb_btn created in the wifi page as you pointed out. I've also borrowed some of yours code to check if entry is connecting and showing a spinner :) I updated those casts, but I dunno about removing "private" stuff, is there anything about this in elementary code style or we are free with those? I will make separate branch for code style updates soon.
Adam Bieńkowski (donadigo) wrote : | # |
Ah, I forgot, I think the problem with connecting to secured entry is also gone now by these changes.
xapantu (xapantu) wrote : | # |
About the "private" keyword thing, that is just an opinion, I don't really care :)
xapantu (xapantu) wrote : | # |
The spinner is now shown too often: if my computer attempts to connect to a network, and then to another, two spinner are displayed. Connecting to a secured network is not fixed (however I did not check wether it worked before your branch or not).
xapantu (xapantu) wrote : | # |
Okay, I just tested, this bug is not introduced by this branch, don't worry about then.
xapantu (xapantu) wrote : | # |
After some discussions we decided to merge some code between the indicator and the plug, so I just merged this branch to lp:~elementary-apps/switchboard-plug-networking/merge-with-indicator where these radio buttons are going to be merged with the indicator ones.
Adam Bieńkowski (donadigo) wrote : | # |
The branch will no longer be merged to the trunk as of the new branch that has merged this one.
Unmerged revisions
Preview Diff
1 | === modified file 'src/Widgets/WiFi/WiFiEntry.vala' | |||
2 | --- src/Widgets/WiFi/WiFiEntry.vala 2015-07-23 20:01:49 +0000 | |||
3 | +++ src/Widgets/WiFi/WiFiEntry.vala 2015-08-01 18:42:17 +0000 | |||
4 | @@ -22,65 +22,72 @@ | |||
5 | 22 | 22 | ||
6 | 23 | namespace Network.Widgets { | 23 | namespace Network.Widgets { |
7 | 24 | public class WiFiEntry : Gtk.ListBoxRow { | 24 | public class WiFiEntry : Gtk.ListBoxRow { |
10 | 25 | public NM.AccessPoint? ap; | 25 | public NM.AccessPoint ap; |
11 | 26 | public string ssid; | 26 | public Gtk.RadioButton radio_btn; |
12 | 27 | public string ssid_str; | ||
13 | 27 | public bool is_secured = false; | 28 | public bool is_secured = false; |
14 | 28 | public uint strength; | 29 | public uint strength; |
15 | 29 | 30 | ||
16 | 31 | private Gtk.Box hbox; | ||
17 | 32 | private Gtk.Spinner spinner; | ||
18 | 33 | |||
19 | 30 | private string bssid; | 34 | private string bssid; |
20 | 31 | 35 | ||
24 | 32 | private Gtk.Label title; | 36 | public WiFiEntry (NM.AccessPoint point, Gtk.RadioButton? previous_btn = null) { |
22 | 33 | |||
23 | 34 | public WiFiEntry.from_access_point (NM.AccessPoint? point) { | ||
25 | 35 | ap = point; | 37 | ap = point; |
26 | 36 | 38 | ||
28 | 37 | this.ssid = NM.Utils.ssid_to_utf8 (ap.get_ssid ()); | 39 | this.ssid_str = NM.Utils.ssid_to_utf8 (ap.get_ssid ()); |
29 | 38 | this.bssid = ap.get_bssid (); | 40 | this.bssid = ap.get_bssid (); |
30 | 39 | this.strength = ap.get_strength (); | 41 | this.strength = ap.get_strength (); |
31 | 40 | 42 | ||
40 | 41 | title = new Gtk.Label (ssid); | 43 | radio_btn = new Gtk.RadioButton.with_label_from_widget (previous_btn, ssid_str); |
41 | 42 | title.halign = Gtk.Align.START; | 44 | radio_btn.halign = Gtk.Align.START; |
42 | 43 | 45 | ||
43 | 44 | var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); | 46 | hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); |
44 | 45 | hbox.add (title); | 47 | hbox.add (radio_btn); |
45 | 46 | 48 | ||
46 | 47 | hbox.pack_end (get_strength_image (), false, false, 7); | 49 | var strength_image = new Gtk.Image.from_icon_name (get_strength_icon (), Gtk.IconSize.SMALL_TOOLBAR); |
47 | 48 | if (ap.get_wpa_flags () != NM.@80211ApSecurityFlags.NONE) { | 50 | ap.notify["strength"].connect (() => { |
48 | 51 | strength_image.icon_name = get_strength_icon (); | ||
49 | 52 | }); | ||
50 | 53 | |||
51 | 54 | hbox.pack_end (strength_image, false, false, 7); | ||
52 | 55 | if (ap.get_wpa_flags () != NM.@80211ApSecurityFlags.NONE || ap.get_rsn_flags () != NM.@80211ApSecurityFlags.NONE) { | ||
53 | 49 | is_secured = true; | 56 | is_secured = true; |
54 | 50 | 57 | ||
55 | 51 | var lock_img = new Gtk.Image.from_icon_name ("channel-secure-symbolic", Gtk.IconSize.SMALL_TOOLBAR); | 58 | var lock_img = new Gtk.Image.from_icon_name ("channel-secure-symbolic", Gtk.IconSize.SMALL_TOOLBAR); |
56 | 52 | hbox.pack_end (lock_img, false, false, 0); | 59 | hbox.pack_end (lock_img, false, false, 0); |
57 | 53 | } | 60 | } |
58 | 54 | 61 | ||
59 | 62 | spinner = new Gtk.Spinner (); | ||
60 | 63 | spinner.no_show_all = true; | ||
61 | 64 | spinner.start (); | ||
62 | 65 | hbox.pack_end (spinner, false, false, 0); | ||
63 | 66 | |||
64 | 67 | set_connection_in_progress (false); | ||
65 | 68 | |||
66 | 55 | this.add (hbox); | 69 | this.add (hbox); |
67 | 56 | this.show_all (); | 70 | this.show_all (); |
68 | 57 | } | 71 | } |
69 | 58 | 72 | ||
76 | 59 | public void set_status_point (bool connected, bool in_process) { | 73 | public void set_active (bool connected) { |
77 | 60 | if (connected || in_process) { | 74 | radio_btn.active = connected; |
78 | 61 | string status = Utils.state_to_string (NM.DeviceState.ACTIVATED); | 75 | } |
79 | 62 | if (in_process) | 76 | |
80 | 63 | status = Utils.state_to_string (NM.DeviceState.CONFIG); | 77 | public void set_connection_in_progress (bool progress) { |
81 | 64 | title.label = title.get_label () + SUFFIX + "(" + status + ")"; | 78 | spinner.visible = progress; |
82 | 79 | } | ||
83 | 80 | |||
84 | 81 | private string get_strength_icon () { | ||
85 | 82 | if (strength < 30) { | ||
86 | 83 | return "network-wireless-signal-weak-symbolic"; | ||
87 | 84 | } else if (strength < 55) { | ||
88 | 85 | return "network-wireless-signal-ok-symbolic"; | ||
89 | 86 | } else if (strength < 80) { | ||
90 | 87 | return "network-wireless-signal-good-symbolic"; | ||
91 | 65 | } else { | 88 | } else { |
110 | 66 | title.label = ssid; | 89 | return "network-wireless-signal-excellent-symbolic"; |
111 | 67 | } | 90 | } |
94 | 68 | } | ||
95 | 69 | |||
96 | 70 | private Gtk.Image get_strength_image () { | ||
97 | 71 | var image = new Gtk.Image.from_icon_name ("network-wireless-offline-symbolic", Gtk.IconSize.SMALL_TOOLBAR); | ||
98 | 72 | |||
99 | 73 | if (strength == 0 || strength <= 25) { | ||
100 | 74 | image.icon_name = "network-wireless-signal-weak-symbolic"; | ||
101 | 75 | } else if (strength > 25 && strength <= 50) { | ||
102 | 76 | image.icon_name = "network-wireless-signal-ok-symbolic"; | ||
103 | 77 | } else if (strength > 50 && strength <= 75) { | ||
104 | 78 | image.icon_name = "network-wireless-signal-good-symbolic"; | ||
105 | 79 | } else if (strength > 75) { | ||
106 | 80 | image.icon_name = "network-wireless-signal-excellent-symbolic"; | ||
107 | 81 | } | ||
108 | 82 | |||
109 | 83 | return image; | ||
112 | 84 | } | 91 | } |
113 | 85 | } | 92 | } |
114 | 86 | } | 93 | } |
115 | 87 | 94 | ||
116 | === modified file 'src/Widgets/WiFi/WiFiPage.vala' | |||
117 | --- src/Widgets/WiFi/WiFiPage.vala 2015-07-24 17:42:48 +0000 | |||
118 | +++ src/Widgets/WiFi/WiFiPage.vala 2015-08-01 18:42:17 +0000 | |||
119 | @@ -25,6 +25,8 @@ | |||
120 | 25 | public new NM.DeviceWifi device; | 25 | public new NM.DeviceWifi device; |
121 | 26 | private Gtk.ListBox wifi_list; | 26 | private Gtk.ListBox wifi_list; |
122 | 27 | private List<WiFiEntry> entries; | 27 | private List<WiFiEntry> entries; |
123 | 28 | private Gtk.RadioButton dumb_btn; | ||
124 | 29 | private Gtk.RadioButton previous_btn; | ||
125 | 28 | private const string[] BLACKLISTED = { "Free Public WiFi" }; | 30 | private const string[] BLACKLISTED = { "Free Public WiFi" }; |
126 | 29 | 31 | ||
127 | 30 | private WiFiEntry? current_connecting_entry = null; | 32 | private WiFiEntry? current_connecting_entry = null; |
128 | @@ -40,6 +42,8 @@ | |||
129 | 40 | this.init (wifidevice, info_box); | 42 | this.init (wifidevice, info_box); |
130 | 41 | 43 | ||
131 | 42 | entries = new List<WiFiEntry> (); | 44 | entries = new List<WiFiEntry> (); |
132 | 45 | dumb_btn = new Gtk.RadioButton (null); | ||
133 | 46 | previous_btn = dumb_btn; | ||
134 | 43 | 47 | ||
135 | 44 | wifi_list = new Gtk.ListBox (); | 48 | wifi_list = new Gtk.ListBox (); |
136 | 45 | wifi_list.selection_mode = Gtk.SelectionMode.SINGLE; | 49 | wifi_list.selection_mode = Gtk.SelectionMode.SINGLE; |
137 | @@ -56,7 +60,9 @@ | |||
138 | 56 | disconnect_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED); | 60 | disconnect_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED); |
139 | 57 | disconnect_btn.get_style_context ().add_class ("destructive-action"); | 61 | disconnect_btn.get_style_context ().add_class ("destructive-action"); |
140 | 58 | disconnect_btn.clicked.connect (() => { | 62 | disconnect_btn.clicked.connect (() => { |
142 | 59 | device.disconnect (null); | 63 | device.disconnect (((_device, _error) => { |
143 | 64 | update_points (); | ||
144 | 65 | })); | ||
145 | 60 | }); | 66 | }); |
146 | 61 | 67 | ||
147 | 62 | var advanced_btn = Utils.get_advanced_button_from_device (device); | 68 | var advanced_btn = Utils.get_advanced_button_from_device (device); |
148 | @@ -65,6 +71,7 @@ | |||
149 | 65 | bool sensitive = (device.get_state () == NM.DeviceState.ACTIVATED); | 71 | bool sensitive = (device.get_state () == NM.DeviceState.ACTIVATED); |
150 | 66 | disconnect_btn.sensitive = sensitive; | 72 | disconnect_btn.sensitive = sensitive; |
151 | 67 | advanced_btn.sensitive = sensitive; | 73 | advanced_btn.sensitive = sensitive; |
152 | 74 | update_points (); | ||
153 | 68 | }); | 75 | }); |
154 | 69 | 76 | ||
155 | 70 | var hidden_btn = new Gtk.Button.with_label (_("Connect to Hidden Network…")); | 77 | var hidden_btn = new Gtk.Button.with_label (_("Connect to Hidden Network…")); |
156 | @@ -84,10 +91,12 @@ | |||
157 | 84 | button_box.pack_start (hidden_btn, false, false, 0); | 91 | button_box.pack_start (hidden_btn, false, false, 0); |
158 | 85 | button_box.pack_end (end_btn_box, false, false, 0); | 92 | button_box.pack_end (end_btn_box, false, false, 0); |
159 | 86 | 93 | ||
160 | 94 | device.notify["active-access-point"].connect (update_points); | ||
161 | 87 | device.access_point_added.connect (add_access_point); | 95 | device.access_point_added.connect (add_access_point); |
162 | 88 | device.access_point_removed.connect (remove_access_point); | 96 | device.access_point_removed.connect (remove_access_point); |
163 | 89 | 97 | ||
164 | 90 | update (info_box); | 98 | update (info_box); |
165 | 99 | update_points (); | ||
166 | 91 | 100 | ||
167 | 92 | this.add_switch_title (_("Wireless:")); | 101 | this.add_switch_title (_("Wireless:")); |
168 | 93 | this.add (scrolled); | 102 | this.add (scrolled); |
169 | @@ -99,11 +108,11 @@ | |||
170 | 99 | private void on_row_activated (Gtk.ListBoxRow row) { | 108 | private void on_row_activated (Gtk.ListBoxRow row) { |
171 | 100 | if (device != null) { | 109 | if (device != null) { |
172 | 101 | /* Do not activate connection if it is already activated */ | 110 | /* Do not activate connection if it is already activated */ |
174 | 102 | if (device.get_active_access_point () != (row as WiFiEntry).ap) { | 111 | if (device.get_active_access_point () != ((WiFiEntry) row).ap) { |
175 | 103 | var setting_wireless = new NM.SettingWireless (); | 112 | var setting_wireless = new NM.SettingWireless (); |
179 | 104 | if (setting_wireless.add_seen_bssid ((row as WiFiEntry).ap.get_bssid ())) { | 113 | if (setting_wireless.add_seen_bssid (((WiFiEntry) row).ap.get_bssid ())) { |
180 | 105 | current_connecting_entry = row as WiFiEntry; | 114 | current_connecting_entry = ((WiFiEntry) row); |
181 | 106 | if ((row as WiFiEntry).is_secured) { | 115 | if (((WiFiEntry) row).is_secured) { |
182 | 107 | var remote_settings = new NM.RemoteSettings (null); | 116 | var remote_settings = new NM.RemoteSettings (null); |
183 | 108 | 117 | ||
184 | 109 | var connection = new NM.Connection (); | 118 | var connection = new NM.Connection (); |
185 | @@ -112,62 +121,79 @@ | |||
186 | 112 | connection.add_setting (s_con); | 121 | connection.add_setting (s_con); |
187 | 113 | 122 | ||
188 | 114 | var s_wifi = new NM.SettingWireless (); | 123 | var s_wifi = new NM.SettingWireless (); |
190 | 115 | s_wifi.@set (NM.SettingWireless.SSID, (row as WiFiEntry).ap.get_ssid ()); | 124 | s_wifi.@set (NM.SettingWireless.SSID, ((WiFiEntry) row).ap.get_ssid ()); |
191 | 116 | connection.add_setting (s_wifi); | 125 | connection.add_setting (s_wifi); |
192 | 117 | 126 | ||
193 | 118 | var s_wsec = new NM.SettingWirelessSecurity (); | 127 | var s_wsec = new NM.SettingWirelessSecurity (); |
195 | 119 | s_wsec.@set (NM.SettingWirelessSecurity.KEY_MGMT, "wpa-eap"); | 128 | s_wsec.@set (NM.SettingWirelessSecurity.KEY_MGMT, "wpa-psk"); |
196 | 120 | connection.add_setting (s_wsec); | 129 | connection.add_setting (s_wsec); |
197 | 121 | 130 | ||
210 | 122 | var s_8021x = new NM.Setting8021x (); | 131 | var dialog = new NMAWifiDialog (client, |
211 | 123 | s_8021x.add_eap_method ("ttls"); | 132 | remote_settings, |
212 | 124 | s_8021x.@set (NM.Setting8021x.PHASE2_AUTH, "mschapv2"); | 133 | connection, |
213 | 125 | connection.add_setting (s_8021x); | 134 | device, |
214 | 126 | 135 | ((WiFiEntry) row).ap, | |
215 | 127 | var dialog = NMGtk.new_wifi_dialog (client, | 136 | false); |
216 | 128 | remote_settings, | 137 | |
217 | 129 | connection, | 138 | dialog.response.connect ((response) => { |
218 | 130 | device, | 139 | if (response != Gtk.ResponseType.OK) { |
219 | 131 | (row as WiFiEntry).ap, | 140 | return; |
220 | 132 | false); | 141 | } |
221 | 133 | dialog.run (); | 142 | |
222 | 143 | NM.Device dialog_device; | ||
223 | 144 | NM.AccessPoint dialog_ap; | ||
224 | 145 | var dialog_connection = dialog.get_connection (out dialog_device, out dialog_ap); | ||
225 | 146 | |||
226 | 147 | if (get_connection_available (dialog_connection, dialog_device)) { | ||
227 | 148 | client.activate_connection (dialog_connection, | ||
228 | 149 | dialog_device, | ||
229 | 150 | dialog_ap.get_path (), | ||
230 | 151 | null); | ||
231 | 152 | } else { | ||
232 | 153 | client.add_and_activate_connection (dialog_connection, | ||
233 | 154 | dialog_device, | ||
234 | 155 | dialog_ap.get_path (), | ||
235 | 156 | finish_connection_callback); | ||
236 | 157 | } | ||
237 | 158 | }); | ||
238 | 159 | |||
239 | 160 | dialog.run (); | ||
240 | 161 | dialog.destroy (); | ||
241 | 134 | } else { | 162 | } else { |
242 | 135 | (row as WiFiEntry).set_status_point (false, true); | ||
243 | 136 | client.add_and_activate_connection (new NM.Connection (), | 163 | client.add_and_activate_connection (new NM.Connection (), |
244 | 137 | device, | 164 | device, |
246 | 138 | (row as WiFiEntry).ap.get_path (), | 165 | ((WiFiEntry) row).ap.get_path (), |
247 | 139 | finish_connection_callback); | 166 | finish_connection_callback); |
249 | 140 | } | 167 | } |
250 | 141 | } | 168 | } |
251 | 142 | } | 169 | } |
252 | 143 | 170 | ||
261 | 144 | /* Check if we are successfully connected to the requested point */ | 171 | update_points (); |
254 | 145 | if (device.get_active_access_point () == (row as WiFiEntry).ap) { | ||
255 | 146 | entries.@foreach ((entry) => { | ||
256 | 147 | entry.set_status_point (false, false); | ||
257 | 148 | }); | ||
258 | 149 | |||
259 | 150 | (row as WiFiEntry).set_status_point (true, false); | ||
260 | 151 | } | ||
262 | 152 | } | 172 | } |
263 | 153 | } | 173 | } |
264 | 154 | 174 | ||
265 | 175 | private bool get_connection_available (NM.Connection connection, NM.Device _device) { | ||
266 | 176 | bool retval = false; | ||
267 | 177 | _device.get_available_connections ().@foreach ((_connection) => { | ||
268 | 178 | if (_connection == connection) { | ||
269 | 179 | retval = true; | ||
270 | 180 | } | ||
271 | 181 | }); | ||
272 | 182 | |||
273 | 183 | return retval; | ||
274 | 184 | } | ||
275 | 185 | |||
276 | 155 | private void finish_connection_callback (NM.Client _client, | 186 | private void finish_connection_callback (NM.Client _client, |
277 | 156 | NM.ActiveConnection connection, | 187 | NM.ActiveConnection connection, |
278 | 157 | string new_connection_path, | 188 | string new_connection_path, |
279 | 158 | Error error) { | 189 | Error error) { |
280 | 159 | bool success = false; | 190 | bool success = false; |
281 | 160 | _client.get_active_connections ().@foreach ((c) => { | 191 | _client.get_active_connections ().@foreach ((c) => { |
283 | 161 | if (c == connection) | 192 | if (c == connection) |
284 | 162 | success = true; | 193 | success = true; |
285 | 163 | }); | 194 | }); |
286 | 164 | 195 | ||
293 | 165 | if (success) { | 196 | current_connecting_entry.set_active (success); |
288 | 166 | current_connecting_entry.set_status_point (true, false); | ||
289 | 167 | } else { | ||
290 | 168 | current_connecting_entry.set_status_point (false, false); | ||
291 | 169 | } | ||
292 | 170 | |||
294 | 171 | current_connecting_entry = null; | 197 | current_connecting_entry = null; |
295 | 172 | } | 198 | } |
296 | 173 | 199 | ||
297 | @@ -185,20 +211,25 @@ | |||
298 | 185 | } | 211 | } |
299 | 186 | 212 | ||
300 | 187 | private void add_access_point (Object ap) { | 213 | private void add_access_point (Object ap) { |
303 | 188 | var row = new WiFiEntry.from_access_point (ap as NM.AccessPoint); | 214 | var row = new WiFiEntry (((NM.AccessPoint) ap), previous_btn); |
304 | 189 | if (!(row.ssid in BLACKLISTED) && row.ap.get_ssid () != null) { | 215 | previous_btn = row.radio_btn; |
305 | 216 | |||
306 | 217 | if (!(row.ssid_str in BLACKLISTED) && row.ap.get_ssid () != null) { | ||
307 | 190 | if (insert_on_top) { | 218 | if (insert_on_top) { |
308 | 191 | wifi_list.insert (row, 0); | 219 | wifi_list.insert (row, 0); |
309 | 192 | } else { | 220 | } else { |
310 | 193 | wifi_list.add (row); | 221 | wifi_list.add (row); |
311 | 194 | } | 222 | } |
312 | 195 | 223 | ||
319 | 196 | entries.append (row as WiFiEntry); | 224 | row.radio_btn.button_release_event.connect (() => { |
320 | 197 | } | 225 | this.on_row_activated (row); |
321 | 198 | 226 | return false; | |
322 | 199 | if ((ap as NM.AccessPoint) == device.get_active_access_point ()) { | 227 | }); |
323 | 200 | row.set_status_point (true, false); | 228 | |
324 | 201 | } | 229 | entries.append (row); |
325 | 230 | } | ||
326 | 231 | |||
327 | 232 | update_points (); | ||
328 | 202 | } | 233 | } |
329 | 203 | 234 | ||
330 | 204 | private void remove_access_point (Object ap_removed) { | 235 | private void remove_access_point (Object ap_removed) { |
331 | @@ -207,7 +238,9 @@ | |||
332 | 207 | entries.remove (entry); | 238 | entries.remove (entry); |
333 | 208 | entry.destroy (); | 239 | entry.destroy (); |
334 | 209 | } | 240 | } |
336 | 210 | }); | 241 | }); |
337 | 242 | |||
338 | 243 | update_points (); | ||
339 | 211 | } | 244 | } |
340 | 212 | 245 | ||
341 | 213 | private int sort_func (Gtk.ListBoxRow r1, Gtk.ListBoxRow r2) { | 246 | private int sort_func (Gtk.ListBoxRow r1, Gtk.ListBoxRow r2) { |
342 | @@ -222,6 +255,36 @@ | |||
343 | 222 | } else { | 255 | } else { |
344 | 223 | return 0; | 256 | return 0; |
345 | 224 | } | 257 | } |
347 | 225 | } | 258 | } |
348 | 259 | |||
349 | 260 | private void update_points () { | ||
350 | 261 | var active_point = device.get_active_access_point (); | ||
351 | 262 | if (active_point == null) { | ||
352 | 263 | dumb_btn.active = true; | ||
353 | 264 | return; | ||
354 | 265 | } | ||
355 | 266 | |||
356 | 267 | bool in_progress = false; | ||
357 | 268 | switch (device.get_state ()) { | ||
358 | 269 | case NM.DeviceState.PREPARE: | ||
359 | 270 | case NM.DeviceState.CONFIG: | ||
360 | 271 | case NM.DeviceState.NEED_AUTH: | ||
361 | 272 | case NM.DeviceState.IP_CONFIG: | ||
362 | 273 | case NM.DeviceState.IP_CHECK: | ||
363 | 274 | case NM.DeviceState.SECONDARIES: | ||
364 | 275 | in_progress = true; | ||
365 | 276 | break; | ||
366 | 277 | default: | ||
367 | 278 | break; | ||
368 | 279 | } | ||
369 | 280 | |||
370 | 281 | entries.@foreach ((entry) => { | ||
371 | 282 | entry.set_connection_in_progress (false); | ||
372 | 283 | if (entry.ap == active_point) { | ||
373 | 284 | entry.set_connection_in_progress (in_progress); | ||
374 | 285 | entry.set_active (true); | ||
375 | 286 | } | ||
376 | 287 | }); | ||
377 | 288 | } | ||
378 | 226 | } | 289 | } |
379 | 227 | } | 290 | } |
380 | 228 | \ No newline at end of file | 291 | \ No newline at end of file |
381 | 229 | 292 | ||
382 | === modified file 'src/libnm-gtk.vapi' | |||
383 | --- src/libnm-gtk.vapi 2015-05-23 18:30:03 +0000 | |||
384 | +++ src/libnm-gtk.vapi 2015-08-01 18:42:17 +0000 | |||
385 | @@ -1,13 +1,12 @@ | |||
386 | 1 | [CCode (cheader_filename = "nm-wifi-dialog.h")] | ||
387 | 2 | class NMAWifiDialog : Gtk.Dialog { | ||
388 | 3 | public NMAWifiDialog (NM.Client client, NM.RemoteSettings settings, NM.Connection connection, NM.Device device, NM.AccessPoint ap, bool secrets_only); | ||
389 | 4 | public NM.Connection get_connection (out NM.Device device, out NM.AccessPoint ap); | ||
390 | 5 | } | ||
391 | 6 | |||
392 | 7 | |||
393 | 1 | [CCode (cprefix = "NMGtk", gir_namespace = "NMGtk", gir_version = "1.0", lower_case_cprefix = "nmgtk_")] | 8 | [CCode (cprefix = "NMGtk", gir_namespace = "NMGtk", gir_version = "1.0", lower_case_cprefix = "nmgtk_")] |
394 | 2 | namespace NMGtk { | 9 | namespace NMGtk { |
395 | 3 | [CCode (cheader_filename = "libnm-gtk/nm-wifi-dialog.h", cname = "nma_wifi_dialog_new")] | ||
396 | 4 | public Gtk.Dialog new_wifi_dialog (NM.Client client, | ||
397 | 5 | NM.RemoteSettings settings, | ||
398 | 6 | NM.Connection connection, | ||
399 | 7 | NM.Device device, | ||
400 | 8 | NM.AccessPoint ap, | ||
401 | 9 | bool secrets_only); | ||
402 | 10 | |||
403 | 11 | [CCode (cheader_filename = "libnm-gtk/nm-wifi-dialog.h", cname = "nma_wifi_dialog_new_for_other")] | 10 | [CCode (cheader_filename = "libnm-gtk/nm-wifi-dialog.h", cname = "nma_wifi_dialog_new_for_other")] |
404 | 12 | public Gtk.Dialog new_wifi_dialog_for_hidden (NM.Client client, NM.RemoteSettings settings); | 11 | public Gtk.Dialog new_wifi_dialog_for_hidden (NM.Client client, NM.RemoteSettings settings); |
405 | 13 | } | 12 | } |
Hm, it seems I'm now unable to connect to networks that require a password.
Also the spinner only shows while the password dialog is open, but then disappears and the connection never happens. Doesn't even seem like it tries to connect.