[tracker/writeback-refactor-rebase: 17/17] tracker-writeback: Pass cancellable around to also the modules



commit 9ceae4e4640fe26244850e7b07f895a768b18c8f
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Jul 15 14:54:57 2011 +0200

    tracker-writeback: Pass cancellable around to also the modules

 src/tracker-writeback/tracker-writeback-file.c     |   11 ++++++++---
 src/tracker-writeback/tracker-writeback-file.h     |    3 ++-
 src/tracker-writeback/tracker-writeback-module.c   |    8 ++++++--
 src/tracker-writeback/tracker-writeback-module.h   |    6 ++++--
 src/tracker-writeback/tracker-writeback-playlist.c |    6 ++++--
 src/tracker-writeback/tracker-writeback-taglib.c   |    6 ++++--
 src/tracker-writeback/tracker-writeback-xmp.c      |    6 ++++--
 src/tracker-writeback/tracker-writeback.c          |    5 ++++-
 8 files changed, 36 insertions(+), 15 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index 95f7956..69356c3 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -27,7 +27,8 @@
 
 static gboolean tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
                                                         GPtrArray               *values,
-                                                        TrackerSparqlConnection *connection);
+                                                        TrackerSparqlConnection *connection,
+                                                        GCancellable            *cancellable);
 
 G_DEFINE_ABSTRACT_TYPE (TrackerWritebackFile, tracker_writeback_file, TRACKER_TYPE_WRITEBACK)
 
@@ -86,7 +87,8 @@ get_tmp_file (GFile *file)
 static gboolean
 tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
                                         GPtrArray               *values,
-                                        TrackerSparqlConnection *connection)
+                                        TrackerSparqlConnection *connection,
+                                        GCancellable            *cancellable)
 {
 	TrackerWritebackFileClass *writeback_file_class;
 	gboolean retval;
@@ -191,7 +193,10 @@ tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
 		 */
 
 		retval = (writeback_file_class->update_file_metadata) (TRACKER_WRITEBACK_FILE (writeback),
-		                                                       tmp_file, values, connection);
+		                                                       tmp_file,
+		                                                       values,
+		                                                       connection,
+		                                                       cancellable);
 
 		/*
 		 * This timeout value was 3s before, which could have been in
diff --git a/src/tracker-writeback/tracker-writeback-file.h b/src/tracker-writeback/tracker-writeback-file.h
index 9b81813..ca504a9 100644
--- a/src/tracker-writeback/tracker-writeback-file.h
+++ b/src/tracker-writeback/tracker-writeback-file.h
@@ -46,7 +46,8 @@ struct TrackerWritebackFileClass {
 	gboolean              (* update_file_metadata) (TrackerWritebackFile    *writeback_file,
 	                                                GFile                   *file,
 	                                                GPtrArray               *values,
-	                                                TrackerSparqlConnection *connection);
+	                                                TrackerSparqlConnection *connection,
+	                                                GCancellable            *cancellable);
 	const gchar * const * (* content_types)        (TrackerWritebackFile    *writeback_file);
 
 };
diff --git a/src/tracker-writeback/tracker-writeback-module.c b/src/tracker-writeback/tracker-writeback-module.c
index 4ebf731..77026b1 100644
--- a/src/tracker-writeback/tracker-writeback-module.c
+++ b/src/tracker-writeback/tracker-writeback-module.c
@@ -181,13 +181,17 @@ tracker_writeback_init (TrackerWriteback *writeback)
 gboolean
 tracker_writeback_update_metadata (TrackerWriteback        *writeback,
                                    GPtrArray               *values,
-                                   TrackerSparqlConnection *connection)
+                                   TrackerSparqlConnection *connection,
+                                   GCancellable            *cancellable)
 {
 	g_return_val_if_fail (TRACKER_IS_WRITEBACK (writeback), FALSE);
 	g_return_val_if_fail (values != NULL, FALSE);
 
 	if (TRACKER_WRITEBACK_GET_CLASS (writeback)->update_metadata) {
-		return TRACKER_WRITEBACK_GET_CLASS (writeback)->update_metadata (writeback, values, connection);
+		return TRACKER_WRITEBACK_GET_CLASS (writeback)->update_metadata (writeback,
+		                                                                 values,
+		                                                                 connection,
+		                                                                 cancellable);
 	}
 
 	return FALSE;
diff --git a/src/tracker-writeback/tracker-writeback-module.h b/src/tracker-writeback/tracker-writeback-module.h
index b8038a2..e9a4eb3 100644
--- a/src/tracker-writeback/tracker-writeback-module.h
+++ b/src/tracker-writeback/tracker-writeback-module.h
@@ -52,7 +52,8 @@ struct TrackerWritebackClass {
 
 	gboolean (* update_metadata) (TrackerWriteback        *writeback,
 	                              GPtrArray               *values,
-	                              TrackerSparqlConnection *connection);
+	                              TrackerSparqlConnection *connection,
+	                              GCancellable            *cancellable);
 };
 
 struct TrackerWritebackModule {
@@ -73,7 +74,8 @@ struct TrackerWritebackModuleClass {
 GType                   tracker_writeback_get_type          (void) G_GNUC_CONST;
 gboolean                tracker_writeback_update_metadata   (TrackerWriteback        *writeback,
                                                              GPtrArray               *values,
-                                                             TrackerSparqlConnection *connection);
+                                                             TrackerSparqlConnection *connection,
+                                                             GCancellable            *cancellable);
 TrackerMinerManager*    tracker_writeback_get_miner_manager (void);
 
 /* Entry functions to be defined by modules */
