aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-08-31 11:28:21 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-08-31 11:28:21 -0500
commited7d1fd6fd9d035156a15e8b0ed695de5e8e3f60 (patch)
treec19160b46c3fc1b4561a87e67014fdc61c22c2aa /src
parent64cf80553784cdee851cf7112fdc468ab46a61be (diff)
downloadayatana-indicator-session-ed7d1fd6fd9d035156a15e8b0ed695de5e8e3f60.tar.gz
ayatana-indicator-session-ed7d1fd6fd9d035156a15e8b0ed695de5e8e3f60.tar.bz2
ayatana-indicator-session-ed7d1fd6fd9d035156a15e8b0ed695de5e8e3f60.zip
revise indicator_session_update_a11y_from_disposition() to be easier to internationalize
Diffstat (limited to 'src')
-rw-r--r--src/indicator-session.c28
1 files 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,