[network-manager-applet] applet: ensure to create the secret agent instance only once



commit 1731d6db5176f17f88fdcc48f99916101b8a12ae
Author: Thomas Haller <thaller redhat com>
Date:   Sun Aug 24 15:59:39 2014 +0200

    applet: ensure to create the secret agent instance only once
    
    Since we don't disconnect shell_version_changed_cb(), make sure that
    we don't call register_agent() when an agent is already registered.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727923
    
    Signed-off-by: Thomas Haller <thaller redhat com>

 src/applet.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 9cab493..f481703 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -3533,6 +3533,8 @@ applet_embedded_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
 static void
 register_agent (NMApplet *applet)
 {
+       g_return_if_fail (!applet->agent);
+
        applet->agent = applet_agent_new ();
        g_assert (applet->agent);
        g_signal_connect (applet->agent, APPLET_AGENT_GET_SECRETS,
@@ -3568,7 +3570,7 @@ shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer u
                                                      G_CALLBACK (shell_version_changed_cb),
                                                      applet);
                g_clear_object (&applet->shell_watcher);
-       } else {
+       } else if (!applet->agent) {
                /* No shell */
                g_debug ("gnome-shell is not running, registering secret agent");
                register_agent (applet);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]