diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-09-08 18:40:07 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-09-08 18:40:07 +0100 |
commit | 9aa0ffa312a86f136fe4b3265876156da82a216c (patch) | |
tree | c348360427675131e1af1c3e16105c5c90401ddb /src | |
parent | d446a9d9bf96e5d3dd9b6065adceb1aeb25fcd98 (diff) | |
parent | 6174b1bac576198e5d3df35f93971598937e71c6 (diff) | |
download | ayatana-indicator-session-9aa0ffa312a86f136fe4b3265876156da82a216c.tar.gz ayatana-indicator-session-9aa0ffa312a86f136fe4b3265876156da82a216c.tar.bz2 ayatana-indicator-session-9aa0ffa312a86f136fe4b3265876156da82a216c.zip |
show/hide the name from the panel
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-session.c | 28 | ||||
-rw-r--r-- | src/settings-helper.h | 15 |
2 files changed, 28 insertions, 15 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c index 1f58aba..833d19b 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; } @@ -698,14 +703,21 @@ build_menu_switch (DbusmenuMenuitem * newitem, static void indicator_session_update_users_label (IndicatorSession* self, const gchar* name) -{ - g_debug ("update users label"); - +{ if (name == NULL){ gtk_widget_hide(GTK_WIDGET(self->users.label)); return; } - + + GSettings* settings = g_settings_new ("com.canonical.indicator.session"); + gboolean use_name = g_settings_get_boolean (settings, + "show-real-name-on-panel"); + g_object_unref (settings); gtk_label_set_text (self->users.label, g_strdup(name)); - gtk_widget_show(GTK_WIDGET(self->users.label)); + if (use_name){ + gtk_widget_show(GTK_WIDGET(self->users.label)); + } + else{ + gtk_widget_hide(GTK_WIDGET(self->users.label)); + } } 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 <http://www.gnu.org/licenses/>. #ifndef __GCONF_HELPER_H__ -#define __GCONF_HELPER_H__ 1 +#define __GCONF_HELPER_H__ #include <glib/gi18n.h> @@ -31,12 +31,13 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libdbusmenu-glib/server.h> #include <libdbusmenu-glib/menuitem.h> -#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" |