[gnome-online-miners/wip/rishi/insert-share: 10/24] src: Drop the GCancellable member from GomAccountMinerJob
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-miners/wip/rishi/insert-share: 10/24] src: Drop the GCancellable member from GomAccountMinerJob
- Date: Mon, 5 Sep 2016 15:03:44 +0000 (UTC)
commit 4f6797b93bc5b43d219900bc60fc8d89165095dd
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Sep 2 17:06:21 2016 +0200
src: Drop the GCancellable member from GomAccountMinerJob
There is no need to track it separately because we can get it from the
GTask.
https://bugzilla.gnome.org/show_bug.cgi?id=770889
src/gom-facebook-miner.c | 43 +++++++++--------
src/gom-flickr-miner.c | 43 +++++++++-------
src/gom-gdata-miner.c | 112 ++++++++++++++++++++++--------------------
src/gom-media-server-miner.c | 14 +++--
src/gom-miner.c | 31 ++++++++----
src/gom-miner.h | 2 +-
src/gom-owncloud-miner.c | 31 ++++++-----
src/gom-zpj-miner.c | 34 +++++++------
8 files changed, 173 insertions(+), 137 deletions(-)
---
diff --git a/src/gom-facebook-miner.c b/src/gom-facebook-miner.c
index 3c90b80..86899ab 100644
--- a/src/gom-facebook-miner.c
+++ b/src/gom-facebook-miner.c
@@ -38,6 +38,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
GFBGraphPhoto *photo,
const gchar *parent_resource_urn,
const gchar *creator,
+ GCancellable *cancellable,
GError **error)
{
GTimeVal new_mtime;
@@ -64,7 +65,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class, NULL);
@@ -74,7 +75,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -86,7 +87,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
{
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime.tv_sec,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", photo_link);
@@ -109,7 +110,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:isPartOf", parent_resource_urn);
@@ -118,7 +119,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:mimeType", "image/jpeg");
@@ -127,7 +128,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:title", photo_name);
@@ -136,7 +137,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
contact_resource = gom_tracker_utils_ensure_contact_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, creator);
if (*error != NULL)
@@ -144,7 +145,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
@@ -154,7 +155,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", photo_created_time);
@@ -178,6 +179,7 @@ static gboolean
account_miner_job_process_album (GomAccountMinerJob *job,
GFBGraphAlbum *album,
const gchar *creator,
+ GCancellable *cancellable,
GError **error)
{
const gchar *album_id;
@@ -208,7 +210,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class,
@@ -219,7 +221,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -230,7 +232,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", album_link);
@@ -239,7 +241,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:description", album_description);
@@ -248,7 +250,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:title", album_name);
@@ -257,7 +259,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
contact_resource = gom_tracker_utils_ensure_contact_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, creator);
if (*error != NULL)
@@ -265,7 +267,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
g_free (contact_resource);
@@ -275,7 +277,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", album_created_time);
@@ -295,7 +297,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, &local_error);
+ account_miner_job_process_photo (job, photo, resource, creator, cancellable, &local_error);
if (local_error != NULL)
{
const gchar *photo_id;
@@ -320,6 +322,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
static void
query_facebook (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error)
{
GFBGraphAuthorizer *authorizer;
@@ -354,7 +357,7 @@ query_facebook (GomAccountMinerJob *job,
{
GFBGraphAlbum *album = GFBGRAPH_ALBUM (l->data);
- account_miner_job_process_album (job, album, me_name, &local_error);
+ account_miner_job_process_album (job, 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 8d1d5ed..bc0a1a6 100644
--- a/src/gom-flickr-miner.c
+++ b/src/gom-flickr-miner.c
@@ -48,13 +48,16 @@ typedef struct {
typedef struct {
FlickrEntry *parent_entry;
+ GCancellable *cancellable;
GMainLoop *loop;
GomAccountMinerJob *job;
GrlSource *source;
const gchar *source_id;
} SyncData;
-static void account_miner_job_browse_container (GomAccountMinerJob *job, FlickrEntry *entry);
+static void account_miner_job_browse_container (GomAccountMinerJob *job,
+ FlickrEntry *entry,
+ GCancellable *cancellable);
static FlickrEntry *
create_entry (GrlMedia *media, GrlMedia *parent)
@@ -97,6 +100,7 @@ static gboolean
account_miner_job_process_entry (GomAccountMinerJob *job,
OpType op_type,
FlickrEntry *entry,
+ GCancellable *cancellable,
GError **error)
{
GDateTime *created_time, *modification_date;
@@ -128,7 +132,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class, NULL);
@@ -138,7 +142,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -151,7 +155,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, job->cancellable, error,
+ (job->connection, cancellable, error,
NULL,
job->datasource_urn, parent_identifier,
"nfo:RemoteDataObject", "nfo:DataContainer", NULL);
@@ -162,7 +166,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:isPartOf", parent_resource_urn);
g_free (parent_resource_urn);
@@ -173,7 +177,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:title", grl_media_get_title (entry->media));
@@ -190,7 +194,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
new_mtime = g_date_time_to_unix (modification_date);
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -207,7 +211,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", date);
g_free (date);
@@ -219,7 +223,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", url);
@@ -228,7 +232,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:description", grl_media_get_description (entry->media));
@@ -240,7 +244,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
{
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:mimeType", mime);
g_free (mime);
@@ -251,7 +255,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
contact_resource = gom_tracker_utils_ensure_contact_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, grl_media_get_author (entry->media));
if (*error != NULL)
@@ -259,7 +263,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
g_free (contact_resource);
@@ -300,7 +304,7 @@ 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, &local_error);
+ account_miner_job_process_entry (data->job, OP_CREATE_HIEARCHY, entry, data->cancellable,
&local_error);
if (local_error != NULL)
{
g_warning ("Unable to process entry %p: %s", media, local_error->message);
@@ -318,7 +322,7 @@ source_browse_cb (GrlSource *source,
}
static void
-account_miner_job_browse_container (GomAccountMinerJob *job, FlickrEntry *entry)
+account_miner_job_browse_container (GomAccountMinerJob *job, FlickrEntry *entry, GCancellable *cancellable)
{
GMainContext *context;
GrlSource *source;
@@ -326,6 +330,7 @@ account_miner_job_browse_container (GomAccountMinerJob *job, FlickrEntry *entry)
const GList *keys;
SyncData data;
+ data.cancellable = cancellable;
data.parent_entry = entry;
data.job = job;
@@ -374,7 +379,7 @@ source_search_cb (GrlSource *source,
FlickrEntry *entry;
entry = create_entry (media, NULL);
- account_miner_job_process_entry (data->job, OP_FETCH_ALL, entry, &local_error);
+ account_miner_job_process_entry (data->job, OP_FETCH_ALL, entry, data->cancellable, &local_error);
if (local_error != NULL)
{
g_warning ("Unable to process entry %p: %s", media, local_error->message);
@@ -390,6 +395,7 @@ source_search_cb (GrlSource *source,
static void
query_flickr (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error)
{
GomFlickrMiner *self = GOM_FLICKR_MINER (job->miner);
@@ -417,6 +423,7 @@ query_flickr (GomAccountMinerJob *job,
* each photo to any set that it might be a part of.
*/
+ data.cancellable = cancellable;
data.job = job;
context = g_main_context_new ();
g_main_context_push_thread_default (context);
@@ -433,13 +440,13 @@ query_flickr (GomAccountMinerJob *job,
g_main_context_unref (context);
entry = create_entry (NULL, NULL);
- account_miner_job_browse_container (job, entry);
+ account_miner_job_browse_container (job, 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);
+ account_miner_job_browse_container (job, entry, cancellable);
free_entry (entry);
}
}
diff --git a/src/gom-gdata-miner.c b/src/gom-gdata-miner.c
index 7695d78..7f83407 100644
--- a/src/gom-gdata-miner.c
+++ b/src/gom-gdata-miner.c
@@ -58,6 +58,7 @@ static gboolean
account_miner_job_process_entry (GomAccountMinerJob *job,
GDataDocumentsService *service,
GDataDocumentsEntry *doc_entry,
+ GCancellable *cancellable,
GError **error)
{
GDataEntry *entry = GDATA_ENTRY (doc_entry);
@@ -114,7 +115,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class, NULL);
@@ -124,7 +125,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -132,7 +133,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
new_mtime = gdata_entry_get_updated (entry);
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -149,7 +150,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", alternate_uri);
@@ -164,7 +165,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:mimeType", mimetype_override);
@@ -181,7 +182,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, job->cancellable, error,
+ (job->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,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:isPartOf", parent_resource_urn);
g_free (parent_resource_urn);
@@ -214,7 +215,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_toggle_favorite
(job->connection,
- job->cancellable, error,
+ cancellable, error,
resource, starred);
if (*error != NULL)
@@ -222,7 +223,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:description", gdata_entry_get_summary (entry));
@@ -231,7 +232,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ 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,
- job->cancellable, error,
+ cancellable, error,
gdata_author_get_email_address (author),
gdata_author_get_name (author));
@@ -255,7 +256,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
@@ -267,7 +268,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
access_rules = gdata_access_handler_get_rules (GDATA_ACCESS_HANDLER (entry),
GDATA_SERVICE (service),
- job->cancellable,
+ cancellable,
NULL, NULL, error);
if (*error != NULL)
@@ -291,13 +292,13 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
continue;
contact_resource = gom_tracker_utils_ensure_contact_resource (job->connection,
- job->cancellable, error,
+ cancellable, error,
scope_value,
"");
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ 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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", date);
g_free (date);
@@ -335,6 +336,7 @@ static gboolean
account_miner_job_process_photo (GomAccountMinerJob *job,
GDataPicasaWebFile *photo,
const gchar *parent_resource_urn,
+ GCancellable *cancellable,
GError **error)
{
GList *l, *media_contents;
@@ -390,7 +392,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", "nmm:Photo", NULL);
@@ -400,7 +402,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -410,7 +412,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
new_mtime = gdata_entry_get_updated (GDATA_ENTRY (photo));
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -426,7 +428,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
alternate_uri = gdata_link_get_uri (alternate);
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", alternate_uri);
@@ -436,7 +438,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:description", summary);
@@ -445,7 +447,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:isPartOf", parent_resource_urn);
@@ -455,7 +457,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:mimeType", mime);
@@ -465,7 +467,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:title", title);
@@ -476,7 +478,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
email = generate_fake_email_from_fullname (credit);
contact_resource = gom_tracker_utils_ensure_contact_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
email, credit);
g_free (email);
@@ -485,7 +487,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
@@ -496,7 +498,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nmm:exposureTime", exposure);
g_free (exposure);
@@ -507,7 +509,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nmm:focalLength", focal_length);
g_free (focal_length);
@@ -518,7 +520,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nmm:fnumber", fstop);
g_free (fstop);
@@ -529,7 +531,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nmm:isoSpeed", iso);
g_free (iso);
@@ -540,7 +542,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nmm:flash", flash ? flash_on : flash_off);
@@ -553,7 +555,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
if (make != NULL || model != NULL)
{
equipment_resource = gom_tracker_utils_ensure_equipment_resource (job->connection,
- job->cancellable,
+ cancellable,
error,
make,
model);
@@ -563,7 +565,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nfo:equipment", equipment_resource);
@@ -574,7 +576,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nfo:width", width);
g_free (width);
@@ -585,7 +587,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nfo:height", height);
g_free (height);
@@ -597,7 +599,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
date = gom_iso8601_from_timestamp (timestamp / 1000);
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", date);
g_free (date);
@@ -620,6 +622,7 @@ static gboolean
account_miner_job_process_album (GomAccountMinerJob *job,
GDataPicasaWebService *service,
GDataPicasaWebAlbum *album,
+ GCancellable *cancellable,
GError **error)
{
GDataFeed *feed = NULL;
@@ -649,7 +652,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", "nfo:DataContainer",
@@ -661,7 +664,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_update_datasource
(job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -672,7 +675,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
new_mtime = gdata_entry_get_updated (GDATA_ENTRY (album));
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -688,7 +691,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
alternate_uri = gdata_link_get_uri (alternate);
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", alternate_uri);
@@ -698,7 +701,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:description", summary);
@@ -708,7 +711,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:title", title);
@@ -719,7 +722,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
email = generate_fake_email_from_fullname (nickname);
contact_resource = gom_tracker_utils_ensure_contact_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
email, nickname);
g_free (email);
@@ -728,7 +731,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
g_free (contact_resource);
@@ -740,7 +743,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
date = gom_iso8601_from_timestamp (timestamp / 1000);
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", date);
g_free (date);
@@ -752,7 +755,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
query = gdata_picasaweb_query_new (NULL);
gdata_picasaweb_query_set_image_size (query, "d");
feed = gdata_picasaweb_service_query_files (service, album, GDATA_QUERY (query),
- job->cancellable, NULL, NULL, error);
+ cancellable, NULL, NULL, error);
g_object_unref (query);
@@ -764,7 +767,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
{
GDataPicasaWebFile *file = GDATA_PICASAWEB_FILE (l->data);
- account_miner_job_process_photo (job, file, resource, error);
+ account_miner_job_process_photo (job, file, resource, cancellable, error);
if (*error != NULL)
{
@@ -790,6 +793,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
static void
query_gdata_documents (GomAccountMinerJob *job,
GDataDocumentsService *service,
+ GCancellable *cancellable,
GError **error)
{
GDataDocumentsQuery *query = NULL;
@@ -807,7 +811,7 @@ query_gdata_documents (GomAccountMinerJob *job,
local_error = NULL;
feed = gdata_documents_service_query_documents
(service, query,
- job->cancellable, NULL, NULL, &local_error);
+ cancellable, NULL, NULL, &local_error);
if (local_error != NULL)
{
if (succeeded_once)
@@ -832,7 +836,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, &local_error);
+ account_miner_job_process_entry (job, service, l->data, cancellable, &local_error);
if (local_error != NULL)
{
@@ -853,12 +857,13 @@ query_gdata_documents (GomAccountMinerJob *job,
static void
query_gdata_photos (GomAccountMinerJob *job,
GDataPicasaWebService *service,
+ GCancellable *cancellable,
GError **error)
{
GDataFeed *feed;
GList *albums, *l;
- feed = gdata_picasaweb_service_query_all_albums (service, NULL, NULL, job->cancellable, NULL, NULL, error);
+ feed = gdata_picasaweb_service_query_all_albums (service, NULL, NULL, cancellable, NULL, NULL, error);
if (feed == NULL)
return;
@@ -868,7 +873,7 @@ query_gdata_photos (GomAccountMinerJob *job,
{
GDataPicasaWebAlbum *album = GDATA_PICASAWEB_ALBUM (l->data);
- account_miner_job_process_album (job, service, album, error);
+ account_miner_job_process_album (job, service, album, cancellable, error);
if (*error != NULL)
{
@@ -885,17 +890,18 @@ query_gdata_photos (GomAccountMinerJob *job,
static void
query_gdata (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error)
{
gpointer service;
service = g_hash_table_lookup (job->services, "documents");
if (service != NULL)
- query_gdata_documents (job, GDATA_DOCUMENTS_SERVICE (service), error);
+ query_gdata_documents (job, 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), error);
+ query_gdata_photos (job, 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 2e15573..869ee41 100644
--- a/src/gom-media-server-miner.c
+++ b/src/gom-media-server-miner.c
@@ -41,6 +41,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GomMediaServerMiner, gom_media_server_miner, GOM_TYP
static gboolean
account_miner_job_process_photo (GomAccountMinerJob *job,
GomDlnaPhotoItem *photo,
+ GCancellable *cancellable,
GError **error)
{
const gchar *photo_id;
@@ -59,7 +60,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class, NULL);
@@ -69,14 +70,14 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
/* the resource changed - just set all the properties again */
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", photo->url);
@@ -85,7 +86,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:mimeType", photo->mimetype);
@@ -94,7 +95,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:title", photo->name);
@@ -115,6 +116,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
static void
query_media_server (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error)
{
GomMediaServerMiner *self = GOM_MEDIA_SERVER_MINER (job->miner);
@@ -149,7 +151,7 @@ query_media_server (GomAccountMinerJob *job,
{
GomDlnaPhotoItem *photo = (GomDlnaPhotoItem *) l->data;
- account_miner_job_process_photo (job, photo, &local_error);
+ account_miner_job_process_photo (job, 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 37f15c6..ce93e9a 100644
--- a/src/gom-miner.c
+++ b/src/gom-miner.c
@@ -178,9 +178,12 @@ static void
gom_account_miner_job_ensure_datasource (GomAccountMinerJob *job,
GError **error)
{
+ GCancellable *cancellable;
GString *datasource_insert;
GomMinerClass *klass = GOM_MINER_GET_CLASS (job->miner);
+ cancellable = g_task_get_cancellable (job->task);
+
datasource_insert = g_string_new (NULL);
g_string_append_printf (datasource_insert,
"INSERT OR REPLACE INTO <%s> {"
@@ -194,7 +197,7 @@ gom_account_miner_job_ensure_datasource (GomAccountMinerJob *job,
tracker_sparql_connection_update (job->connection,
datasource_insert->str,
G_PRIORITY_DEFAULT,
- job->cancellable,
+ cancellable,
error);
g_string_free (datasource_insert, TRUE);
@@ -204,9 +207,12 @@ static void
gom_account_miner_job_query_existing (GomAccountMinerJob *job,
GError **error)
{
+ GCancellable *cancellable;
GString *select;
TrackerSparqlCursor *cursor;
+ cancellable = g_task_get_cancellable (job->task);
+
select = g_string_new (NULL);
g_string_append_printf (select,
"SELECT ?urn nao:identifier(?urn) WHERE { ?urn nie:dataSource <%s> }",
@@ -214,14 +220,14 @@ gom_account_miner_job_query_existing (GomAccountMinerJob *job,
cursor = tracker_sparql_connection_query (job->connection,
select->str,
- job->cancellable,
+ cancellable,
error);
g_string_free (select, TRUE);
if (cursor == NULL)
return;
- while (tracker_sparql_cursor_next (cursor, job->cancellable, error))
+ while (tracker_sparql_cursor_next (cursor, cancellable, error))
{
g_hash_table_insert (job->previous_resources,
g_strdup (tracker_sparql_cursor_get_string (cursor, 1, NULL)),
@@ -246,8 +252,11 @@ static void
gom_account_miner_job_cleanup_previous (GomAccountMinerJob *job,
GError **error)
{
+ GCancellable *cancellable;
GString *delete;
+ cancellable = g_task_get_cancellable (job->task);
+
delete = g_string_new (NULL);
g_string_append (delete, "DELETE { ");
@@ -263,7 +272,7 @@ gom_account_miner_job_cleanup_previous (GomAccountMinerJob *job,
tracker_sparql_connection_update (job->connection,
delete->str,
G_PRIORITY_DEFAULT,
- job->cancellable,
+ cancellable,
error);
g_string_free (delete, TRUE);
@@ -274,8 +283,10 @@ gom_account_miner_job_query (GomAccountMinerJob *job,
GError **error)
{
GomMinerClass *miner_class = GOM_MINER_GET_CLASS (job->miner);
+ GCancellable *cancellable;
- miner_class->query (job, error);
+ cancellable = g_task_get_cancellable (job->task);
+ miner_class->query (job, cancellable, error);
}
static void
@@ -319,9 +330,13 @@ gom_account_miner_job_process_async (GomAccountMinerJob *job,
GAsyncReadyCallback callback,
gpointer user_data)
{
+ GCancellable *cancellable;
+
g_assert (job->task == NULL);
- job->task = g_task_new (NULL, job->cancellable, callback, user_data);
+ cancellable = g_task_get_cancellable (job->parent_task);
+
+ job->task = g_task_new (NULL, cancellable, callback, user_data);
g_task_set_source_tag (job->task, gom_account_miner_job_process_async);
g_task_set_task_data (job->task, job, NULL);
g_task_run_in_thread (job->task, gom_account_miner_job);
@@ -346,7 +361,6 @@ gom_account_miner_job_new (GomMiner *self,
GoaObject *object,
GTask *parent_task)
{
- GCancellable *cancellable;
GomAccountMinerJob *retval;
GoaAccount *account;
GomMinerClass *miner_class = GOM_MINER_GET_CLASS (self);
@@ -354,12 +368,9 @@ gom_account_miner_job_new (GomMiner *self,
account = goa_object_get_account (object);
g_assert (account != NULL);
- cancellable = g_task_get_cancellable (parent_task);
-
retval = g_slice_new0 (GomAccountMinerJob);
retval->miner = g_object_ref (self);
retval->parent_task = g_object_ref (parent_task);
- retval->cancellable = g_object_ref (cancellable);
retval->account = account;
retval->connection = g_object_ref (self->priv->connection);
retval->previous_resources =
diff --git a/src/gom-miner.h b/src/gom-miner.h
index ed6e840..2683110 100644
--- a/src/gom-miner.h
+++ b/src/gom-miner.h
@@ -66,7 +66,6 @@ typedef struct {
GHashTable *services;
GTask *task;
GTask *parent_task;
- GCancellable *cancellable;
GHashTable *previous_resources;
gchar *datasource_urn;
@@ -92,6 +91,7 @@ struct _GomMinerClass
GoaObject *object);
void (*query) (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error);
};
diff --git a/src/gom-owncloud-miner.c b/src/gom-owncloud-miner.c
index 6bf8683..0796b0d 100644
--- a/src/gom-owncloud-miner.c
+++ b/src/gom-owncloud-miner.c
@@ -54,6 +54,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
GFile *file,
GFileInfo *info,
GFile *parent,
+ GCancellable *cancellable,
GError **error)
{
GChecksum *checksum = NULL;
@@ -94,7 +95,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class, NULL);
@@ -104,7 +105,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -114,7 +115,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
new_mtime = g_date_time_to_unix (modification_time);
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", uri);
@@ -150,7 +151,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, job->cancellable, error,
+ (job->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,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:isPartOf", parent_resource_urn);
g_free (parent_resource_urn);
@@ -177,7 +178,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
{
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ 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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nfo:fileName", display_name);
@@ -213,6 +214,7 @@ static void
account_miner_job_traverse_dir (GomAccountMinerJob *job,
GFile *dir,
gboolean is_root,
+ GCancellable *cancellable,
GError **error)
{
GError *local_error = NULL;
@@ -224,12 +226,12 @@ account_miner_job_traverse_dir (GomAccountMinerJob *job,
enumerator = g_file_enumerate_children (dir,
FILE_ATTRIBUTES,
G_FILE_QUERY_INFO_NONE,
- job->cancellable,
+ cancellable,
&local_error);
if (local_error != NULL)
goto out;
- while ((info = g_file_enumerator_next_file (enumerator, job->cancellable, &local_error)) != NULL)
+ while ((info = g_file_enumerator_next_file (enumerator, cancellable, &local_error)) != NULL)
{
GFile *child;
GFileType type;
@@ -242,7 +244,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, &local_error);
+ account_miner_job_process_file (job, child, info, is_root ? NULL : dir, cancellable, &local_error);
if (local_error != NULL)
{
uri = g_file_get_uri (child);
@@ -254,7 +256,7 @@ account_miner_job_traverse_dir (GomAccountMinerJob *job,
if (type == G_FILE_TYPE_DIRECTORY)
{
- account_miner_job_traverse_dir (job, child, FALSE, &local_error);
+ account_miner_job_traverse_dir (job, child, FALSE, cancellable, &local_error);
if (local_error != NULL)
{
uri = g_file_get_uri (child);
@@ -333,6 +335,7 @@ volume_mount_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
static void
query_owncloud (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error)
{
GomOwncloudMiner *self = GOM_OWNCLOUD_MINER (job->miner);
@@ -395,7 +398,7 @@ query_owncloud (GomAccountMinerJob *job,
g_main_context_push_thread_default (context);
data.loop = g_main_loop_new (context, FALSE);
- g_volume_mount (volume, G_MOUNT_MOUNT_NONE, NULL, job->cancellable, volume_mount_cb, &data);
+ g_volume_mount (volume, G_MOUNT_MOUNT_NONE, NULL, cancellable, volume_mount_cb, &data);
g_main_loop_run (data.loop);
g_main_loop_unref (data.loop);
@@ -409,7 +412,7 @@ query_owncloud (GomAccountMinerJob *job,
}
root = g_mount_get_root (mount);
- account_miner_job_traverse_dir (job, root, TRUE, error);
+ account_miner_job_traverse_dir (job, 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 95490f9..9a8c331 100644
--- a/src/gom-zpj-miner.c
+++ b/src/gom-zpj-miner.c
@@ -36,6 +36,7 @@ G_DEFINE_TYPE (GomZpjMiner, gom_zpj_miner, GOM_TYPE_MINER)
static gboolean
account_miner_job_process_entry (GomAccountMinerJob *job,
ZpjSkydriveEntry *entry,
+ GCancellable *cancellable,
GError **error)
{
GDateTime *created_time, *updated_time;
@@ -64,7 +65,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
resource = gom_tracker_sparql_connection_ensure_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
&resource_exists,
job->datasource_urn, identifier,
"nfo:RemoteDataObject", class, NULL);
@@ -74,7 +75,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_update_datasource (job->connection, job->datasource_urn,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -83,7 +84,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
new_mtime = g_date_time_to_unix (updated_time);
mtime_changed = gom_tracker_update_mtime (job->connection, new_mtime,
resource_exists, identifier, resource,
- job->cancellable, error);
+ cancellable, error);
if (*error != NULL)
goto out;
@@ -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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:url", identifier);
@@ -113,7 +114,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, job->cancellable, error,
+ (job->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,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:isPartOf", parent_resource_urn);
g_free (parent_resource_urn);
@@ -137,7 +138,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
{
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:mimeType", mime);
g_free (mime);
@@ -149,7 +150,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ 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,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nfo:fileName", name);
@@ -167,7 +168,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
contact_resource = gom_tracker_utils_ensure_contact_resource
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, zpj_skydrive_entry_get_from_name (entry));
if (*error != NULL)
@@ -175,7 +176,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
gom_tracker_sparql_connection_insert_or_replace_triple
(job->connection,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nco:creator", contact_resource);
g_free (contact_resource);
@@ -187,7 +188,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,
- job->cancellable, error,
+ cancellable, error,
job->datasource_urn, resource,
"nie:contentCreated", date);
g_free (date);
@@ -208,6 +209,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
static void
account_miner_job_traverse_folder (GomAccountMinerJob *job,
const gchar *folder_id,
+ GCancellable *cancellable,
GError **error)
{
GList *entries = NULL, *l;
@@ -226,7 +228,7 @@ account_miner_job_traverse_folder (GomAccountMinerJob *job,
entries = zpj_skydrive_list_folder_id (skydrive,
folder_id,
- job->cancellable,
+ cancellable,
error);
if (*error != NULL)
@@ -241,14 +243,14 @@ account_miner_job_traverse_folder (GomAccountMinerJob *job,
if (ZPJ_IS_SKYDRIVE_FOLDER (entry))
{
- account_miner_job_traverse_folder (job, id, error);
+ account_miner_job_traverse_folder (job, id, cancellable, error);
if (*error != NULL)
goto out;
}
else if (ZPJ_IS_SKYDRIVE_PHOTO (entry))
continue;
- account_miner_job_process_entry (job, entry, error);
+ account_miner_job_process_entry (job, entry, cancellable, error);
if (*error != NULL)
{
@@ -264,10 +266,12 @@ account_miner_job_traverse_folder (GomAccountMinerJob *job,
static void
query_zpj (GomAccountMinerJob *job,
+ GCancellable *cancellable,
GError **error)
{
account_miner_job_traverse_folder (job,
ZPJ_SKYDRIVE_FOLDER_SKYDRIVE,
+ cancellable,
error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]