tracker r1276 - in trunk: . src/trackerd



Author: pvanhoof
Date: Thu Apr 17 12:35:50 2008
New Revision: 1276
URL: http://svn.gnome.org/viewvc/tracker?rev=1276&view=rev

Log:
2008-04-17  Philip Van Hoof  <pvanhoof gnome org>

	* src/trackerd/tracker-email-modest.c
	* src/trackerd/tracker-utils.c
	* src/trackerd/tracker-utils.h
	* src/trackerd/trackerd.c
	* src/trackerd/tracker-email-evolution.c
	* src/trackerd/tracker-process-files.c
	* src/trackerd/tracker-indexer.c

	Introduced tracker_set_status



Modified:
   trunk/ChangeLog
   trunk/src/trackerd/tracker-email-evolution.c
   trunk/src/trackerd/tracker-email-modest.c
   trunk/src/trackerd/tracker-indexer.c
   trunk/src/trackerd/tracker-process-files.c
   trunk/src/trackerd/tracker-utils.c
   trunk/src/trackerd/tracker-utils.h
   trunk/src/trackerd/trackerd.c

Modified: trunk/src/trackerd/tracker-email-evolution.c
==============================================================================
--- trunk/src/trackerd/tracker-email-evolution.c	(original)
+++ trunk/src/trackerd/tracker-email-evolution.c	Thu Apr 17 12:35:50 2008
@@ -1418,9 +1418,8 @@
 				email_free_mail_message (mail_msg);
 
 				if (!tracker_cache_process_events (db_con->data, TRUE)) {
-					tracker->status = STATUS_SHUTDOWN;
+					tracker_set_status (tracker, STATUS_SHUTDOWN, 0, TRUE);
 					tracker->shutdown = TRUE;
-					tracker_dbus_send_index_status_change_signal ();
 					return;
 				}
 

Modified: trunk/src/trackerd/tracker-email-modest.c
==============================================================================
--- trunk/src/trackerd/tracker-email-modest.c	(original)
+++ trunk/src/trackerd/tracker-email-modest.c	Thu Apr 17 12:35:50 2008
@@ -911,9 +911,8 @@
 				email_free_mail_message (mail_msg);
 
 				if (!tracker_cache_process_events (db_con->data, TRUE)) {
-					tracker->status = STATUS_SHUTDOWN;
+					tracker_set_status (tracker, STATUS_SHUTDOWN, 0, TRUE);
 					tracker->shutdown = TRUE;
-					tracker_dbus_send_index_status_change_signal ();
 					return;
 				}
 

Modified: trunk/src/trackerd/tracker-indexer.c
==============================================================================
--- trunk/src/trackerd/tracker-indexer.c	(original)
+++ trunk/src/trackerd/tracker-indexer.c	Thu Apr 17 12:35:50 2008
@@ -690,8 +690,7 @@
 
 				if (i > 101 && (i % 100 == 0)) {
 					if (!tracker_cache_process_events (NULL, FALSE)) {
-						tracker->status = STATUS_SHUTDOWN;
-						tracker_dbus_send_index_status_change_signal ();
+						tracker_set_status (tracker, STATUS_SHUTDOWN, 0, TRUE);
 						return;	
 					}
 				}

