[gnome-online-miners/wip/rishi/insert-share: 13/24] src: Pass the TrackerSparqlConnection separately to the query vfunc



commit 082e3909cf9a307bd2209dce42d3819b8ae8ef5a
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Sep 5 13:49:02 2016 +0200

    src: Pass the TrackerSparqlConnection separately to the query vfunc
    
    This will help us reuse the parts of the RefreshDB code for
    implementing InsertSharedContent.

 src/gom-facebook-miner.c     |   43 +++++++++--------
 src/gom-flickr-miner.c       |   48 ++++++++++++-------
 src/gom-gdata-miner.c        |  104 ++++++++++++++++++++++--------------------
 src/gom-media-server-miner.c |   14 +++--
 src/gom-miner.c              |    2 +-
 src/gom-miner.h              |    1 +
 src/gom-owncloud-miner.c     |   25 ++++++----
 src/gom-zpj-miner.c          |   32 +++++++------
 8 files changed, 151 insertions(+), 118 deletions(-)
---
diff --git a/src/gom-facebook-miner.c b/src/gom-facebook-miner.c
index 86899ab..ce45f5b 100644
--- a/src/gom-facebook-miner.c
+++ b/src/gom-facebook-miner.c
@@ -35,6 +35,7 @@ G_DEFINE_TYPE (GomFacebookMiner, gom_facebook_miner, GOM_TYPE_MINER)
 
 static gboolean
 account_miner_job_process_photo (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  GFBGraphPhoto *photo,
                                  const gchar *parent_resource_urn,
                                  const gchar *creator,
@@ -64,7 +65,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   g_hash_table_remove (job->previous_resources, identifier);
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -73,7 +74,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
   if (*error != NULL)
@@ -85,7 +86,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
                photo_updated_time);
   else
     {
-      mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime.tv_sec,
+      mtime_changed = gom_tracker_update_mtime (connection, new_mtime.tv_sec,
                                                 resource_exists, identifier, resource,
                                                 cancellable, error);
       if (*error != NULL)
@@ -100,7 +101,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   /* the resource changed - just set all the properties again */
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", photo_link);
@@ -109,7 +110,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:isPartOf", parent_resource_urn);
@@ -118,7 +119,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:mimeType", "image/jpeg");
@@ -127,7 +128,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", photo_name);
@@ -136,7 +137,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   contact_resource = gom_tracker_utils_ensure_contact_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, creator);
 
@@ -144,7 +145,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nco:creator", contact_resource);
@@ -154,7 +155,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:contentCreated", photo_created_time);
@@ -177,6 +178,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
  */
 static gboolean
 account_miner_job_process_album (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  GFBGraphAlbum *album,
                                  const gchar *creator,
                                  GCancellable *cancellable,
@@ -209,7 +211,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
   g_hash_table_remove (job->previous_resources, identifier);
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -219,7 +221,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
 
@@ -231,7 +233,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
    */
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", album_link);
@@ -240,7 +242,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:description", album_description);
@@ -249,7 +251,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", album_name);
@@ -258,7 +260,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   contact_resource = gom_tracker_utils_ensure_contact_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, creator);
 
@@ -266,7 +268,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nco:creator", contact_resource);
@@ -276,7 +278,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:contentCreated", album_created_time);
@@ -297,7 +299,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
       GError *local_error = NULL;
       GFBGraphPhoto *photo = GFBGRAPH_PHOTO (l->data);
 
