From 6174b1bac576198e5d3df35f93971598937e71c6 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Sep 2011 14:01:36 +0100 Subject: user correct string on switch item unless user actually wants to show username --- data/com.canonical.indicator.session.gschema.xml.in | 7 +++++++ src/indicator-session.c | 11 ++++++++--- src/settings-helper.h | 15 ++++++++------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index e0d14c3..eaebea1 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -25,6 +25,13 @@ Determine the visibility of the User Menu Allow for the user menu to be hidden by the user. + + false + Determine what string to use for the user's name in the switch menuitem. + The switch menuitem as part of the user menu should be default have the label 'Switch User Account'. + This settings gives the user the potential to have the label read 'Switch from $username' + + diff --git a/src/indicator-session.c b/src/indicator-session.c index f41c841..20fc643 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -539,10 +539,16 @@ switch_property_change (DbusmenuMenuitem * item, if (g_strcmp0(translate, "1") != 0) { no_name_in_lang = TRUE; } + + GSettings* settings = g_settings_new ("com.canonical.indicator.session"); + gboolean use_username = g_settings_get_boolean (settings, + "use-username-in-switch-item"); + g_object_unref (settings); if (variant == NULL || g_variant_get_string(variant, NULL) == NULL || - g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang) { - finalstring = _("Switch User…"); + g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang + || use_username == FALSE) { + finalstring = _("Switch User Account…"); set_ellipsize = FALSE; } @@ -587,7 +593,6 @@ switch_property_change (DbusmenuMenuitem * item, gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE); } } - return; } diff --git a/src/settings-helper.h b/src/settings-helper.h index ae57575..ea0c99f 100644 --- a/src/settings-helper.h +++ b/src/settings-helper.h @@ -21,7 +21,7 @@ with this program. If not, see . #ifndef __GCONF_HELPER_H__ -#define __GCONF_HELPER_H__ 1 +#define __GCONF_HELPER_H__ #include @@ -31,12 +31,13 @@ with this program. If not, see . #include #include -#define SESSION_SCHEMA "com.canonical.indicator.session" -#define SUPPRESS_KEY "suppress-logout-restart-shutdown" -#define LOGOUT_KEY "suppress-logout-menuitem" -#define RESTART_KEY "suppress-restart-menuitem" -#define SHUTDOWN_KEY "suppress-shutdown-menuitem" -#define SHOW_USER_MENU "user-show-menu" +#define SESSION_SCHEMA "com.canonical.indicator.session" +#define SUPPRESS_KEY "suppress-logout-restart-shutdown" +#define LOGOUT_KEY "suppress-logout-menuitem" +#define RESTART_KEY "suppress-restart-menuitem" +#define SHUTDOWN_KEY "suppress-shutdown-menuitem" +#define SHOW_USER_MENU "user-show-menu" +#define USER_USERNAME_IN_SWITCH_ITEM "use-username-in-switch-item" #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" #define LOCKDOWN_KEY_USER "disable-user-switching" -- cgit v1.2.3 From d446a9d9bf96e5d3dd9b6065adceb1aeb25fcd98 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Sep 2011 18:30:52 +0100 Subject: add the new gsettings entry for toggling the visibility of the real name on the panel --- data/com.canonical.indicator.session.gschema.xml.in | 5 +++++ src/indicator-session.c | 1 + 2 files changed, 6 insertions(+) diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index e0d14c3..3b4cd4d 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -20,6 +20,11 @@ <_summary>Remove the shutdown item from the session menu <_description>Makes it so that the shutdown button doesn’t show in the session menu. + + true + Determine the visibility of the User's real name on the panel + Allow for the Removal of the users name from the panel + true Determine the visibility of the User Menu diff --git a/src/indicator-session.c b/src/indicator-session.c index f41c841..1f58aba 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -705,6 +705,7 @@ indicator_session_update_users_label (IndicatorSession* self, gtk_widget_hide(GTK_WIDGET(self->users.label)); return; } + gtk_label_set_text (self->users.label, g_strdup(name)); gtk_widget_show(GTK_WIDGET(self->users.label)); } -- cgit v1.2.3