Modified: trunk/src/trackerd/tracker-process-files.c
==============================================================================
--- trunk/src/trackerd/tracker-process-files.c	(original)
+++ trunk/src/trackerd/tracker-process-files.c	Thu Apr 17 12:35:50 2008
@@ -1143,7 +1143,7 @@
         tracker->index_status = INDEX_FINISHED;
         
         if (tracker->is_running && tracker->first_time_index) {
-                tracker->status = STATUS_OPTIMIZING;
+                tracker_set_status (tracker, STATUS_OPTIMIZING, 0, FALSE);
                 tracker->do_optimize = FALSE;
                 
                 tracker->first_time_index = FALSE;
@@ -1170,8 +1170,7 @@
          * sleep until awoken by a new
          * signal.
          */
-        tracker->status = STATUS_IDLE;
-        tracker_dbus_send_index_status_change_signal ();
+        tracker_set_status (tracker, STATUS_IDLE, 0, TRUE);
         
         g_cond_wait (tracker->file_thread_signal, 
                      tracker->files_signal_mutex);
@@ -1493,16 +1492,12 @@
 		db_con = tracker->index_db;
 
 		if (!tracker_cache_process_events (tracker->index_db, TRUE) ) {
-			tracker->status = STATUS_SHUTDOWN;
-			tracker_dbus_send_index_status_change_signal ();
+			tracker_set_status (tracker, STATUS_SHUTDOWN, 0, TRUE);
 			break;	
 		}
 
-		if (tracker->status != STATUS_INDEXING) {
-			tracker->status = STATUS_INDEXING;
-			tracker_dbus_send_index_status_change_signal ();
-		}
-						
+		tracker_set_status (tracker, STATUS_INDEXING, 0, TRUE);
+
 		info = g_async_queue_try_pop (tracker->file_process_queue);
 
 		/* Check pending table if we haven't got anything */
@@ -1535,7 +1530,7 @@
 			if (res) {
 				gchar **row;
 
-				tracker->status = STATUS_PENDING;
+				tracker_set_status (tracker, STATUS_PENDING, 0, FALSE);
 
 				while ((row = tracker_db_get_row (res, k))) {
 					FileInfo	    *info_tmp;
@@ -1576,7 +1571,7 @@
 			continue;
 		}
 
-		tracker->status = STATUS_INDEXING;
+		tracker_set_status (tracker, STATUS_INDEXING, 0, TRUE);
 
                 if (process_action_prechecks (tracker, info)) {
                         continue;

Modified: trunk/src/trackerd/tracker-utils.c
==============================================================================
--- trunk/src/trackerd/tracker-utils.c	(original)
+++ trunk/src/trackerd/tracker-utils.c	Thu Apr 17 12:35:50 2008
@@ -2621,7 +2621,16 @@
 
 }
 
+void
+tracker_set_status (Tracker *tracker, TrackerStatus status, gdouble percentage, gboolean signal)
+{
+	TrackerStatus old = tracker->status;
+
+	tracker->status = status;
 
+	if (signal && old != status)
+		tracker_dbus_send_index_status_change_signal ();
+}
 
 gboolean
 tracker_pause (void)

Modified: trunk/src/trackerd/tracker-utils.h
==============================================================================
--- trunk/src/trackerd/tracker-utils.h	(original)
+++ trunk/src/trackerd/tracker-utils.h	Thu Apr 17 12:35:50 2008
@@ -539,4 +539,6 @@
 gboolean	tracker_low_diskspace		(void);
 gboolean	tracker_pause			(void);
 
+void		tracker_set_status		(Tracker *tracker, TrackerStatus status, gdouble percentage, gboolean signal);
+
 #endif

Modified: trunk/src/trackerd/trackerd.c
==============================================================================
--- trunk/src/trackerd/trackerd.c	(original)
+++ trunk/src/trackerd/trackerd.c	Thu Apr 17 12:35:50 2008
@@ -204,7 +204,7 @@
 {
         GSList *black_list;
 
-	tracker->status = STATUS_SHUTDOWN;
+	tracker_set_status (tracker, STATUS_SHUTDOWN, 0, FALSE);
 
 	if (sig_msg) {
 		tracker_log ("Received signal '%s' so now shutting down", sig_msg);
@@ -737,7 +737,7 @@
 
 	add_local_dbus_connection_monitoring (tracker->dbus_con);
 
-	tracker->status = STATUS_INIT;
+	tracker_set_status (tracker, STATUS_INIT, 0, FALSE);
 
  	tracker->is_running = FALSE;
 	tracker->shutdown = FALSE;



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