[network-manager-applet] applet: actually initialize the secret agent



commit d0460df272e6fcace3bcc2d07dd2b806bcb464cd
Author: Dan Williams <dcbw redhat com>
Date:   Wed Feb 25 18:45:00 2015 -0600

    applet: actually initialize the secret agent
    
    libnm's NMSecretAgentOld is a GInitable and requires explicit
    initialization.
    
    Fixes: 3722a190468f5ce5898db8838611bc826d3153f1

 src/applet-agent.c |   27 ++++++++++++---------------
 src/applet-agent.h |    2 +-
 src/applet.c       |    2 +-
 3 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/applet-agent.c b/src/applet-agent.c
index fa44c2d..794ff67 100644
--- a/src/applet-agent.c
+++ b/src/applet-agent.c
@@ -776,24 +776,21 @@ applet_agent_handle_vpn_only (AppletAgent *agent, gboolean vpn_only)
 /*******************************************************/
 
 AppletAgent *
-applet_agent_new (void)
+applet_agent_new (GError **error)
 {
-       //return g_initable_new (APPLET_TYPE_AGENT, NULL, NULL,
-       return g_object_new (APPLET_TYPE_AGENT,
-                              NM_SECRET_AGENT_OLD_IDENTIFIER, "org.freedesktop.nm-applet",
-                              NM_SECRET_AGENT_OLD_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS,
-                              NULL);
-}
+       AppletAgent *agent;
+
+       agent = g_object_new (APPLET_TYPE_AGENT,
+                             NM_SECRET_AGENT_OLD_IDENTIFIER, "org.freedesktop.nm-applet",
+                             NM_SECRET_AGENT_OLD_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS,
+                             NULL);
+       if (!g_initable_init (G_INITABLE (agent), NULL, error)) {
+               g_object_unref (agent);
+               return NULL;
+       }
 
-#if 0
-FIXME
-static void
-agent_registration_result_cb (NMSecretAgentOld *agent, GError *error, gpointer user_data)
-{
-       if (error)
-               g_warning ("Failed to register as an agent: (%d) %s", error->code, error->message);
+       return agent;
 }
-#endif
 
 static void
 applet_agent_init (AppletAgent *self)
diff --git a/src/applet-agent.h b/src/applet-agent.h
index e9cc5f2..33a83e9 100644
--- a/src/applet-agent.h
+++ b/src/applet-agent.h
@@ -63,7 +63,7 @@ typedef struct {
 
 GType applet_agent_get_type (void) G_GNUC_CONST;
 
-AppletAgent *applet_agent_new (void);
+AppletAgent *applet_agent_new (GError **error);
 
 void applet_agent_handle_vpn_only (AppletAgent *agent, gboolean vpn_only);
 
diff --git a/src/applet.c b/src/applet.c
index 9f469db..efc345b 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -3490,7 +3490,7 @@ register_agent (NMApplet *applet)
 {
        g_return_if_fail (!applet->agent);
 
-       applet->agent = applet_agent_new ();
+       applet->agent = applet_agent_new (NULL);
        g_assert (applet->agent);
        g_signal_connect (applet->agent, APPLET_AGENT_GET_SECRETS,
                          G_CALLBACK (applet_agent_get_secrets_cb), applet);


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