gnome-power-manager r3154 - in trunk: . src



Author: pborelli
Date: Tue Jan 13 15:18:56 2009
New Revision: 3154
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3154&view=rev

Log:
2009-01-13  Paolo Borelli  <pborelli katamail com>

	* src/gpm-statistics.c: (gpm_stats_notebook_changed_cb):
	Build the title programmatically to make the work easier for
	translators.



Modified:
   trunk/ChangeLog
   trunk/src/gpm-statistics.c

Modified: trunk/src/gpm-statistics.c
==============================================================================
--- trunk/src/gpm-statistics.c	(original)
+++ trunk/src/gpm-statistics.c	Tue Jan 13 15:18:56 2009
@@ -585,6 +585,25 @@
 	return;
 }
 
+static void
+gpm_stats_set_title (GtkWindow *window, gint page_num)
+{
+	const gchar * const page_titles[] = {
+		N_("Device Information"),
+		N_("Device History"),
+		N_("Device Profile")
+	};
+	gchar *title;
+
+	g_assert (page_num < G_N_ELEMENTS (page_titles));
+
+	title = g_strdup_printf ("%s - %s", _("Power Statistics"), _(page_titles[page_num]));
+
+	gtk_window_set_title (window, title);
+
+	g_free (title);
+}
+
 /**
  * gpm_stats_notebook_changed_cb:
  **/
@@ -596,12 +615,7 @@
 
 	/* set the window title depending on the mode */
 	widget = glade_xml_get_widget (glade_xml, "dialog_stats");
-	if (page_num == 0)
-		gtk_window_set_title (GTK_WINDOW(widget), _("Power Statistics - Device Information"));
-	else if (page_num == 1)
-		gtk_window_set_title (GTK_WINDOW(widget), _("Power Statistics - Device History"));
-	else if (page_num == 2)
-		gtk_window_set_title (GTK_WINDOW(widget), _("Power Statistics - Device Profile"));
+	gpm_stats_set_title (GTK_WINDOW (widget), page_num);
 
 	/* save page in gconf */
 	gconf_client_set_int (gconf_client, GPM_CONF_INFO_PAGE_NUMBER, page_num, NULL);



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