[evolution-patches] Patch: Shell: fix for 322001 (menu items not appearing in ja locale)



Attached patch fixes a problem (bug 322001) where bogus XML UI
descriptions were being generated for the component switcher menu items
in some languages, owing to translations for either component names or
the "Switch to %s" string containing XML control characters; it escapes
the resulting string.

Makes the menu items appear correctly and suppresses large numbers of
warnings when starting evolution in Japanese.

OK to commit?

Dave
? shell/shell.error
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1544
diff -u -p -r1.1544 ChangeLog
--- shell/ChangeLog	14 Nov 2005 18:50:44 -0000	1.1544
+++ shell/ChangeLog	9 Dec 2005 07:37:30 -0000
@@ -1,3 +1,10 @@
+2005-12-09  David Malcolm  <dmalcolm redhat com>
+
+	* e-shell-window.c (setup_widgets): escape the string when generating 
+	XML UI description of component switcher menu item, to avoid it being 
+	non-well-formed when a translation contains a quote character. Fixes 
+	#322001
+
 2005-11-14  Harish Krishnaswamy  <kharish novell com>
 
 	* e-shell-settings-dialog.c: (set_dialog_size),
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.39
diff -u -p -r1.39 e-shell-window.c
--- shell/e-shell-window.c	23 Sep 2005 09:44:58 -0000	1.39
+++ shell/e-shell-window.c	9 Dec 2005 07:37:30 -0000
@@ -708,7 +708,7 @@ setup_widgets (EShellWindow *window)
 	button_id = 0;
 	xml = g_string_new("");
 	for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
-		char *tmp;
+		char *tmp, *tmp2;
 		EComponentInfo *info = p->data;
 		ComponentView *view = component_view_new (info->id, info->alias, button_id);
 
@@ -732,7 +732,12 @@ setup_widgets (EShellWindow *window)
 				info->alias,
 				info->menu_label,
 				info->menu_accelerator);
-		g_string_append_printf(xml, _("Switch to %s"), info->button_label);
+		tmp = g_strdup_printf (_("Switch to %s"), info->button_label);
+		tmp2 = g_markup_escape_text (tmp, -1);
+		g_string_append (xml, tmp2);
+		g_free (tmp2);
+		g_free (tmp);
+
 		tmp = bonobo_ui_util_pixbuf_to_xml (info->menu_icon),
 		g_string_append_printf(xml, "\" pixtype=\"pixbuf\" pixname=\"%s\"/>"
 				       "</placeholder></submenu></submenu>\n",


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