-      account_miner_job_process_photo (job, photo, resource, creator, cancellable, &local_error);
+      account_miner_job_process_photo (job, connection, photo, resource, creator, cancellable, &local_error);
       if (local_error != NULL)
         {
           const gchar *photo_id;
@@ -322,6 +324,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
 
 static void
 query_facebook (GomAccountMinerJob *job,
+                TrackerSparqlConnection *connection,
                 GCancellable *cancellable,
                 GError **error)
 {
@@ -357,7 +360,7 @@ query_facebook (GomAccountMinerJob *job,
     {
       GFBGraphAlbum *album = GFBGRAPH_ALBUM (l->data);
 
-      account_miner_job_process_album (job, album, me_name, cancellable, &local_error);
+      account_miner_job_process_album (job, connection, album, me_name, cancellable, &local_error);
       if (local_error != NULL)
         {
           const gchar *album_id;
diff --git a/src/gom-flickr-miner.c b/src/gom-flickr-miner.c
index bc0a1a6..a3b75a6 100644
--- a/src/gom-flickr-miner.c
+++ b/src/gom-flickr-miner.c
@@ -52,10 +52,12 @@ typedef struct {
   GMainLoop *loop;
   GomAccountMinerJob *job;
   GrlSource *source;
+  TrackerSparqlConnection *connection;
   const gchar *source_id;
 } SyncData;
 
 static void account_miner_job_browse_container (GomAccountMinerJob *job,
+                                                TrackerSparqlConnection *connection,
                                                 FlickrEntry *entry,
                                                 GCancellable *cancellable);
 
@@ -98,6 +100,7 @@ get_grl_options (GrlSource *source)
 
 static gboolean
 account_miner_job_process_entry (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  OpType op_type,
                                  FlickrEntry *entry,
                                  GCancellable *cancellable,
@@ -131,7 +134,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     class = "nmm:Photo";
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -140,7 +143,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
 
@@ -155,7 +158,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
       parent_identifier = g_strconcat ("photos:collection:flickr:",
                                         grl_media_get_id (entry->parent) , NULL);
       parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
-        (job->connection, cancellable, error,
+        (connection, cancellable, error,
          NULL,
          job->datasource_urn, parent_identifier,
          "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
@@ -165,7 +168,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
         goto out;
 
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nie:isPartOf", parent_resource_urn);
@@ -176,7 +179,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     }
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", grl_media_get_title (entry->media));
@@ -192,7 +195,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
    */
   created_time = modification_date = grl_media_get_creation_date (entry->media);
   new_mtime = g_date_time_to_unix (modification_date);
-  mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
+  mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
                                             resource_exists, identifier, resource,
                                             cancellable, error);
 
@@ -210,7 +213,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     {
       date = gom_iso8601_from_timestamp (g_date_time_to_unix (created_time));
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nie:contentCreated", date);
@@ -222,7 +225,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
   url = grl_media_get_url (entry->media);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", url);
@@ -231,7 +234,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:description", grl_media_get_description (entry->media));
@@ -243,7 +246,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
   if (mime != NULL)
     {
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nie:mimeType", mime);
@@ -254,7 +257,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     }
 
   contact_resource = gom_tracker_utils_ensure_contact_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, grl_media_get_author (entry->media));
 
@@ -262,7 +265,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nco:creator", contact_resource);
@@ -304,7 +307,12 @@ source_browse_cb (GrlSource *source,
       FlickrEntry *entry;
 
       entry = create_entry (media, data->parent_entry->media);
-      account_miner_job_process_entry (data->job, OP_CREATE_HIEARCHY, entry, data->cancellable, 
&local_error);
+      account_miner_job_process_entry (data->job,
+                                       data->connection,
+                                       OP_CREATE_HIEARCHY,
+                                       entry,
+                                       data->cancellable,
+                                       &local_error);
       if (local_error != NULL)
         {
           g_warning ("Unable to process entry %p: %s", media, local_error->message);
@@ -322,7 +330,10 @@ source_browse_cb (GrlSource *source,
 }
 
 static void
-account_miner_job_browse_container (GomAccountMinerJob *job, FlickrEntry *entry, GCancellable *cancellable)
+account_miner_job_browse_container (GomAccountMinerJob *job,
+                                    TrackerSparqlConnection *connection,
+                                    FlickrEntry *entry,
+                                    GCancellable *cancellable)
 {
   GMainContext *context;
   GrlSource *source;
@@ -331,6 +342,7 @@ account_miner_job_browse_container (GomAccountMinerJob *job, FlickrEntry *entry,
   SyncData data;
 
   data.cancellable = cancellable;
+  data.connection = connection;
   data.parent_entry = entry;
   data.job = job;
 
@@ -379,7 +391,7 @@ source_search_cb (GrlSource *source,
       FlickrEntry *entry;
 
       entry = create_entry (media, NULL);
-      account_miner_job_process_entry (data->job, OP_FETCH_ALL, entry, data->cancellable, &local_error);
+      account_miner_job_process_entry (data->job, data->connection, OP_FETCH_ALL, entry, data->cancellable, 
&local_error);
       if (local_error != NULL)
         {
           g_warning ("Unable to process entry %p: %s", media, local_error->message);
@@ -395,6 +407,7 @@ source_search_cb (GrlSource *source,
 
 static void
 query_flickr (GomAccountMinerJob *job,
+              TrackerSparqlConnection *connection,
               GCancellable *cancellable,
               GError **error)
 {
@@ -424,6 +437,7 @@ query_flickr (GomAccountMinerJob *job,
    */
 
   data.cancellable = cancellable;
+  data.connection = connection;
   data.job = job;
   context = g_main_context_new ();
   g_main_context_push_thread_default (context);
@@ -440,13 +454,13 @@ query_flickr (GomAccountMinerJob *job,
   g_main_context_unref (context);
 
   entry = create_entry (NULL, NULL);
-  account_miner_job_browse_container (job, entry, cancellable);
+  account_miner_job_browse_container (job, connection, entry, cancellable);
   free_entry (entry);
 
   while (!g_queue_is_empty (priv->boxes))
     {
       entry = (FlickrEntry *) g_queue_pop_head (priv->boxes);
-      account_miner_job_browse_container (job, entry, cancellable);
+      account_miner_job_browse_container (job, connection, entry, cancellable);
       free_entry (entry);
     }
 }
diff --git a/src/gom-gdata-miner.c b/src/gom-gdata-miner.c
index 7f83407..a197577 100644
--- a/src/gom-gdata-miner.c
+++ b/src/gom-gdata-miner.c
@@ -56,6 +56,7 @@ generate_fake_email_from_fullname (const gchar *fullname)
 
 static gboolean
 account_miner_job_process_entry (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  GDataDocumentsService *service,
                                  GDataDocumentsEntry *doc_entry,
                                  GCancellable *cancellable,
@@ -114,7 +115,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     class = "nfo:DataContainer";
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -123,7 +124,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
 
@@ -131,7 +132,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   new_mtime = gdata_entry_get_updated (entry);
-  mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
+  mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
                                             resource_exists, identifier, resource,
                                             cancellable, error);
 
@@ -149,7 +150,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
   alternate_uri = gdata_link_get_uri (alternate);
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", alternate_uri);
@@ -164,7 +165,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     mimetype_override = "application/pdf";
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:mimeType", mimetype_override);
@@ -182,7 +183,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
         g_strdup_printf ("gd:collection:%s%s", PREFIX_DRIVE, gdata_link_get_uri (parent));
 
       parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
-        (job->connection, cancellable, error,
+        (connection, cancellable, error,
          NULL,
          job->datasource_urn, parent_resource_id,
          "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
@@ -192,7 +193,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
         goto out;
 
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nie:isPartOf", parent_resource_urn);
@@ -214,7 +215,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     }
 
   gom_tracker_sparql_connection_toggle_favorite
-    (job->connection,
+    (connection,
      cancellable, error,
      resource, starred);
 
@@ -222,7 +223,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:description", gdata_entry_get_summary (entry));
@@ -231,7 +232,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", gdata_entry_get_title (entry));
@@ -246,7 +247,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
       author = l->data;
 
-      contact_resource = gom_tracker_utils_ensure_contact_resource (job->connection,
+      contact_resource = gom_tracker_utils_ensure_contact_resource (connection,
                                                                     cancellable, error,
                                                                     gdata_author_get_email_address (author),
                                                                     gdata_author_get_name (author));
@@ -255,7 +256,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
         goto out;
 
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nco:creator", contact_resource);
@@ -291,13 +292,13 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
       if (g_strcmp0 (scope_type, GDATA_ACCESS_SCOPE_DOMAIN) == 0)
         continue;
 
-      contact_resource = gom_tracker_utils_ensure_contact_resource (job->connection,
+      contact_resource = gom_tracker_utils_ensure_contact_resource (connection,
                                                                     cancellable, error,
                                                                     scope_value,
                                                                     "");
 
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nco:contributor", contact_resource);
@@ -310,7 +311,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
   date = gom_iso8601_from_timestamp (gdata_entry_get_published (entry));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:contentCreated", date);
@@ -334,6 +335,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
 static gboolean
 account_miner_job_process_photo (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  GDataPicasaWebFile *photo,
                                  const gchar *parent_resource_urn,
                                  GCancellable *cancellable,
@@ -391,7 +393,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   g_hash_table_remove (job->previous_resources, identifier);
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -400,7 +402,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
   if (*error != NULL)
@@ -410,7 +412,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
    * been modified since our last run
    */
   new_mtime = gdata_entry_get_updated (GDATA_ENTRY (photo));
-  mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
+  mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
                                             resource_exists, identifier, resource,
                                             cancellable, error);
 
@@ -427,7 +429,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   alternate = gdata_entry_look_up_link (GDATA_ENTRY (photo), GDATA_LINK_ALTERNATE);
   alternate_uri = gdata_link_get_uri (alternate);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", alternate_uri);
@@ -437,7 +439,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   summary = gdata_entry_get_summary ((GDATA_ENTRY (photo)));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:description", summary);
@@ -446,7 +448,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:isPartOf", parent_resource_urn);
@@ -456,7 +458,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   mime = gdata_media_content_get_content_type (GDATA_MEDIA_CONTENT (media_contents->data));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:mimeType", mime);
@@ -466,7 +468,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   title = gdata_entry_get_title ((GDATA_ENTRY (photo)));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", title);
@@ -477,7 +479,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   credit = gdata_picasaweb_file_get_credit (photo);
   email = generate_fake_email_from_fullname (credit);
   contact_resource = gom_tracker_utils_ensure_contact_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      email, credit);
   g_free (email);
@@ -486,7 +488,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nco:creator", contact_resource);
@@ -497,7 +499,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   exposure = g_strdup_printf ("%f", gdata_picasaweb_file_get_exposure (photo));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nmm:exposureTime", exposure);
@@ -508,7 +510,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   focal_length = g_strdup_printf ("%f", gdata_picasaweb_file_get_focal_length (photo));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nmm:focalLength", focal_length);
@@ -519,7 +521,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   fstop = g_strdup_printf ("%f", gdata_picasaweb_file_get_fstop (photo));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nmm:fnumber", fstop);
@@ -530,7 +532,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   iso = g_strdup_printf ("%ld", (glong) gdata_picasaweb_file_get_iso (photo));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nmm:isoSpeed", iso);
@@ -541,7 +543,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   flash = gdata_picasaweb_file_get_flash (photo);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nmm:flash", flash ? flash_on : flash_off);
@@ -554,7 +556,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   if (make != NULL || model != NULL)
     {
-      equipment_resource = gom_tracker_utils_ensure_equipment_resource (job->connection,
+      equipment_resource = gom_tracker_utils_ensure_equipment_resource (connection,
                                                                         cancellable,
                                                                         error,
                                                                         make,
@@ -564,7 +566,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
         goto out;
 
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nfo:equipment", equipment_resource);
@@ -575,7 +577,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   width = g_strdup_printf ("%u", gdata_picasaweb_file_get_width (photo));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nfo:width", width);
@@ -586,7 +588,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   height = g_strdup_printf ("%u", gdata_picasaweb_file_get_height (photo));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nfo:height", height);
@@ -598,7 +600,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   timestamp = gdata_picasaweb_file_get_timestamp (photo);
   date = gom_iso8601_from_timestamp (timestamp / 1000);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:contentCreated", date);
@@ -620,6 +622,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
 static gboolean
 account_miner_job_process_album (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  GDataPicasaWebService *service,
                                  GDataPicasaWebAlbum *album,
                                  GCancellable *cancellable,
@@ -651,7 +654,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
   g_hash_table_remove (job->previous_resources, identifier);
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -662,7 +665,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_update_datasource
-    (job->connection, job->datasource_urn,
+    (connection, job->datasource_urn,
      resource_exists, identifier, resource,
      cancellable, error);
 
@@ -673,7 +676,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
    * been modified since our last run
    */
   new_mtime = gdata_entry_get_updated (GDATA_ENTRY (album));
-  mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
+  mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
                                             resource_exists, identifier, resource,
                                             cancellable, error);
 
@@ -690,7 +693,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
   alternate = gdata_entry_look_up_link (GDATA_ENTRY (album), GDATA_LINK_ALTERNATE);
   alternate_uri = gdata_link_get_uri (alternate);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", alternate_uri);
@@ -700,7 +703,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
 
   summary = gdata_entry_get_summary ((GDATA_ENTRY (album)));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:description", summary);
@@ -710,7 +713,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
 
   title = gdata_entry_get_title ((GDATA_ENTRY (album)));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", title);
@@ -721,7 +724,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
   nickname = gdata_picasaweb_album_get_nickname (album);
   email = generate_fake_email_from_fullname (nickname);
   contact_resource = gom_tracker_utils_ensure_contact_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      email, nickname);
   g_free (email);
@@ -730,7 +733,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nco:creator", contact_resource);
@@ -742,7 +745,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
   timestamp = gdata_picasaweb_album_get_timestamp (album);
   date = gom_iso8601_from_timestamp (timestamp / 1000);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:contentCreated", date);
@@ -767,7 +770,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
     {
       GDataPicasaWebFile *file = GDATA_PICASAWEB_FILE (l->data);
 
-      account_miner_job_process_photo (job, file, resource, cancellable, error);
+      account_miner_job_process_photo (job, connection, file, resource, cancellable, error);
 
       if (*error != NULL)
         {
@@ -792,6 +795,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
 
 static void
 query_gdata_documents (GomAccountMinerJob *job,
+                       TrackerSparqlConnection *connection,
                        GDataDocumentsService *service,
                        GCancellable *cancellable,
                        GError **error)
@@ -836,7 +840,7 @@ query_gdata_documents (GomAccountMinerJob *job,
       for (l = entries; l != NULL; l = l->next)
         {
           local_error = NULL;
-          account_miner_job_process_entry (job, service, l->data, cancellable, &local_error);
+          account_miner_job_process_entry (job, connection, service, l->data, cancellable, &local_error);
 
           if (local_error != NULL)
             {
@@ -856,6 +860,7 @@ query_gdata_documents (GomAccountMinerJob *job,
 
 static void
 query_gdata_photos (GomAccountMinerJob *job,
+                    TrackerSparqlConnection *connection,
                     GDataPicasaWebService *service,
                     GCancellable *cancellable,
                     GError **error)
@@ -873,7 +878,7 @@ query_gdata_photos (GomAccountMinerJob *job,
     {
       GDataPicasaWebAlbum *album = GDATA_PICASAWEB_ALBUM (l->data);
 
-      account_miner_job_process_album (job, service, album, cancellable, error);
+      account_miner_job_process_album (job, connection, service, album, cancellable, error);
 
       if (*error != NULL)
         {
@@ -890,6 +895,7 @@ query_gdata_photos (GomAccountMinerJob *job,
 
 static void
 query_gdata (GomAccountMinerJob *job,
+             TrackerSparqlConnection *connection,
              GCancellable *cancellable,
              GError **error)
 {
@@ -897,11 +903,11 @@ query_gdata (GomAccountMinerJob *job,
 
   service = g_hash_table_lookup (job->services, "documents");
   if (service != NULL)
-    query_gdata_documents (job, GDATA_DOCUMENTS_SERVICE (service), cancellable, error);
+    query_gdata_documents (job, connection, GDATA_DOCUMENTS_SERVICE (service), cancellable, error);
 
   service = g_hash_table_lookup (job->services, "photos");
   if (service != NULL)
-    query_gdata_photos (job, GDATA_PICASAWEB_SERVICE (service), cancellable, error);
+    query_gdata_photos (job, connection, GDATA_PICASAWEB_SERVICE (service), cancellable, error);
 }
 
 static GHashTable *
diff --git a/src/gom-media-server-miner.c b/src/gom-media-server-miner.c
index 869ee41..db5e5ff 100644
--- a/src/gom-media-server-miner.c
+++ b/src/gom-media-server-miner.c
@@ -40,6 +40,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GomMediaServerMiner, gom_media_server_miner, GOM_TYP
 
 static gboolean
 account_miner_job_process_photo (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  GomDlnaPhotoItem *photo,
                                  GCancellable *cancellable,
                                  GError **error)
@@ -59,7 +60,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   g_hash_table_remove (job->previous_resources, identifier);
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -68,7 +69,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
   if (*error != NULL)
@@ -76,7 +77,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
   /* the resource changed - just set all the properties again */
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", photo->url);
@@ -85,7 +86,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:mimeType", photo->mimetype);
@@ -94,7 +95,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:title", photo->name);
@@ -116,6 +117,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
 
 static void
 query_media_server (GomAccountMinerJob *job,
+                    TrackerSparqlConnection *connection,
                     GCancellable *cancellable,
                     GError **error)
 {
@@ -151,7 +153,7 @@ query_media_server (GomAccountMinerJob *job,
     {
       GomDlnaPhotoItem *photo = (GomDlnaPhotoItem *) l->data;
 
-      account_miner_job_process_photo (job, photo, cancellable, &local_error);
+      account_miner_job_process_photo (job, connection, photo, cancellable, &local_error);
       if (local_error != NULL)
         {
           g_warning ("Unable to process photo: %s", local_error->message);
diff --git a/src/gom-miner.c b/src/gom-miner.c
index 37369ce..9c28236 100644
--- a/src/gom-miner.c
+++ b/src/gom-miner.c
@@ -292,7 +292,7 @@ gom_account_miner_job_query (GomAccountMinerJob *job,
   GCancellable *cancellable;
 
   cancellable = g_task_get_cancellable (job->task);
-  miner_class->query (job, cancellable, error);
+  miner_class->query (job, job->connection, cancellable, error);
 }
 
 static void
diff --git a/src/gom-miner.h b/src/gom-miner.h
index 2683110..921d857 100644
--- a/src/gom-miner.h
+++ b/src/gom-miner.h
@@ -91,6 +91,7 @@ struct _GomMinerClass
                                    GoaObject *object);
 
   void (*query) (GomAccountMinerJob *job,
+                 TrackerSparqlConnection *connection,
                  GCancellable *cancellable,
                  GError **error);
 };
diff --git a/src/gom-owncloud-miner.c b/src/gom-owncloud-miner.c
index 0796b0d..70de1c4 100644
--- a/src/gom-owncloud-miner.c
+++ b/src/gom-owncloud-miner.c
@@ -51,6 +51,7 @@ typedef struct {
 
 static gboolean
 account_miner_job_process_file (GomAccountMinerJob *job,
+                                TrackerSparqlConnection *connection,
                                 GFile *file,
                                 GFileInfo *info,
                                 GFile *parent,
@@ -94,7 +95,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
     goto out;
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -103,7 +104,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
 
@@ -113,7 +114,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
   g_file_info_get_modification_time (info, &tv);
   modification_time = g_date_time_new_from_timeval_local (&tv);
   new_mtime = g_date_time_to_unix (modification_time);
-  mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
+  mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
                                             resource_exists, identifier, resource,
                                             cancellable, error);
 
@@ -128,7 +129,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
 
   /* the resource changed - just set all the properties again */
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", uri);
@@ -151,7 +152,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
           parent_id = g_checksum_get_string (checksum);
           parent_identifier = g_strconcat ("gd:collection:owncloud:", parent_id, NULL);
           parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
-            (job->connection, cancellable, error,
+            (connection, cancellable, error,
              NULL,
              job->datasource_urn, parent_identifier,
              "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
@@ -163,7 +164,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
             goto out;
 
           gom_tracker_sparql_connection_insert_or_replace_triple
-            (job->connection,
+            (connection,
              cancellable, error,
              job->datasource_urn, resource,
              "nie:isPartOf", parent_resource_urn);
@@ -177,7 +178,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
       if (mime != NULL)
         {
           gom_tracker_sparql_connection_insert_or_replace_triple
-            (job->connection,
+            (connection,
              cancellable, error,
              job->datasource_urn, resource,
              "nie:mimeType", mime);
@@ -189,7 +190,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
 
   display_name = g_file_info_get_display_name (info);
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nfo:fileName", display_name);
@@ -212,6 +213,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
 
 static void
 account_miner_job_traverse_dir (GomAccountMinerJob *job,
+                                TrackerSparqlConnection *connection,
                                 GFile *dir,
                                 gboolean is_root,
                                 GCancellable *cancellable,
@@ -244,7 +246,7 @@ account_miner_job_traverse_dir (GomAccountMinerJob *job,
 
       if (type == G_FILE_TYPE_REGULAR || type == G_FILE_TYPE_DIRECTORY)
         {
-          account_miner_job_process_file (job, child, info, is_root ? NULL : dir, cancellable, &local_error);
+          account_miner_job_process_file (job, connection, child, info, is_root ? NULL : dir, cancellable, 
&local_error);
           if (local_error != NULL)
             {
               uri = g_file_get_uri (child);
@@ -256,7 +258,7 @@ account_miner_job_traverse_dir (GomAccountMinerJob *job,
 
       if (type == G_FILE_TYPE_DIRECTORY)
         {
-          account_miner_job_traverse_dir (job, child, FALSE, cancellable, &local_error);
+          account_miner_job_traverse_dir (job, connection, child, FALSE, cancellable, &local_error);
           if (local_error != NULL)
             {
               uri = g_file_get_uri (child);
@@ -335,6 +337,7 @@ volume_mount_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
 
 static void
 query_owncloud (GomAccountMinerJob *job,
+                TrackerSparqlConnection *connection,
                 GCancellable *cancellable,
                 GError **error)
 {
@@ -412,7 +415,7 @@ query_owncloud (GomAccountMinerJob *job,
     }
 
   root = g_mount_get_root (mount);
-  account_miner_job_traverse_dir (job, root, TRUE, cancellable, error);
+  account_miner_job_traverse_dir (job, connection, root, TRUE, cancellable, error);
 
   g_object_unref (root);
   g_object_unref (mount);
diff --git a/src/gom-zpj-miner.c b/src/gom-zpj-miner.c
index 9a8c331..bccfbc8 100644
--- a/src/gom-zpj-miner.c
+++ b/src/gom-zpj-miner.c
@@ -35,6 +35,7 @@ G_DEFINE_TYPE (GomZpjMiner, gom_zpj_miner, GOM_TYPE_MINER)
 
 static gboolean
 account_miner_job_process_entry (GomAccountMinerJob *job,
+                                 TrackerSparqlConnection *connection,
                                  ZpjSkydriveEntry *entry,
                                  GCancellable *cancellable,
                                  GError **error)
@@ -64,7 +65,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     class = "nfo:DataContainer";
 
   resource = gom_tracker_sparql_connection_ensure_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      &resource_exists,
      job->datasource_urn, identifier,
@@ -73,7 +74,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
   if (*error != NULL)
     goto out;
 
-  gom_tracker_update_datasource (job->connection, job->datasource_urn,
+  gom_tracker_update_datasource (connection, job->datasource_urn,
                                  resource_exists, identifier, resource,
                                  cancellable, error);
 
@@ -82,7 +83,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
   updated_time = zpj_skydrive_entry_get_updated_time (entry);
   new_mtime = g_date_time_to_unix (updated_time);
-  mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
+  mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
                                             resource_exists, identifier, resource,
                                             cancellable, error);
 
@@ -97,7 +98,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
   /* the resource changed - just set all the properties again */
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:url", identifier);
@@ -114,7 +115,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
       parent_id = zpj_skydrive_entry_get_parent_id (entry);
       parent_identifier = g_strconcat ("gd:collection:windows-live:skydrive:", parent_id, NULL);
       parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
-        (job->connection, cancellable, error,
+        (connection, cancellable, error,
          NULL,
          job->datasource_urn, parent_identifier,
          "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
@@ -124,7 +125,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
         goto out;
 
       gom_tracker_sparql_connection_insert_or_replace_triple
-        (job->connection,
+        (connection,
          cancellable, error,
          job->datasource_urn, resource,
          "nie:isPartOf", parent_resource_urn);
@@ -137,7 +138,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
       if (mime != NULL)
         {
           gom_tracker_sparql_connection_insert_or_replace_triple
-            (job->connection,
+            (connection,
              cancellable, error,
              job->datasource_urn, resource,
              "nie:mimeType", mime);
@@ -149,7 +150,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     }
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:description", zpj_skydrive_entry_get_description (entry));
@@ -158,7 +159,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nfo:fileName", name);
@@ -167,7 +168,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   contact_resource = gom_tracker_utils_ensure_contact_resource
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, zpj_skydrive_entry_get_from_name (entry));
 
@@ -175,7 +176,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
     goto out;
 
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nco:creator", contact_resource);
@@ -187,7 +188,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
   created_time = zpj_skydrive_entry_get_created_time (entry);
   date = gom_iso8601_from_timestamp (g_date_time_to_unix (created_time));
   gom_tracker_sparql_connection_insert_or_replace_triple
-    (job->connection,
+    (connection,
      cancellable, error,
      job->datasource_urn, resource,
      "nie:contentCreated", date);
@@ -208,6 +209,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
 
 static void
 account_miner_job_traverse_folder (GomAccountMinerJob *job,
+                                   TrackerSparqlConnection *connection,
                                    const gchar *folder_id,
                                    GCancellable *cancellable,
                                    GError **error)
@@ -243,14 +245,14 @@ account_miner_job_traverse_folder (GomAccountMinerJob *job,
 
       if (ZPJ_IS_SKYDRIVE_FOLDER (entry))
         {
-          account_miner_job_traverse_folder (job, id, cancellable, error);
+          account_miner_job_traverse_folder (job, connection, id, cancellable, error);
           if (*error != NULL)
             goto out;
         }
       else if (ZPJ_IS_SKYDRIVE_PHOTO (entry))
         continue;
 
-      account_miner_job_process_entry (job, entry, cancellable, error);
+      account_miner_job_process_entry (job, connection, entry, cancellable, error);
 
       if (*error != NULL)
         {
@@ -266,10 +268,12 @@ account_miner_job_traverse_folder (GomAccountMinerJob *job,
 
 static void
 query_zpj (GomAccountMinerJob *job,
+           TrackerSparqlConnection *connection,
            GCancellable *cancellable,
            GError **error)
 {
   account_miner_job_traverse_folder (job,
+                                     connection,
                                      ZPJ_SKYDRIVE_FOLDER_SKYDRIVE,
                                      cancellable,
                                      error);


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