[tracker/libtracker-miner] Better output to console for tracker-status when no miners are paused



commit e7455b404bd1ecf63748c78b8704df2597b75c77
Author: Martyn Russell <martyn lanedo com>
Date:   Fri Aug 28 13:13:37 2009 +0100

    Better output to console for tracker-status when no miners are paused

 src/tracker-utils/tracker-status.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index fd708e5..41d14e0 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -523,6 +523,8 @@ main (gint argc, gchar *argv[])
 	}
 
 	if (pause_details) {
+		gint paused_miners = 0;
+
 		if (!miners_running) {
 			g_print ("%s\n", _("No miners are running"));
 
@@ -535,8 +537,6 @@ main (gint argc, gchar *argv[])
 			return EXIT_SUCCESS;
 		}
 
-		g_print ("%s:\n", _("Miners"));
-
 		for (l = miners_running; l; l = l->next) {
 			const gchar *name;
 			GStrv pause_applications, pause_reasons;
@@ -559,11 +559,16 @@ main (gint argc, gchar *argv[])
 				continue;
 			}
 			
-			if (!pause_applications && pause_reasons) {
+			if (!(*pause_applications) || !(*pause_reasons)) {
 				g_strfreev (pause_applications);
 				g_strfreev (pause_reasons);
 				continue;
 			}
+
+			paused_miners++;
+			if (paused_miners == 1) {
+				g_print ("%s:\n", _("Miners"));
+			}
 			
 			g_print ("  %s:\n", name);
 			
@@ -579,6 +584,10 @@ main (gint argc, gchar *argv[])
 			g_strfreev (pause_reasons);
 		}
 
+		if (paused_miners < 1) {
+			g_print ("%s\n", _("No miners are paused"));
+		}
+
 		g_slist_foreach (miners_available, (GFunc) g_free, NULL);
 		g_slist_free (miners_available);
 



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