From 11eec8680038a3d0cb1d117c40214d587ca5a497 Mon Sep 17 00:00:00 2001 From: Frederic Crozat <fcrozat@mandriva.com> Date: Mon, 3 May 2010 16:37:21 +0200 Subject: [PATCH] ensure text is converted to local encoding before calling zenity https://bugzilla.gnome.org/show_bug.cgi?id=617536 --- src/core/delete.c | 7 +------ src/core/util.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/core/delete.c b/src/core/delete.c index 8feb08b..13321ee 100644 --- a/src/core/delete.c +++ b/src/core/delete.c @@ -76,7 +76,6 @@ delete_ping_timeout_func (MetaDisplay *display, void *user_data) { MetaWindow *window = user_data; - char *window_title; gchar *window_content, *tmp; GPid dialog_pid; @@ -90,19 +89,15 @@ delete_ping_timeout_func (MetaDisplay *display, return; } - window_title = g_locale_from_utf8 (window->title, -1, NULL, NULL, NULL); - /* Translators: %s is a window title */ tmp = g_strdup_printf (_("<tt>%s</tt> is not responding."), - window_title); + window->title); window_content = g_strdup_printf ( "<big><b>%s</b></big>\n\n<i>%s</i>", tmp, _("You may choose to wait a short while for it to " "continue or force the application to quit entirely.")); - g_free (window_title); - dialog_pid = meta_show_dialog ("--question", window_content, 0, diff --git a/src/core/util.c b/src/core/util.c index 2b6397c..cc51833 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -554,6 +554,7 @@ meta_show_dialog (const char *type, GSList *tmp; int i=0; GPid child_pid; + char *locale_message, *locale_ok_text = NULL, *locale_cancel_text = NULL; const char **argvl = g_malloc(sizeof (char*) * (17 + g_slist_length (columns)*2 + @@ -569,7 +570,8 @@ meta_show_dialog (const char *type, /* Translators: This is the title used on dialog boxes */ argvl[i++] = _("Metacity"); argvl[i++] = "--text"; - argvl[i++] = message; + locale_message = g_locale_from_utf8 (message, -1, NULL, NULL, NULL); + argvl[i++] = locale_message; if (timeout) { @@ -580,13 +582,15 @@ meta_show_dialog (const char *type, if (ok_text) { argvl[i++] = "--ok-label"; - argvl[i++] = ok_text; + locale_ok_text = g_locale_from_utf8 (ok_text, -1, NULL, NULL, NULL); + argvl[i++] = locale_ok_text; } if (cancel_text) { argvl[i++] = "--cancel-label"; - argvl[i++] = cancel_text; + locale_cancel_text= g_locale_from_utf8 (cancel_text, -1, NULL, NULL, NULL); + argvl[i++] = locale_cancel_text; } tmp = columns; @@ -626,6 +630,9 @@ meta_show_dialog (const char *type, if (transient_for) unsetenv ("WINDOWID"); + g_free (locale_message); + g_free (locale_cancel_text); + g_free (locale_ok_text); g_free (argvl); g_free (screen_number_text); -- 1.7.1