[tracker/writeback-refactor-0.10: 9/63] miners/fs: Integrate writeback, start it up



commit edf5fb20215e3fc25ca20b9e90ee34c5bc05cbe1
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Jul 11 11:39:22 2011 +0200

    miners/fs: Integrate writeback, start it up

 src/miners/fs/tracker-main.c      |   17 ++++++++++++++++-
 src/miners/fs/tracker-writeback.c |   18 +++++++++---------
 2 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index b20d329..8a91205 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -49,6 +49,7 @@
 #include "tracker-miner-applications.h"
 #include "tracker-miner-files.h"
 #include "tracker-miner-files-index.h"
+#include "tracker-writeback.h"
 
 #define ABOUT	  \
 	"Tracker " PACKAGE_VERSION "\n"
@@ -628,7 +629,7 @@ store_is_available (void)
 
 static gboolean
 miner_needs_check (TrackerMiner *miner,
-		   gboolean      store_available)
+                   gboolean      store_available)
 {
 	/* Reasons to not mark ourselves as cleanly shutdown include:
 	 *
@@ -751,12 +752,24 @@ main (gint argc, gchar *argv[])
 		return EXIT_FAILURE;
 	}
 
+	tracker_writeback_init (TRACKER_MINER_FILES (miner_files), &error);
+
+	if (error) {
+		g_critical ("Couldn't create writeback handling: '%s'",
+		            error ? error->message : "unknown error");
+		g_object_unref (config);
+		g_object_unref (miner_files);
+		tracker_log_shutdown ();
+		return EXIT_FAILURE;
+	}
+
 	/* Create miner for applications */
 	miner_applications = tracker_miner_applications_new (&error);
 	if (!miner_applications) {
 		g_critical ("Couldn't create new Applications miner: '%s'",
 		            error ? error->message : "unknown error");
 		g_object_unref (miner_files);
+		tracker_writeback_shutdown ();
 		g_object_unref (config);
 		tracker_log_shutdown ();
 		return EXIT_FAILURE;
@@ -767,6 +780,7 @@ main (gint argc, gchar *argv[])
 	if (!miner_files_index) {
 		g_object_unref (miner_applications);
 		g_object_unref (miner_files);
+		tracker_writeback_shutdown ();
 		g_object_unref (config);
 		tracker_log_shutdown ();
 		return EXIT_FAILURE;
@@ -855,6 +869,7 @@ main (gint argc, gchar *argv[])
 	g_slist_foreach (miners, (GFunc) finalize_miner, NULL);
 	g_slist_free (miners);
 
+	tracker_writeback_shutdown ();
 	tracker_log_shutdown ();
 
 	g_print ("\nOK\n\n");
diff --git a/src/miners/fs/tracker-writeback.c b/src/miners/fs/tracker-writeback.c
index 4bf4399..803efa4 100644
--- a/src/miners/fs/tracker-writeback.c
+++ b/src/miners/fs/tracker-writeback.c
@@ -23,6 +23,7 @@
 
 #include "tracker-writeback.h"
 #include "tracker-writeback-listener.h"
+#include "tracker-writeback-dispatcher.h"
 
 /* Listener listens for the Writeback signal coming from the store, it performs
  * a few queries to get a set of changed values, and pushes the writeback task
@@ -31,8 +32,7 @@ static TrackerWritebackListener *listener = NULL;
 
 /* That task in miner-fs's queue callsback to the dispatcher. The dispatcher
  * calls the external tracker-writeback process which does the actual write */
-
-// static void TrackerWritebackDispatcher *dispatcher = NULL;
+static TrackerWritebackDispatcher *dispatcher = NULL;
 
 void
 tracker_writeback_init (TrackerMinerFiles  *miner_files,
@@ -42,9 +42,9 @@ tracker_writeback_init (TrackerMinerFiles  *miner_files,
 
 	listener = tracker_writeback_listener_new (miner_files, &internal_error);
 
-//	if (!internal_error) {
-//		distpatcher = tracker_writeback_listener_new (miner_files, &internal_error);
-//	}
+	if (!internal_error) {
+		dispatcher = tracker_writeback_dispatcher_new (miner_files, &internal_error);
+	}
 
 	if (internal_error) {
 		if (listener) {
@@ -63,8 +63,8 @@ tracker_writeback_shutdown (void)
 		listener = NULL;
 	}
 
-//	if (dispatcher) {
-//		g_object_unref (dispatcher);
-//		dispatcher = NULL;
-//	}
+	if (dispatcher) {
+		g_object_unref (dispatcher);
+		dispatcher = NULL;
+	}
 }



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