GNOME Bugzilla – Bug 684824
Tries to activate out of range networks
Last modified: 2012-10-02 13:12:39 UTC
When I click on a network that is out of range, it still tries to connect to it; the shell indicator will turn to "..." and I will get a password prompt and a subsequent "Activation of connection failed" notification after a timeout. I think clicking on an out of range network should bring you directly to its configuration page.
Created attachment 225403 [details] [review] don't try to activate out-of-range connections Here is a patch that just stops the pointles connection attempt.
Review of attachment 225403 [details] [review]: ::: panels/network/net-device-wifi.c @@ -1651,3 @@ - else if (connection_id) - activate_connection (device_wifi, connection_id); - else if (ap_in_range || mode == NM_802_11_MODE_UNKNOWN) What's NM_802_11_MODE_UNKNOWN supposed to be?
> What's NM_802_11_MODE_UNKNOWN supposed to be? its a fancy name for 0. Which is unfortunately the value we stuff in the mode column for all the out-of-range aps...
Wouldn't something as simple as this fix it? diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index 4794bff..2b8cb67 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -47,6 +47,8 @@ #include "net-device-wifi.h" +#define INVALID_AP_MODE -1 + #define NET_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifiPrivate)) static void nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi); @@ -585,7 +587,7 @@ add_saved_connection (NetDeviceWifi *device_wifi, NMConnection *connection, NMDe COLUMN_TITLE, title, COLUMN_SORT, ssid_text, COLUMN_STRENGTH, 0, - COLUMN_MODE, 0, + COLUMN_MODE, INVALID_AP_MODE, COLUMN_SECURITY, 0, COLUMN_ACTIVE, FALSE, COLUMN_AP_IN_RANGE, FALSE, I also don't understand why that got removed: - else if (connection_id) - activate_connection (device_wifi, connection_id);
(In reply to comment #4) > Wouldn't something as simple as this fix it? It would have the same effect, pretty much. But it would leave the conditions in connect_wifi_network as confused as they are now - we only ever want to try connecting if ap_in_range is true. > > I also don't understand why that got removed: > - else if (connection_id) > - activate_connection (device_wifi, connection_id); Because we only want to try connecting if ap_in_range is true.
(In reply to comment #5) > (In reply to comment #4) > > Wouldn't something as simple as this fix it? > > > It would have the same effect, pretty much. But it would leave the conditions > in connect_wifi_network as confused as they are now - we only ever want to try > connecting if ap_in_range is true. Right, that needs fixing. > > I also don't understand why that got removed: > > - else if (connection_id) > > - activate_connection (device_wifi, connection_id); > > Because we only want to try connecting if ap_in_range is true. But we also want to check for a connection_id, no? When would activate_connection() be called?
(In reply to comment #6) > > Because we only want to try connecting if ap_in_range is true. > > But we also want to check for a connection_id, no? When would > activate_connection() be called? Right, so I guess the logic needs to be: if (in range) { if (has connection) activate_connection (...) else wireless_try_to_connect (...) }
(In reply to comment #7) > (In reply to comment #6) > > > > > Because we only want to try connecting if ap_in_range is true. > > > > But we also want to check for a connection_id, no? When would > > activate_connection() be called? > > Right, so I guess the logic needs to be: > > if (in range) > { > if (has connection) > activate_connection (...) > else > wireless_try_to_connect (...) > } Pushed that code to git.