diff -Nru network-manager-applet-0.9.4.1/debian/changelog network-manager-applet-0.9.4.1/debian/changelog --- network-manager-applet-0.9.4.1/debian/changelog 2013-04-15 13:15:42.000000000 -0700 +++ network-manager-applet-0.9.4.1/debian/changelog 2015-01-19 01:01:31.000000000 -0800 @@ -1,3 +1,21 @@ +network-manager-applet (0.9.4.1-0ubuntu2.4) precise-updates; urgency=medium + + * Backport support to show the applet in the greeter: (LP: #1240088) + * debian/patches/hide_policy_items_env_var.patch: + * debian/patches/make_menu_items_insensitive_based_on_permissions.patch: + - Provide a method to desensitize or hide menu items which are useless given + the current policykit policy level of the user. + * debian/patches/lp1048516_dont_req_keyring_in_greeter.patch: + - Don't try to load the keyring if the user has no permissions to edit their + own connections. + * debian/patches/lp1048520_delay_pin_dialog_in_greeter.patch: + - Only ask for PIN entry when a connection is being established rather than + when a modem is detected. + * debian/patches/position_dialogs_to_center_of_the_screen.patch: + - Position dialogs to the center of the screen. + + -- Seyeong Kim Wed, 14 Jan 2015 13:50:49 -0800 + network-manager-applet (0.9.4.1-0ubuntu2.3) precise-proposed; urgency=low [ Matvey Marinin ] diff -Nru network-manager-applet-0.9.4.1/debian/patches/hide_policy_items_env_var.patch network-manager-applet-0.9.4.1/debian/patches/hide_policy_items_env_var.patch --- network-manager-applet-0.9.4.1/debian/patches/hide_policy_items_env_var.patch 1969-12-31 16:00:00.000000000 -0800 +++ network-manager-applet-0.9.4.1/debian/patches/hide_policy_items_env_var.patch 2015-01-19 01:01:31.000000000 -0800 @@ -0,0 +1,261 @@ +From: Antti Kaijanmäki +Subject: Implement support for hiding rather than desensitizing disallowed items + +This is done using a new environment variable that can be set when nm-applet is +started: NM_APPLET_HIDE_POLICY_ITEMS. + +--- + src/applet-device-cdma.c | 7 +++- + src/applet-device-gsm.c | 8 +++-- + src/applet-device-wifi.c | 20 ++++++++++-- + src/applet.c | 74 +++++++++++++++++++++++++++++++++++++++++------ + src/applet.h | 1 + 5 files changed, 95 insertions(+), 15 deletions(-) + +Index: network-manager-applet-0.9.4.1/src/applet.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet.c ++++ network-manager-applet-0.9.4.1/src/applet.c +@@ -1565,8 +1565,16 @@ nma_menu_device_get_menu_item (NMDevice + (GClosureNotify) applet_device_info_destroy, 0); + if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL)) + gtk_widget_set_sensitive (item, TRUE); +- else ++ else { + gtk_widget_set_sensitive (item, FALSE); ++ if (applet->hide_policy_items) { ++ /* TODO: is this the final solution? */ ++ g_object_ref_sink (item); ++ g_object_unref (item); ++ item = NULL; /* it's safe for this function to return NULL as all the ++ callers are handling it properly */ ++ } ++ } + break; + } + default: +@@ -1704,6 +1712,8 @@ nma_menu_add_vpn_submenu (GtkWidget *men + GtkMenuItem *item; + GSList *list, *iter; + int num_vpn_active = 0; ++ gboolean configure_allowed; ++ gboolean disconnect_allowed; + + vpn_menu = GTK_MENU (gtk_menu_new ()); + +@@ -1771,30 +1781,58 @@ nma_menu_add_vpn_submenu (GtkWidget *men + gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); + } + ++ if ( is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM) ++ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN)) ++ configure_allowed = TRUE; ++ else ++ configure_allowed = FALSE; ++ ++ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL)) ++ disconnect_allowed = TRUE; ++ else ++ disconnect_allowed = FALSE; ++ ++ + /* Draw a seperator, but only if we have VPN connections above it */ + if (list) +- nma_menu_add_separator_item (GTK_WIDGET (vpn_menu)); ++ if ( !applet->hide_policy_items ++ || configure_allowed ++ || disconnect_allowed) ++ nma_menu_add_separator_item (GTK_WIDGET (vpn_menu)); /* separator is added if there ++ will be items under it */ + + item = GTK_MENU_ITEM (gtk_menu_item_new_with_mnemonic (_("_Configure VPN..."))); + g_signal_connect (item, "activate", G_CALLBACK (nma_menu_configure_vpn_item_activate), applet); +- gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); +- if ( is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM) +- || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN)) { ++ if (configure_allowed) { + gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); ++ gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); ++ if (!applet->hide_policy_items) { ++ gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); ++ } else { ++ /* TODO: is this the final solution? */ ++ g_object_ref_sink (item); ++ g_object_unref (item); ++ } + } + + item = GTK_MENU_ITEM (gtk_menu_item_new_with_mnemonic (_("_Disconnect VPN"))); + g_signal_connect (item, "activate", G_CALLBACK (nma_menu_disconnect_vpn_item_activate), applet); +- gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); +- if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL)) { ++ if (disconnect_allowed) { + gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); + if (num_vpn_active == 0) + gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); +- ++ gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); ++ if (!applet->hide_policy_items) ++ gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); ++ else { ++ /* TODO: is this the final solution? */ ++ g_object_ref_sink (item); ++ g_object_unref (item); ++ } + } + + g_slist_free (list); +@@ -1884,6 +1922,8 @@ nma_set_notifications_enabled_cb (GtkWid + static void nma_menu_show_cb (GtkWidget *menu, NMApplet *applet) + { + guint32 n_wireless; ++ guint n_children; ++ GList *children = NULL; + + g_return_if_fail (menu != NULL); + g_return_if_fail (applet != NULL); +@@ -1903,10 +1943,21 @@ static void nma_menu_show_cb (GtkWidget + n_wireless = nma_menu_add_devices (menu, applet); + + if (n_wireless > 0 && nm_client_wireless_get_enabled (applet->nm_client)) { ++ children = gtk_container_get_children (GTK_CONTAINER (menu)); ++ n_children = g_list_length (children); ++ g_list_free (children); ++ + /* Add the "Hidden wireless network..." entry */ + nma_menu_add_hidden_network_item (menu, applet); + nma_menu_add_create_network_item (menu, applet); +- nma_menu_add_separator_item (menu); ++ ++ children = gtk_container_get_children (GTK_CONTAINER (menu)); ++ if (g_list_length (children) > n_children) { ++ /* items were added. Add a separator */ ++ /* TODO: see TODO comments in the above add_*_network_item functions */ ++ nma_menu_add_separator_item (menu); ++ } ++ g_list_free (children); + } + + nma_menu_add_vpn_submenu (menu, applet); +@@ -2083,6 +2134,7 @@ nma_context_menu_update (NMApplet *apple + * so set the "Edit Connections..." menu item insensitive. + */ + gtk_widget_set_sensitive (applet->connections_menu_item, FALSE); ++ gtk_widget_set_visible (applet->connections_menu_item, !applet->hide_policy_items); + } + } + +@@ -4055,6 +4107,10 @@ static void nma_init (NMApplet *applet) + applet->icon_theme = NULL; + applet->notification = NULL; + applet->icon_size = 16; ++ ++ applet->hide_policy_items = FALSE; ++ if (getenv ("NM_APPLET_HIDE_POLICY_ITEMS")) ++ applet->hide_policy_items = TRUE; + } + + enum { +Index: network-manager-applet-0.9.4.1/src/applet-device-wifi.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-wifi.c ++++ network-manager-applet-0.9.4.1/src/applet-device-wifi.c +@@ -101,7 +101,6 @@ nma_menu_add_hidden_network_item (GtkWid + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_container_add (GTK_CONTAINER (menu_item), label); + gtk_widget_show_all (menu_item); +- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + g_signal_connect_swapped (menu_item, "activate", + G_CALLBACK (applet_wifi_connect_to_hidden_network), + applet); +@@ -132,6 +131,13 @@ nma_menu_add_hidden_network_item (GtkWid + } + + gtk_widget_set_sensitive (GTK_WIDGET (menu_item), allowed); ++ if (!allowed && applet->hide_policy_items) { ++ /* don't add the item if it should be hidden */ ++ /* TODO: is this the final solution? */ ++ g_object_ref_sink (menu_item); ++ g_object_unref (menu_item); ++ } else ++ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + } + + gboolean +@@ -181,13 +187,21 @@ nma_menu_add_create_network_item (GtkWid + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_container_add (GTK_CONTAINER (menu_item), label); + gtk_widget_show_all (menu_item); +- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + g_signal_connect_swapped (menu_item, "activate", + G_CALLBACK (applet_wifi_create_wifi_network), + applet); + +- if (!applet_wifi_can_create_wifi_network (applet)) ++ if (!applet_wifi_can_create_wifi_network (applet)) { + gtk_widget_set_sensitive (GTK_WIDGET (menu_item), FALSE); ++ if (applet->hide_policy_items) { ++ /* don't add the item if it should be hidden */ ++ /* TODO: is this the final solution? */ ++ g_object_ref_sink (menu_item); ++ g_object_unref (menu_item); ++ return; ++ } ++ } ++ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + } + + static void +Index: network-manager-applet-0.9.4.1/src/applet.h +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet.h ++++ network-manager-applet-0.9.4.1/src/applet.h +@@ -102,6 +102,7 @@ typedef struct + GConfClient * gconf_client; + + gboolean visible; ++ gboolean hide_policy_items; + + /* Permissions */ + NMClientPermissionResult permissions[NM_CLIENT_PERMISSION_LAST + 1]; +Index: network-manager-applet-0.9.4.1/src/applet-device-cdma.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-cdma.c ++++ network-manager-applet-0.9.4.1/src/applet-device-cdma.c +@@ -473,7 +473,12 @@ cdma_add_menu_item (NMDevice *device, + item = gtk_check_menu_item_new_with_label (_("New Mobile Broadband (CDMA) connection...")); + + gtk_widget_set_sensitive (GTK_WIDGET (item), allowed); +- add_connection_item (device, NULL, item, menu, applet); ++ if (!allowed && applet->hide_policy_items) { ++ /* don't add the item if should be hidden */ ++ g_object_ref_sink (item); ++ g_object_unref (item); ++ } else ++ add_connection_item (device, NULL, item, menu, applet); + } + } + +Index: network-manager-applet-0.9.4.1/src/applet-device-gsm.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-gsm.c ++++ network-manager-applet-0.9.4.1/src/applet-device-gsm.c +@@ -632,8 +632,12 @@ gsm_add_menu_item (NMDevice *device, + /* Default connection item */ + item = gtk_check_menu_item_new_with_label (_("New Mobile Broadband (GSM) connection...")); + gtk_widget_set_sensitive (GTK_WIDGET (item), allowed); +- add_connection_item (device, NULL, item, menu, applet); +- ++ if (!allowed && applet->hide_policy_items) { ++ /* don't add the item if it should be hidden */ ++ g_object_ref_sink (item); ++ g_object_unref (item); ++ } else ++ add_connection_item (device, NULL, item, menu, applet); + } + } + diff -Nru network-manager-applet-0.9.4.1/debian/patches/lp1048516_dont_req_keyring_in_greeter.patch network-manager-applet-0.9.4.1/debian/patches/lp1048516_dont_req_keyring_in_greeter.patch --- network-manager-applet-0.9.4.1/debian/patches/lp1048516_dont_req_keyring_in_greeter.patch 1969-12-31 16:00:00.000000000 -0800 +++ network-manager-applet-0.9.4.1/debian/patches/lp1048516_dont_req_keyring_in_greeter.patch 2015-01-19 01:01:31.000000000 -0800 @@ -0,0 +1,31 @@ +From: Antti Kaijanmäki +Subject: Avoid trying to set the pin dialog to save password (and require a + keyring) when the user doesn't have MODIFY_OWN permissions. + +--- + src/applet-device-gsm.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +Index: network-manager-applet-0.9.4.1/src/applet-device-gsm.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-gsm.c ++++ network-manager-applet-0.9.4.1/src/applet-device-gsm.c +@@ -1013,12 +1013,18 @@ unlock_dialog_new (NMDevice *device, Gsm + guint32 label1_min = 0, label2_min = 0, label3_min = 0; + guint32 label1_max = 0, label2_max = 0, label3_max = 0; + guint32 unlock_code = 0; ++ NMClientPermission perm; + + g_return_if_fail (info->unlock_required != NULL); + + if (info->dialog) + return; + ++ perm = NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN; ++ if (! ( info->applet->permissions[perm] == NM_CLIENT_PERMISSION_RESULT_YES ++ || info->applet->permissions[perm] == NM_CLIENT_PERMISSION_RESULT_AUTH)) ++ return; ++ + /* Figure out the dialog text based on the required unlock code */ + device_desc = utils_get_device_description (device); + if (!strcmp (info->unlock_required, "sim-pin")) { diff -Nru network-manager-applet-0.9.4.1/debian/patches/lp1048520_delay_pin_dialog_in_greeter.patch network-manager-applet-0.9.4.1/debian/patches/lp1048520_delay_pin_dialog_in_greeter.patch --- network-manager-applet-0.9.4.1/debian/patches/lp1048520_delay_pin_dialog_in_greeter.patch 1969-12-31 16:00:00.000000000 -0800 +++ network-manager-applet-0.9.4.1/debian/patches/lp1048520_delay_pin_dialog_in_greeter.patch 2015-01-19 01:01:31.000000000 -0800 @@ -0,0 +1,184 @@ +From: Antti Kaijanmäki +Subject: Delay showing the pin dialog in greeter mode; only show it when + the user actually activates a connection instead of on modem detect. + +--- + src/applet-device-gsm.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 123 insertions(+), 5 deletions(-) + +Index: network-manager-applet-0.9.4.1/src/applet-device-gsm.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-gsm.c ++++ network-manager-applet-0.9.4.1/src/applet-device-gsm.c +@@ -91,6 +91,8 @@ typedef struct { + gboolean skip_reg_poll; + gboolean skip_signal_poll; + ++ gboolean greeter_mode; ++ + /* Unlock dialog stuff */ + GtkWidget *dialog; + gpointer keyring_id; +@@ -98,6 +100,7 @@ typedef struct { + + static void unlock_dialog_destroy (GsmDeviceInfo *info); + static void check_start_polling (GsmDeviceInfo *info); ++static void unlock_dialog_new (NMDevice *device, GsmDeviceInfo *info); + + typedef struct { + NMApplet *applet; +@@ -282,10 +285,117 @@ applet_gsm_connect_network (NMApplet *ap + do_mobile_wizard (dbus_connect_3g_cb, info); + } + ++typedef struct { ++ NMDevice *device; ++ NMConnection *connection; ++ NMApplet *applet; ++ gpointer dclass_data; ++ guint wait_retry; ++} DelayedActivationHelper; ++ ++gboolean delayed_activation_cb(gpointer user_data) ++{ ++ DelayedActivationHelper *helper = user_data; ++ ++ if (!NM_IS_DEVICE (helper->device)) { ++ // the device has been unplugged. ++ return FALSE; ++ } ++ ++ GsmDeviceInfo *devinfo = g_object_get_data (G_OBJECT (helper->device), "devinfo"); ++ ++ if (devinfo->unlock_required == NULL) { ++ // the modem was successfully unlocked ++ ++ applet_menu_item_activate_helper (helper->device, ++ helper->connection, ++ "/", ++ helper->applet, ++ helper->dclass_data); ++ return FALSE; ++ } ++ ++ helper->wait_retry -= 1; ++ if (helper->wait_retry == 0) { ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ ++void gsm_menu_item_activate_unlock_dialog_destroy (GtkWidget *object, ++ gpointer user_data) ++{ ++ GSMMenuItemInfo *info = (GSMMenuItemInfo *) user_data; ++ GsmDeviceInfo *devinfo; ++ DelayedActivationHelper *helper; ++ ++ /* ++ * The dialog is destroyed. Either the PIN code was successfully ++ * forwarded to ModemManager or the dialog was cancelled. ++ * Unfortunately we don't have any means of determine which is the case. ++ * ++ * The solution here is to monitor GsmDeviceInfo::unlock_required. If that ++ * is cleared, then we know that the modem has been activated and we can ++ * continue with the activation. ++ * ++ * Because unlock_required is updated upon receiving a property changed ++ * signal we have to give MM some time to deliver the change over D-Bus. ++ * ++ * Here we set up a timer which checks the state of the modem three times ++ * with 1 second delay. ++ * ++ * If the modem was not successfully activated this delayed activation is ++ * cancelled after three tries/seconds. ++ */ ++ ++ devinfo = g_object_get_data (G_OBJECT (info->device), "devinfo"); ++ ++ helper = g_malloc (sizeof (DelayedActivationHelper)); ++ helper->device = info->device; ++ helper->connection = info->connection; ++ helper->applet = info->applet; ++ helper->dclass_data = info; ++ helper->wait_retry = 3; ++ ++ g_timeout_add_full (G_PRIORITY_DEFAULT, ++ 1 * 1000, ++ (GSourceFunc)delayed_activation_cb, ++ helper, ++ (GDestroyNotify)g_free); ++} ++ + static void + gsm_menu_item_activate (GtkMenuItem *item, gpointer user_data) + { + GSMMenuItemInfo *info = (GSMMenuItemInfo *) user_data; ++ GsmDeviceInfo *devinfo; ++ ++ devinfo = g_object_get_data (G_OBJECT (info->device), "devinfo"); ++ if (devinfo->greeter_mode && devinfo->unlock_required != NULL) { ++ ++ /* We need to delay the activation until the modem is unlocked. */ ++ ++ unlock_dialog_new(devinfo->device, devinfo); ++ /* ++ * The dialog gets destroyed if ++ * ++ * A) User enters the correct PIN and ModemManager tells nm-applet ++ * that the modem was successfully activated. ++ * ++ * The dialog does not get destroyed, however, if the PIN code ++ * is incorrect. The dialog shows an error message and the user can ++ * either enter a new PIN code or Cancel. ++ * ++ * All this happens in the dialogs response handler or callback that ++ * handles the PIN activation return value from ModemManager. ++ * See the relevant functions later in this file. ++ * ++ * B) The user cancels the dialog. ++ */ ++ g_signal_connect (devinfo->dialog, "destroy", G_CALLBACK (gsm_menu_item_activate_unlock_dialog_destroy), info); ++ return; ++ } + + applet_menu_item_activate_helper (info->device, + info->connection, +@@ -1365,8 +1475,10 @@ keyring_pin_check_cb (GnomeKeyringResult + info->keyring_id = NULL; + + if (result != GNOME_KEYRING_RESULT_OK) { +- /* No saved PIN, just ask the user */ +- unlock_dialog_new (info->device, info); ++ if (!info->greeter_mode) { ++ /* No saved PIN, just ask the user */ ++ unlock_dialog_new (info->device, info); ++ } + return; + } + +@@ -1448,8 +1560,10 @@ simid_reply (DBusGProxy *proxy, DBusGPro + info->devid, + NULL); + } else { +- /* Couldn't get a device ID, but unlock required; present dialog */ +- unlock_dialog_new (info->device, info); ++ if (!info->greeter_mode) { ++ /* Couldn't get a device ID, but unlock required; present dialog */ ++ unlock_dialog_new (info->device, info); ++ } + } + } + +@@ -1691,6 +1805,10 @@ gsm_device_added (NMDevice *device, NMAp + info->device = device; + info->bus = bus; + ++ info->greeter_mode = FALSE; ++ if (getenv ("INDICATOR_GREETER_MODE")) ++ info->greeter_mode = TRUE; ++ + info->props_proxy = dbus_g_proxy_new_for_name (info->bus, + "org.freedesktop.ModemManager", + udi, diff -Nru network-manager-applet-0.9.4.1/debian/patches/make_menu_items_insensitive_based_on_permissions.patch network-manager-applet-0.9.4.1/debian/patches/make_menu_items_insensitive_based_on_permissions.patch --- network-manager-applet-0.9.4.1/debian/patches/make_menu_items_insensitive_based_on_permissions.patch 1969-12-31 16:00:00.000000000 -0800 +++ network-manager-applet-0.9.4.1/debian/patches/make_menu_items_insensitive_based_on_permissions.patch 2015-01-19 01:01:43.000000000 -0800 @@ -0,0 +1,223 @@ +From: Antti Kaijanmäki +Subject: Make sure the behavior for policykit-restricted actions is + consistently to make the items insensitive + +--- + src/applet-device-cdma.c | 26 ++++++++++++++++++++++++++ + src/applet-device-gsm.c | 26 ++++++++++++++++++++++++++ + src/applet-device-wifi.c | 29 +++++++++++++++++++++++++++++ + src/applet.c | 35 +++++++++++++++++++++++++++++++++-- + 4 files changed, 114 insertions(+), 2 deletions(-) + +Index: network-manager-applet-0.9.4.1/src/applet.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet.c ++++ network-manager-applet-0.9.4.1/src/applet.c +@@ -87,6 +87,8 @@ extern gboolean shell_debug; + + G_DEFINE_TYPE(NMApplet, nma, G_TYPE_OBJECT) + ++static gboolean is_permission_yes (NMApplet *applet, NMClientPermission perm); ++ + /********************************************************************/ + /* Temporary dbus interface stuff */ + +@@ -1561,7 +1563,10 @@ nma_menu_device_get_menu_item (NMDevice + G_CALLBACK (applet_device_disconnect_db), + info, + (GClosureNotify) applet_device_info_destroy, 0); +- gtk_widget_set_sensitive (item, TRUE); ++ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL)) ++ gtk_widget_set_sensitive (item, TRUE); ++ else ++ gtk_widget_set_sensitive (item, FALSE); + break; + } + default: +@@ -1773,12 +1778,24 @@ nma_menu_add_vpn_submenu (GtkWidget *men + item = GTK_MENU_ITEM (gtk_menu_item_new_with_mnemonic (_("_Configure VPN..."))); + g_signal_connect (item, "activate", G_CALLBACK (nma_menu_configure_vpn_item_activate), applet); + gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); ++ if ( is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM) ++ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN)) { ++ gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); ++ } else { ++ gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); ++ } + + item = GTK_MENU_ITEM (gtk_menu_item_new_with_mnemonic (_("_Disconnect VPN"))); + g_signal_connect (item, "activate", G_CALLBACK (nma_menu_disconnect_vpn_item_activate), applet); + gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item)); +- if (num_vpn_active == 0) ++ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL)) { ++ gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); ++ if (num_vpn_active == 0) ++ gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); ++ ++ } else { + gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); ++ } + + g_slist_free (list); + } +@@ -2053,6 +2070,20 @@ nma_context_menu_update (NMApplet *apple + gtk_widget_show_all (applet->wimax_enabled_item); + else + gtk_widget_hide (applet->wimax_enabled_item); ++ ++ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM) ++ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN) ++ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME)) { ++ ++ /* User has permissions to modify some of the settings. */ ++ gtk_widget_set_sensitive (applet->connections_menu_item, TRUE); ++ ++ } else { ++ /* the user is not allowed to edit any of the settings, ++ * so set the "Edit Connections..." menu item insensitive. ++ */ ++ gtk_widget_set_sensitive (applet->connections_menu_item, FALSE); ++ } + } + + static void +Index: network-manager-applet-0.9.4.1/src/applet-device-wifi.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-wifi.c ++++ network-manager-applet-0.9.4.1/src/applet-device-wifi.c +@@ -93,6 +93,8 @@ nma_menu_add_hidden_network_item (GtkWid + { + GtkWidget *menu_item; + GtkWidget *label; ++ gboolean allowed; ++ NMClientPermissionResult perm; + + menu_item = gtk_menu_item_new (); + label = gtk_label_new_with_mnemonic (_("_Connect to Hidden Wireless Network...")); +@@ -103,6 +105,33 @@ nma_menu_add_hidden_network_item (GtkWid + g_signal_connect_swapped (menu_item, "activate", + G_CALLBACK (applet_wifi_connect_to_hidden_network), + applet); ++ ++ allowed = FALSE; ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_NETWORK_CONTROL); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ /* First, the user has to be able to control networks ++ * to connect to a new hidden access point. ++ */ ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ /* The user can modify (and add!) a new configuration for herself. */ ++ allowed = TRUE; ++ } else { ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ /* The user can modify (and add!) a new system wide configuration. */ ++ allowed = TRUE; ++ } ++ } ++ } ++ ++ gtk_widget_set_sensitive (GTK_WIDGET (menu_item), allowed); + } + + gboolean +Index: network-manager-applet-0.9.4.1/src/applet-device-cdma.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-cdma.c ++++ network-manager-applet-0.9.4.1/src/applet-device-cdma.c +@@ -330,6 +330,8 @@ cdma_add_menu_item (NMDevice *device, + #ifdef ENABLE_INDICATOR + GtkWidget *signal_icon; + #endif ++ gboolean allowed; ++ NMClientPermissionResult perm; + + info = g_object_get_data (G_OBJECT (device), "devinfo"); + +@@ -445,8 +447,32 @@ cdma_add_menu_item (NMDevice *device, + } + } + } else { ++ ++ allowed = FALSE; ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_NETWORK_CONTROL); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ allowed = TRUE; ++ } else { ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ allowed = TRUE; ++ } ++ } ++ } ++ + /* Default connection item */ + item = gtk_check_menu_item_new_with_label (_("New Mobile Broadband (CDMA) connection...")); ++ ++ gtk_widget_set_sensitive (GTK_WIDGET (item), allowed); + add_connection_item (device, NULL, item, menu, applet); + } + } +Index: network-manager-applet-0.9.4.1/src/applet-device-gsm.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-device-gsm.c ++++ network-manager-applet-0.9.4.1/src/applet-device-gsm.c +@@ -488,6 +488,8 @@ gsm_add_menu_item (NMDevice *device, + #ifdef ENABLE_INDICATOR + GtkWidget *signal_icon; + #endif ++ gboolean allowed; ++ NMClientPermissionResult perm; + + info = g_object_get_data (G_OBJECT (device), "devinfo"); + +@@ -605,9 +607,33 @@ gsm_add_menu_item (NMDevice *device, + } + } + } else { ++ ++ allowed = FALSE; ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_NETWORK_CONTROL); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ allowed = TRUE; ++ } else { ++ perm = nm_client_get_permission_result (applet->nm_client, ++ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM); ++ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES ++ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) { ++ allowed = TRUE; ++ } ++ } ++ } ++ + /* Default connection item */ + item = gtk_check_menu_item_new_with_label (_("New Mobile Broadband (GSM) connection...")); ++ gtk_widget_set_sensitive (GTK_WIDGET (item), allowed); + add_connection_item (device, NULL, item, menu, applet); ++ + } + } + diff -Nru network-manager-applet-0.9.4.1/debian/patches/position_dialogs_to_center_of_the_screen.patch network-manager-applet-0.9.4.1/debian/patches/position_dialogs_to_center_of_the_screen.patch --- network-manager-applet-0.9.4.1/debian/patches/position_dialogs_to_center_of_the_screen.patch 1969-12-31 16:00:00.000000000 -0800 +++ network-manager-applet-0.9.4.1/debian/patches/position_dialogs_to_center_of_the_screen.patch 2015-01-19 01:01:31.000000000 -0800 @@ -0,0 +1,44 @@ +From: Antti Kaijanmäki +Subject: Always center dialogs on the screen + +--- + src/applet-dialogs.c | 4 ++++ + src/utils/utils.c | 2 ++ + 2 files changed, 6 insertions(+) + +Index: network-manager-applet-0.9.4.1/src/applet-dialogs.c +=================================================================== +--- network-manager-applet-0.9.4.1.orig/src/applet-dialogs.c ++++ network-manager-applet-0.9.4.1/src/applet-dialogs.c +@@ -55,6 +55,7 @@ info_dialog_show_error (const char *err) + + dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "%s\n\n%s", _("Error displaying connection information:"), err); ++ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_window_present (GTK_WINDOW (dialog)); + g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); + } +@@ -902,6 +903,7 @@ applet_info_dialog_show (NMApplet *apple + g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), dialog); + g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_hide), dialog); + gtk_widget_realize (dialog); ++ gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_window_present_with_time (GTK_WINDOW (dialog), + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); + } +@@ -981,6 +983,7 @@ applet_mobile_password_dialog_new (NMCon + + dialog = GTK_DIALOG (gtk_dialog_new ()); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); ++ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_window_set_title (GTK_WINDOW (dialog), _("Mobile broadband network password")); + + w = gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); +@@ -1149,6 +1152,7 @@ applet_mobile_pin_dialog_new (const char + + g_object_set_data_full (G_OBJECT (dialog), "builder", builder, (GDestroyNotify) g_object_unref); + ++ gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_window_set_title (GTK_WINDOW (dialog), title); + + widget = GTK_WIDGET (gtk_builder_get_object (builder, "header_label")); diff -Nru network-manager-applet-0.9.4.1/debian/patches/rebuild_menu_after_init.patch network-manager-applet-0.9.4.1/debian/patches/rebuild_menu_after_init.patch --- network-manager-applet-0.9.4.1/debian/patches/rebuild_menu_after_init.patch 2013-04-15 13:15:42.000000000 -0700 +++ network-manager-applet-0.9.4.1/debian/patches/rebuild_menu_after_init.patch 2015-01-19 01:01:31.000000000 -0800 @@ -10,9 +10,11 @@ Author: Mathieu Trudel-Lapierre Bug-Ubuntu: https://bugs.launchpad.net/bugs/965895 +Index: network-manager-applet-0.9.4.1/src/applet.c +=================================================================== --- network-manager-applet-0.9.4.1.orig/src/applet.c +++ network-manager-applet-0.9.4.1/src/applet.c -@@ -3558,6 +3558,8 @@ setup_indicator_menu (NMApplet *applet) +@@ -3564,6 +3564,8 @@ setup_indicator_menu (NMApplet *applet) app_indicator_set_menu(applet->app_indicator, GTK_MENU(applet->menu)); diff -Nru network-manager-applet-0.9.4.1/debian/patches/series network-manager-applet-0.9.4.1/debian/patches/series --- network-manager-applet-0.9.4.1/debian/patches/series 2013-04-15 13:15:42.000000000 -0700 +++ network-manager-applet-0.9.4.1/debian/patches/series 2015-01-19 01:01:31.000000000 -0800 @@ -19,3 +19,8 @@ lp829673_gconf_hide_applet.patch revert_git_policy_error_dialog_ba8381a.patch rebuild_menu_after_init.patch +lp1048516_dont_req_keyring_in_greeter.patch +lp1048520_delay_pin_dialog_in_greeter.patch +make_menu_items_insensitive_based_on_permissions.patch +position_dialogs_to_center_of_the_screen.patch +hide_policy_items_env_var.patch