diff --git a/src/tracker-writeback/tracker-writeback-playlist.c b/src/tracker-writeback/tracker-writeback-playlist.c
index 1520561..1f80c53 100644
--- a/src/tracker-writeback/tracker-writeback-playlist.c
+++ b/src/tracker-writeback/tracker-writeback-playlist.c
@@ -50,7 +50,8 @@ static GType                tracker_writeback_playlist_get_type     (void) G_GNU
 static gboolean             writeback_playlist_update_file_metadata (TrackerWritebackFile     *wbf,
                                                                      GFile                    *file,
                                                                      GPtrArray                *values,
-                                                                     TrackerSparqlConnection  *connection);
+                                                                     TrackerSparqlConnection  *connection,
+                                                                     GCancellable            *cancellable);
 static const gchar * const *writeback_playlist_content_types        (TrackerWritebackFile     *wbf);
 
 G_DEFINE_DYNAMIC_TYPE (TrackerWritebackPlaylist, tracker_writeback_playlist, TRACKER_TYPE_WRITEBACK_FILE);
@@ -204,7 +205,8 @@ static gboolean
 writeback_playlist_update_file_metadata (TrackerWritebackFile     *writeback_file,
                                          GFile                    *file,
                                          GPtrArray                *values,
-                                         TrackerSparqlConnection  *connection)
+                                         TrackerSparqlConnection  *connection,
+                                         GCancellable            *cancellable)
 {
 	guint n;
 
diff --git a/src/tracker-writeback/tracker-writeback-taglib.c b/src/tracker-writeback/tracker-writeback-taglib.c
index fae733b..c3f4b62 100644
--- a/src/tracker-writeback/tracker-writeback-taglib.c
+++ b/src/tracker-writeback/tracker-writeback-taglib.c
@@ -45,7 +45,8 @@ static GType                tracker_writeback_taglib_get_type         (void) G_G
 static gboolean             writeback_taglib_update_file_metadata     (TrackerWritebackFile    *wbf,
                                                                        GFile                   *file,
                                                                        GPtrArray               *values,
-                                                                       TrackerSparqlConnection *connection);
+                                                                       TrackerSparqlConnection *connection,
+                                                                       GCancellable            *cancellable);
 static const gchar * const *writeback_taglib_content_types            (TrackerWritebackFile    *wbf);
 static gchar*               writeback_taglib_get_artist_name          (TrackerSparqlConnection *connection,
                                                                        const gchar             *urn);
@@ -132,7 +133,8 @@ static gboolean
 writeback_taglib_update_file_metadata (TrackerWritebackFile     *writeback_file,
                                        GFile                    *file,
                                        GPtrArray                *values,
-                                       TrackerSparqlConnection  *connection)
+                                       TrackerSparqlConnection  *connection,
+                                       GCancellable            *cancellable)
 {
 	gboolean ret;
 	gchar *path;
diff --git a/src/tracker-writeback/tracker-writeback-xmp.c b/src/tracker-writeback/tracker-writeback-xmp.c
index fc006b0..d6a67d6 100644
--- a/src/tracker-writeback/tracker-writeback-xmp.c
+++ b/src/tracker-writeback/tracker-writeback-xmp.c
@@ -52,7 +52,8 @@ static GType                tracker_writeback_xmp_get_type     (void) G_GNUC_CON
 static gboolean             writeback_xmp_update_file_metadata (TrackerWritebackFile     *writeback_file,
                                                                 GFile                    *file,
                                                                 GPtrArray                *values,
-                                                                TrackerSparqlConnection  *connection);
+                                                                TrackerSparqlConnection  *connection,
+                                                                GCancellable            *cancellable);
 static const gchar * const *writeback_xmp_content_types        (TrackerWritebackFile     *writeback_file);
 
 G_DEFINE_DYNAMIC_TYPE (TrackerWritebackXMP, tracker_writeback_xmp, TRACKER_TYPE_WRITEBACK_FILE);
@@ -108,7 +109,8 @@ static gboolean
 writeback_xmp_update_file_metadata (TrackerWritebackFile    *wbf,
                                     GFile                   *file,
                                     GPtrArray               *values,
-                                    TrackerSparqlConnection *connection)
+                                    TrackerSparqlConnection *connection,
+                                    GCancellable            *cancellable)
 {
 	gchar *path;
 	guint n;
diff --git a/src/tracker-writeback/tracker-writeback.c b/src/tracker-writeback/tracker-writeback.c
index 374e3f5..5dd86a4 100644
--- a/src/tracker-writeback/tracker-writeback.c
+++ b/src/tracker-writeback/tracker-writeback.c
@@ -425,7 +425,10 @@ io_writeback_job (GIOSchedulerJob *job,
 {
 	WritebackData *data = user_data;
 
-	tracker_writeback_update_metadata (data->writeback, data->results, data->connection);
+	tracker_writeback_update_metadata (data->writeback,
+	                                   data->results,
+	                                   data->connection,
+	                                   data->cancellable);
 
 	g_idle_add (perform_writeback_cb, data);
 



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