[tracker/extractor-controller-thread] tracker-extract: Keep the GSource itself in TrackerController



commit c82714d1b67022a6b0f9859a97fa1a7e4b908320
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 8 10:58:53 2011 +0200

    tracker-extract: Keep the GSource itself in TrackerController

 src/tracker-extract/tracker-controller.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/tracker-extract/tracker-controller.c b/src/tracker-extract/tracker-controller.c
index bb28650..4745ff8 100644
--- a/src/tracker-extract/tracker-controller.c
+++ b/src/tracker-extract/tracker-controller.c
@@ -46,7 +46,7 @@ struct TrackerControllerPrivate {
 	GList *ongoing_tasks;
 
 	guint shutdown_timeout;
-	guint shutdown_timeout_id;
+	GSource *shutdown_source;
 
 	GCond *initialization_cond;
 	GMutex *initialization_mutex;
@@ -132,9 +132,9 @@ tracker_controller_finalize (GObject *object)
 	controller = TRACKER_CONTROLLER (object);
 	priv = controller->priv;
 
-	if (priv->shutdown_timeout_id) {
-		g_source_remove (priv->shutdown_timeout_id);
-		priv->shutdown_timeout_id = 0;
+	if (priv->shutdown_source) {
+		g_source_destroy (priv->shutdown_source);
+		priv->shutdown_source = NULL;
 	}
 
 	tracker_controller_dbus_stop (controller);
@@ -298,7 +298,7 @@ reset_shutdown_timeout_cb (gpointer user_data)
 	priv = TRACKER_CONTROLLER (user_data)->priv;
 	g_main_loop_quit (priv->main_loop);
 
-	return TRUE;
+	return FALSE;
 }
 
 static void
@@ -315,8 +315,9 @@ reset_shutdown_timeout (TrackerController *controller)
 
 	g_message ("(Re)setting shutdown timeout");
 
-	if (priv->shutdown_timeout_id != 0) {
-		g_source_remove (priv->shutdown_timeout_id);
+	if (priv->shutdown_source) {
+		g_source_destroy (priv->shutdown_source);
+		priv->shutdown_source = NULL;
 	}
 
 	source = g_timeout_source_new_seconds (priv->shutdown_timeout);
@@ -324,7 +325,8 @@ reset_shutdown_timeout (TrackerController *controller)
 	                       reset_shutdown_timeout_cb,
 	                       controller, NULL);
 
-	priv->shutdown_timeout_id = g_source_attach (source, priv->context);
+	g_source_attach (source, priv->context);
+	priv->shutdown_source = source;
 }
 
 static void



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