~network-manager/network-manager-applet/ubuntu.quantal

« back to all changes in this revision

Viewing changes to debian/patches/lp1048586.patch

  • Committer: Antti Kaijanmäki
  • Date: 2012-09-27 20:02:58 UTC
  • mto: This revision was merged to the branch mainline in revision 370.
  • Revision ID: antti.kaijanmaki@canonical.com-20120927200258-lshpwl3o4n4lhboi
* Make Wi-Fi networks the user can't connect to insensitive. (LP:#1048586)
* Split out the detection of Greeter Mode to it's own patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: b/src/applet-device-wifi.c
 
2
===================================================================
 
3
--- a/src/applet-device-wifi.c
 
4
+++ b/src/applet-device-wifi.c
 
5
@@ -758,6 +758,8 @@ create_new_ap_item (NMDeviceWifi *device
 
6
        GSList *ap_connections = NULL;
 
7
        const GByteArray *ssid;
 
8
        guint32 dev_caps;
 
9
+       gboolean config_allowed;
 
10
+       NMClientPermissionResult perm;
 
11
 
 
12
        dev_connections = nm_device_filter_connections (NM_DEVICE (device), connections);
 
13
        ap_connections = nm_access_point_filter_connections (ap, dev_connections);
 
14
@@ -810,6 +812,31 @@ create_new_ap_item (NMDeviceWifi *device
 
15
        ap_menu_item_set_sensitive (item, ap, dev_caps);
 
16
 #endif /* ENABLE_INDICATOR */
 
17
 
 
18
+       config_allowed = FALSE;
 
19
+       perm = nm_client_get_permission_result (applet->nm_client,
 
20
+                                                                                       NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN);
 
21
+       if (   perm == NM_CLIENT_PERMISSION_RESULT_YES
 
22
+               || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) {
 
23
+               /* The user can modify (and add!) a new configuration for herself. */
 
24
+               config_allowed = TRUE;
 
25
+       } else {
 
26
+               perm = nm_client_get_permission_result (applet->nm_client,
 
27
+                                                                                               NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
 
28
+               if (   perm == NM_CLIENT_PERMISSION_RESULT_YES
 
29
+                       || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) {
 
30
+                       /* The user can modify (and add!) a new system wide configuration. */
 
31
+                       config_allowed = TRUE;
 
32
+               }
 
33
+       }
 
34
+       if (    applet->greeter_mode
 
35
+               &&  g_slist_length (ap_connections) == 0
 
36
+               && !config_allowed) {
 
37
+               /* Make the access points which user can't connect
 
38
+                * inside the greeter insensitive
 
39
+                */
 
40
+               gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
 
41
+       }
 
42
+
 
43
        g_object_set_data (G_OBJECT (item), "device", NM_DEVICE (device));
 
44
 
 
45
        /* If there's only one connection, don't show the submenu */