[tracker/tracker-0.8] libtracker-miner: Don't translate statuses



commit 304e7949114cd11391fc0b196f0a2810d6b141ac
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Apr 21 12:23:42 2010 +0100

    libtracker-miner: Don't translate statuses
    
    This also adds a tracker-status -s to list common statuses

 docs/manpages/tracker-status.1                   |   10 +++++++
 src/libtracker-miner/tracker-miner-fs.c          |   16 +++++-----
 src/miners/rss/tracker-miner-rss.c               |    2 +-
 src/plugins/evolution/tracker-evolution-plugin.c |    4 +-
 src/tracker-status-icon/tracker-status-icon.c    |    2 +-
 src/tracker-utils/tracker-status.c               |   32 ++++++++++++++++++++-
 6 files changed, 52 insertions(+), 14 deletions(-)
---
diff --git a/docs/manpages/tracker-status.1 b/docs/manpages/tracker-status.1
index 739947b..f3ce7e4 100644
--- a/docs/manpages/tracker-status.1
+++ b/docs/manpages/tracker-status.1
@@ -31,6 +31,16 @@ with this.
 For the most part, this purely provides a timestamp with each status
 update to follow WHEN changes happened.
 .TP
+.B \-s, \-\-list-common-statuses
+This will list statuses most commonly produced by miners and the
+store. These statuses are not translated when sent over D-Bus and
+should be translated by each application. These are not considered
+static and are subject to change at any point.
+
+Additionally, these statuses are not the only ones which may be
+reported by a miner. There may be other states pertaining to the
+specific roles of the miner in question.
+.TP
 .B \-l, \-\-list-miners-running
 This will list all miners which have responded to a D-Bus call.
 Sometimes it is helpfult to use this command with
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index f621ea6..7568bef 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -718,7 +718,7 @@ miner_started (TrackerMiner *miner)
 
 	g_object_set (miner,
 	              "progress", 0.0,
-	              "status", _("Initializing"),
+	              "status", "Initializing",
 	              NULL);
 
 	crawl_directories_start (fs);
@@ -729,7 +729,7 @@ miner_stopped (TrackerMiner *miner)
 {
 	g_object_set (miner,
 	              "progress", 1.0,
-	              "status", _("Idle"),
+	              "status", "Idle",
 	              NULL);
 }
 
@@ -883,7 +883,7 @@ process_stop (TrackerMinerFS *fs)
 
 	g_object_set (fs,
 	              "progress", 1.0,
-	              "status", _("Idle"),
+	              "status", "Idle",
 	              NULL);
 
 	g_signal_emit (fs, signals[FINISHED], 0,
@@ -1997,10 +1997,10 @@ item_queue_handlers_set_up (TrackerMinerFS *fs)
 
 	g_object_get (fs, "status", &status, NULL);
 
-	if (g_strcmp0 (status, _("Processing files")) != 0) {
+	if (g_strcmp0 (status, "Processingâ?¦") != 0) {
 		/* Don't spam this */
-		g_message ("Processing files...");
-		g_object_set (fs, "status", _("Processing files"), NULL);
+		g_message ("Processingâ?¦");
+		g_object_set (fs, "status", "Processingâ?¦", NULL);
 	}
 
 	g_free (status);
@@ -2553,9 +2553,9 @@ crawl_directories_cb (gpointer user_data)
 	path = g_file_get_path (fs->private->current_directory->file);
 
 	if (fs->private->current_directory->recurse) {
-		str = g_strdup_printf (_("Crawling recursively directory '%s'"), path);
+		str = g_strdup_printf ("Crawling recursively directory '%s'", path);
 	} else {
-		str = g_strdup_printf (_("Crawling single directory '%s'"), path);
+		str = g_strdup_printf ("Crawling single directory '%s'", path);
 	}
 
 	g_message ("%s", str);
diff --git a/src/miners/rss/tracker-miner-rss.c b/src/miners/rss/tracker-miner-rss.c
index dec5b81..d4ef515 100644
--- a/src/miners/rss/tracker-miner-rss.c
+++ b/src/miners/rss/tracker-miner-rss.c
@@ -253,7 +253,7 @@ change_status (FeedsPool   *pool,
 	           avail);
 
 	prog = ((gdouble) priv->now_fetching) / ((gdouble) avail);
-	g_object_set (miner, "progress", prog, "status", _("Fetching..."), NULL);
+	g_object_set (miner, "progress", prog, "status", "Fetchingâ?¦", NULL);
 }
 
 static void
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index 49a864f..6ba7ee5 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -2344,7 +2344,7 @@ miner_started (TrackerMiner *miner)
 	                         G_TYPE_INVALID,
 	                         G_TYPE_INVALID);
 
