From ed7d1fd6fd9d035156a15e8b0ed695de5e8e3f60 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 31 Aug 2012 11:28:21 -0500 Subject: revise indicator_session_update_a11y_from_disposition() to be easier to internationalize --- src/indicator-session.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/indicator-session.c b/src/indicator-session.c index 72e3a0b..ec95328 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -431,22 +431,22 @@ static void indicator_session_update_a11y_from_disposition (IndicatorSession * indicator, int disposition) { - GString * a11y = g_string_new (_("System")); - - if (g_settings_get_boolean (indicator->settings, "show-real-name-on-panel")) - { - const gchar * username = gtk_label_get_text (indicator->entry.label); - g_string_append_printf (a11y, " %s", username); - } - - if (disposition != DISPOSITION_NORMAL) - { - g_string_append (a11y, _(" (Attention Required)")); - } + gchar * a11y; + const gchar * username = gtk_label_get_text (indicator->entry.label); + const gboolean need_attn = disposition != DISPOSITION_NORMAL; + const gboolean show_name = g_settings_get_boolean (indicator->settings, + "show-real-name-on-panel"); + + if (show_name && need_attn) + a11y = g_strdup_printf (_("System %s (Attention Required)"), username); + else if (show_name) + a11y = g_strdup_printf (_("System %s"), username); + else + a11y = g_strdup (_("System")); - g_debug (G_STRLOC" setting a11y to \"%s\"", a11y->str); + g_debug (G_STRLOC" setting a11y to \"%s\"", a11y); g_clear_pointer (&indicator->entry.accessible_desc, g_free); - indicator->entry.accessible_desc = g_string_free (a11y, FALSE); + indicator->entry.accessible_desc = a11y; g_signal_emit (indicator, INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, -- cgit v1.2.3