[tracker/tracker-0.10] tracker-control: Clean up store progress reporting



commit 8d3130106d6fff724ba2bf5e6a747e6a39351507
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Jun 13 15:56:01 2011 +0100

    tracker-control: Clean up store progress reporting
    
    Make it more consistent with the miner reporting.
    Also don't represent 0% with a â (i.e. done)

 src/tracker-control/tracker-control-status.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/tracker-control/tracker-control-status.c b/src/tracker-control/tracker-control-status.c
index e88ee0e..18674e0 100644
--- a/src/tracker-control/tracker-control-status.c
+++ b/src/tracker-control/tracker-control-status.c
@@ -235,8 +235,8 @@ store_print_state (const gchar *status,
 
 			status_split = g_strsplit (status, "-", 2);
 			if (status_split[0] && status_split[1]) {
-				operation = status_split[0];
-				operation_status = status_split[1];
+				operation = g_strstrip (status_split[0]);
+				operation_status = g_strstrip (status_split[1]);
 				/* Free the array, not the contents */
 				g_free (status_split);
 			} else {
@@ -245,27 +245,35 @@ store_print_state (const gchar *status,
 			}
 		}
 
-		if (progress > 0.0 && progress < 1.0) {
-			progress_str = g_strdup_printf ("%-3.0f%%", progress * 100);
+		if (progress >= 0.0 && progress < 1.0) {
+			progress_str = g_strdup_printf ("%3u%%", (guint)(progress * 100));
 		} else {
 			progress_str = g_strdup_printf ("â   ");
 		}
 
-		g_print ("%s  %s  %-*.*s    %s %s\n",
+		g_print ("%s  %s  %-*.*s    - %s %s%s%s\n",
 		         time_str,
 		         progress_str ? progress_str : "    ",
 		         longest_miner_name_length + paused_length,
 		         longest_miner_name_length + paused_length,
-		         (operation ? _(operation) : _(status)),
-		         operation_status ? "-" : "",
-		         operation_status ? _(operation_status) : "");
+		         "Store",
+		         /*(operation ? _(operation) : _(status)),*/
+		         /*operation ? "-" : "",*/
+		         operation ? _(operation) : _(status),
+		         operation_status ? "(" : "",
+		         operation_status ? operation_status : "",
+		         operation_status ? ")" : "");
 
 		g_free (progress_str);
 		g_free (operation);
 		g_free (operation_status);
 	} else {
-		g_print ("%s        %s\n",
+		g_print ("%s  %s %-*.*s    - %s\n",
 		         time_str,
+		         "â    ", /* Progress */
+		         longest_miner_name_length + paused_length,
+		         longest_miner_name_length + paused_length,
+		         "Store",
 		         _("Unavailable"));
 	}
 }



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