nm-applet.desktop.in | 2 +- shared/nm-libnm-compat.h | 2 +- src/applet-agent.c | 34 ++++++++++++++++++++++++++++++++++ src/applet.c | 5 +++++ src/connection-editor/page-ip6.c | 14 ++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/nm-applet.desktop.in b/nm-applet.desktop.in index 3b182664..4dd087ce 100644 --- a/nm-applet.desktop.in +++ b/nm-applet.desktop.in @@ -6,5 +6,5 @@ Exec=nm-applet Terminal=false Type=Application NoDisplay=true -NotShowIn=KDE;GNOME; +NotShowIn=GNOME; X-GNOME-UsesNotifications=true diff --git a/shared/nm-libnm-compat.h b/shared/nm-libnm-compat.h index 8f8de685..6b772e3b 100644 --- a/shared/nm-libnm-compat.h +++ b/shared/nm-libnm-compat.h @@ -29,7 +29,7 @@ }) #define _NMU_SEC_SAE ((NMUtilsSecurityType) 9) -#if !NM_CHECK_VERSION (1,22,0) +#if !NM_CHECK_VERSION (1,18,10) #define NMU_SEC_SAE _NMU_SEC_SAE #endif G_STATIC_ASSERT(NMU_SEC_SAE == _NMU_SEC_SAE); diff --git a/src/applet-agent.c b/src/applet-agent.c index fa7070d3..5568ac6c 100644 --- a/src/applet-agent.c +++ b/src/applet-agent.c @@ -269,6 +269,7 @@ keyring_find_secrets_cb (GObject *source, GList *list = NULL; GList *iter; gboolean hint_found = FALSE, ask = FALSE; + gboolean need_retry = TRUE; r->keyring_calls--; if (g_cancellable_is_cancelled (r->cancellable)) { @@ -280,6 +281,7 @@ keyring_find_secrets_cb (GObject *source, list = secret_service_search_finish (NULL, result, &search_error); connection_id = nm_connection_get_id (r->connection); +hack_retry: if (g_error_matches (search_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { error = g_error_new_literal (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_USER_CANCELED, @@ -297,6 +299,13 @@ keyring_find_secrets_cb (GObject *source, "%s.%d - failed to read secrets from keyring (%s)", __FILE__, __LINE__, search_error->message); g_error_free (search_error); + if ( (r->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION) + && g_list_length (list) == 0) { + g_message ("No keyring secrets found for %s/%s; asking user.", connection_id, r->setting_name); + g_clear_error (&error); + ask_for_secrets (r); + return; + } goto done; } @@ -327,6 +336,31 @@ keyring_find_secrets_cb (GObject *source, if (!key_name) { g_hash_table_unref (attributes); secret_value_unref (secret); + + /* HACK (very dirty): + * In case of unlocking secrets in the gnome-keyring it + * returns something strange and wrong. + * So just get secrets again once. + * See https://bugzilla.gnome.org/show_bug.cgi?id=697566. + */ + if (need_retry) { + GHashTable *attrs; + + need_retry = FALSE; + g_list_free_full (list, g_object_unref); + search_error = NULL; + attrs = secret_attributes_build (&network_manager_secret_schema, + KEYRING_UUID_TAG, nm_connection_get_uuid (r->connection), + KEYRING_SN_TAG, r->setting_name, + NULL); + + list = secret_service_search_sync (NULL, &network_manager_secret_schema, attrs, + SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS, + r->cancellable, &search_error); + g_hash_table_unref (attrs); + goto hack_retry; + } + continue; } diff --git a/src/applet.c b/src/applet.c index 8ef6833a..64adc041 100644 --- a/src/applet.c +++ b/src/applet.c @@ -2646,6 +2646,11 @@ applet_update_icon (gpointer user_data) break; default: applet_get_device_icon_for_state (applet, &pixbuf, &icon_name_free, &dev_tip_free); + if (!pixbuf && !icon_name_free && !dev_tip_free && state == NM_STATE_CONNECTED_GLOBAL) { + icon_name_free = g_strdup ("nm-no-connection"); + pixbuf = g_object_ref (nma_icon_check_and_load (icon_name_free, applet)); + dev_tip_free = g_strdup (_("No network connection")); + } icon_name = icon_name_free; dev_tip = dev_tip_free; break; diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c index cf552cb1..14418b4b 100644 --- a/src/connection-editor/page-ip6.c +++ b/src/connection-editor/page-ip6.c @@ -30,9 +30,11 @@ G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE) #define COL_LAST COL_GATEWAY /* Disabled method was added in NM 1.20 */ +#if NM_CHECK_VERSION (1,20,0) #ifndef NM_SETTING_IP6_CONFIG_METHOD_DISABLED #define NM_SETTING_IP6_CONFIG_METHOD_DISABLED "disabled" #endif +#endif typedef struct { NMSettingIPConfig *setting; @@ -96,7 +98,9 @@ typedef struct { #define IP6_METHOD_MANUAL 4 #define IP6_METHOD_LINK_LOCAL 5 #define IP6_METHOD_SHARED 6 +#if NM_CHECK_VERSION (1,20,0) #define IP6_METHOD_DISABLED 7 +#endif #define IP6_PRIVACY_UNKNOWN 0 #define IP6_PRIVACY_DISABLED 1 @@ -208,12 +212,14 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection) -1); } +#if NM_CHECK_VERSION (1,20,0) gtk_list_store_append (priv->method_store, &iter); gtk_list_store_set (priv->method_store, &iter, METHOD_COL_NAME, _("Disabled"), METHOD_COL_NUM, IP6_METHOD_DISABLED, METHOD_COL_ENABLED, TRUE, -1); +#endif gtk_combo_box_set_model (priv->method, GTK_TREE_MODEL (priv->method_store)); @@ -300,7 +306,9 @@ method_changed (GtkComboBox *combo, gpointer user_data) label = CE_LABEL_ADDR_SHARED; break; case IP6_METHOD_IGNORE: +#if NM_CHECK_VERSION (1,20,0) case IP6_METHOD_DISABLED: +#endif ip6_required_enabled = FALSE; ip6_addr_gen_mode_enabled = FALSE; break; @@ -415,8 +423,10 @@ populate_ui (CEPageIP6 *self) method = IP6_METHOD_MANUAL; else if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) method = IP6_METHOD_SHARED; +#if NM_CHECK_VERSION (1,20,0) else if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) method = IP6_METHOD_DISABLED; +#endif } if (method == IP6_METHOD_AUTO && nm_setting_ip_config_get_ignore_auto_dns (setting)) @@ -1258,9 +1268,11 @@ ui_to_setting (CEPageIP6 *self, GError **error) case IP6_METHOD_IGNORE: method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; break; +#if NM_CHECK_VERSION (1,20,0) case IP6_METHOD_DISABLED: method = NM_SETTING_IP6_CONFIG_METHOD_DISABLED; break; +#endif case IP6_METHOD_LINK_LOCAL: method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; break; @@ -1496,9 +1508,11 @@ change_method_combo (CEPage *page, gboolean is_hotspot) if (nm_streq0 (nm_setting_ip_config_get_method (priv->setting), NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) method = IP6_METHOD_IGNORE; +#if NM_CHECK_VERSION (1,20,0) else if (nm_streq0 (nm_setting_ip_config_get_method (priv->setting), NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) method = IP6_METHOD_DISABLED; +#endif gtk_combo_box_set_active (priv->method, method); } else gtk_combo_box_set_active (priv->method, priv->hotspot_method_idx);