[gnome-online-accounts/wip/rishi/ensure-credentials: 5/6] daemon: Simplify the code



commit c242bebc3fe36fe1af31a2606233fda4b3360d38
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Nov 25 18:24:19 2015 +0100

    daemon: Simplify the code
    
    Since we are using a GTask to track each EnsureCredentials call, we
    don't need to track the GoaDaemon separately. It is already tracked by
    GTask as the source object.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751524

 src/daemon/goadaemon.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index 338f182..f04ef63 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -1126,19 +1126,16 @@ on_account_handle_remove (GoaAccount            *account,
 
 typedef struct
 {
-  GoaDaemon *daemon;
   GoaObject *object;
   GDBusMethodInvocation *invocation;
 } EnsureData;
 
 static EnsureData *
-ensure_data_new (GoaDaemon             *self,
-                 GoaObject             *object,
+ensure_data_new (GoaObject             *object,
                  GDBusMethodInvocation *invocation)
 {
   EnsureData *data;
   data = g_slice_new0 (EnsureData);
-  data->daemon = g_object_ref (self);
   data->object = g_object_ref (object);
   data->invocation = invocation;
   return data;
@@ -1147,7 +1144,6 @@ ensure_data_new (GoaDaemon             *self,
 static void
 ensure_data_unref (EnsureData *data)
 {
-  g_object_unref (data->daemon);
   g_object_unref (data->object);
   g_slice_free (EnsureData, data);
 }
@@ -1308,7 +1304,7 @@ on_account_handle_ensure_credentials (GoaAccount            *account,
     }
 
   object = GOA_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (account)));
-  data = ensure_data_new (self, object, invocation);
+  data = ensure_data_new (object, invocation);
 
   task = g_task_new (self, NULL, NULL, NULL);
   g_task_set_task_data (task, data, (GDestroyNotify) ensure_data_unref);
@@ -1360,7 +1356,7 @@ goa_daemon_check_credentials (GoaDaemon *self)
       provider_type = goa_account_get_provider_type (account);
       g_debug ("Calling EnsureCredentials for account (%s, %s)", provider_type, id);
 
-      data = ensure_data_new (self, object, NULL);
+      data = ensure_data_new (object, NULL);
 
       task = g_task_new (self, NULL, NULL, NULL);
       g_task_set_task_data (task, data, (GDestroyNotify) ensure_data_unref);


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