-	g_object_set (miner,  "progress", 0.0,  "status", _("Initializing"), NULL);
+	g_object_set (miner,  "progress", 0.0,  "status", "Initializing", NULL);
 }
 
 static void
@@ -2436,7 +2436,7 @@ miner_resumed (TrackerMiner *miner)
 		priv->client = tracker_client_new (0, G_MAXINT);
 	}
 
-	g_object_set (miner,  "progress", 0.0,  "status", _("Resuming"), NULL);
+	g_object_set (miner,  "progress", 0.0,  "status", _("Processingâ?¦"), NULL);
 
 	dbus_g_proxy_begin_call (priv->dbus_proxy, "ListNames",
 	                         list_names_reply_cb,
diff --git a/src/tracker-status-icon/tracker-status-icon.c b/src/tracker-status-icon/tracker-status-icon.c
index c2704d0..60fa157 100644
--- a/src/tracker-status-icon/tracker-status-icon.c
+++ b/src/tracker-status-icon/tracker-status-icon.c
@@ -384,7 +384,7 @@ status_icon_miner_progress_set (MinerMenuEntry *entry)
 	gtk_label_set_text (GTK_LABEL (entry->progress_percentage), progress_str);
 	g_free (progress_str);
 
-	gtk_widget_set_tooltip_text (entry->box, entry->status);
+	gtk_widget_set_tooltip_text (entry->box, _(entry->status));
 }
 
 static void
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index ba58db6..69ecf1b 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -53,6 +53,7 @@ static GHashTable *miners_status;
 static gint longest_miner_name_length = 0;
 static gint paused_length = 0;
 
+static gboolean list_common_statuses;
 static gboolean list_miners_running;
 static gboolean list_miners_available;
 static gboolean pause_details;
@@ -63,6 +64,17 @@ static gboolean follow;
 static gboolean detailed;
 static gboolean print_version;
 
+/* Make sure our statuses are translated (all from libtracker-miner except one) */
+static const gchar *statuses[7] = {
+	N_("Initializing"),
+	N_("Processingâ?¦"),
+	N_("Fetchingâ?¦"), /* miner/rss */
+	N_("Crawling single directory '%s'"),
+	N_("Crawling recursively directory '%s'"),
+	N_("Paused"),
+	N_("Idle")
+};
+
 static GOptionEntry entries[] = {
 	{ "follow", 'f', 0, G_OPTION_ARG_NONE, &follow,
 	  N_("Follow status changes as they happen"),
@@ -72,6 +84,10 @@ static GOptionEntry entries[] = {
 	  N_("Include details with state updates (only applies to --follow)"),
 	  NULL
 	},
+	{ "list-common-statuses", 's', 0, G_OPTION_ARG_NONE, &list_common_statuses,
+	  N_("List common statuses for miners and the store"),
+	  NULL
+	},
 	{ "list-miners-running", 'l', 0, G_OPTION_ARG_NONE, &list_miners_running,
 	  N_("List all miners currently running"),
 	  NULL
@@ -268,7 +284,7 @@ miner_print_state (TrackerMinerManager *manager,
 		         is_paused ? _("PAUSED") : " ",
 		         is_paused ? ")" : " ",
 		         status ? "-" : "",
-		         status ? status : "");
+		         status ? _(status) : "");
 	} else {
 		g_print ("%s  %s  %-*.*s  %-*.*s  - %s\n",
 		         time_str,
@@ -337,7 +353,7 @@ store_print_state (void)
 	         longest_miner_name_length + paused_length,
 	         _("Journal replay"),
 	         status ? "-" : "",
-	         status ? status : "");
+	         status ? _(status) : "");
 }
 
 static void
@@ -533,6 +549,18 @@ main (gint argc, gchar *argv[])
 	miners_available = tracker_miner_manager_get_available (manager);
 	miners_running = tracker_miner_manager_get_running (manager);
 
+	if (list_common_statuses) {
+		gint i;
+
+		g_print ("%s:\n", _("Common statuses include"));
+
+		for (i = 0; i < G_N_ELEMENTS(statuses); i++) {
+			g_print ("  %s\n", _(statuses[i]));
+		}
+
+		return EXIT_SUCCESS;
+	}
+
 	if (list_miners_available) {
 		gchar *str;
 



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