[gnome-online-miners/wip/rishi/insert-share: 16/16] gdata: Implement vfuncs



commit 0bb87f929082534b2847cf0c1197019862bbc1de
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Sep 3 19:07:45 2016 +0200

    gdata: Implement vfuncs

 src/gom-gdata-miner.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/gom-gdata-miner.c b/src/gom-gdata-miner.c
index 7f83407..d1c1165 100644
--- a/src/gom-gdata-miner.c
+++ b/src/gom-gdata-miner.c
@@ -904,6 +904,24 @@ query_gdata (GomAccountMinerJob *job,
     query_gdata_photos (job, GDATA_PICASAWEB_SERVICE (service), cancellable, error);
 }
 
+static gpointer
+create_service (GomMiner *miner, GoaObject *object, const gchar *type)
+{
+  GDataGoaAuthorizer *authorizer;
+  gpointer service = NULL;
+
+  authorizer = gdata_goa_authorizer_new (object);
+
+  if (g_strcmp0 (type, "documents") == 0)
+    service = gdata_documents_service_new (GDATA_AUTHORIZER (authorizer));
+
+  if (g_strcmp0 (type, "photos") == 0)
+    service = gdata_picasaweb_service_new (GDATA_AUTHORIZER (authorizer));
+
+  g_object_unref (authorizer);
+  return service;
+}
+
 static GHashTable *
 create_services (GomMiner *self,
                  GoaObject *object)
@@ -938,6 +956,12 @@ create_services (GomMiner *self,
 }
 
 static void
+destroy_service (GomMiner *miner, gpointer service)
+{
+  g_object_unref (service);
+}
+
+static void
 gom_gdata_miner_init (GomGDataMiner *miner)
 {
 }
@@ -951,6 +975,8 @@ gom_gdata_miner_class_init (GomGDataMinerClass *klass)
   miner_class->miner_identifier = MINER_IDENTIFIER;
   miner_class->version = 5;
 
+  miner_class->create_service = create_service;
   miner_class->create_services = create_services;
+  miner_class->destroy_service = destroy_service;
   miner_class->query = query_gdata;
 }


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