nm-applet.desktop.in | 2 +- src/applet-agent.c | 34 ++++++++++++++++++++++++++++++++++ src/applet.c | 5 +++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/nm-applet.desktop.in b/nm-applet.desktop.in index 677ed52a..bee6c96c 100644 --- a/nm-applet.desktop.in +++ b/nm-applet.desktop.in @@ -6,7 +6,7 @@ Exec=nm-applet Terminal=false Type=Application NoDisplay=true -NotShowIn=KDE;GNOME; +NotShowIn=GNOME; X-GNOME-Bugzilla-Bugzilla=GNOME X-GNOME-Bugzilla-Product=NetworkManager X-GNOME-Bugzilla-Component=nm-applet diff --git a/src/applet-agent.c b/src/applet-agent.c index 0ac145be..a2f016ef 100644 --- a/src/applet-agent.c +++ b/src/applet-agent.c @@ -268,6 +268,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)) { @@ -279,6 +280,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, @@ -296,6 +298,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; } @@ -326,6 +335,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 88f4c9d1..8efa8a2e 100644 --- a/src/applet.c +++ b/src/applet.c @@ -2671,6 +2671,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;