aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-session.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-07-07 14:31:39 +0100
committerConor Curran <conor.curran@canonical.com>2011-07-07 14:31:39 +0100
commit6721214222e040c718da1c417cdbd8d3489c855d (patch)
treed5998dcd1557f310080fbcb494478f425f4d7603 /src/indicator-session.c
parentb59889fbafb30da9db8178b541581716ebf5008f (diff)
downloadayatana-indicator-session-6721214222e040c718da1c417cdbd8d3489c855d.tar.gz
ayatana-indicator-session-6721214222e040c718da1c417cdbd8d3489c855d.tar.bz2
ayatana-indicator-session-6721214222e040c718da1c417cdbd8d3489c855d.zip
user label is now updated dynamically
Diffstat (limited to 'src/indicator-session.c')
-rw-r--r--src/indicator-session.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index 51c15a4..729b838 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -450,7 +450,13 @@ switch_property_change (DbusmenuMenuitem * item,
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...");
set_ellipsize = FALSE;
+ indicator_session_update_users_label (INDICATOR_SESSION (user_data),
+ NULL);
}
+ else{
+ indicator_session_update_users_label (INDICATOR_SESSION (user_data),
+ variant);
+ }
if (finalstring == NULL) {
const gchar * username = g_variant_get_string(variant, NULL);
@@ -481,8 +487,8 @@ switch_property_change (DbusmenuMenuitem * item,
} else {
set_ellipsize = FALSE;
}
+
}
-
gtk_menu_item_set_label(gmi, finalstring);
GtkLabel * label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(gmi)));
@@ -611,13 +617,15 @@ indicator_session_update_users_label (IndicatorSession* self,
GVariant * variant)
{
const gchar* username = NULL;
- if (g_variant_get_string(variant, NULL) == NULL ||
+ if (variant == NULL || g_variant_get_string(variant, NULL) == NULL ||
g_variant_get_string(variant, NULL)[0] == '\0'){
- // Get out of here - no valid username to display
+ // either way set the user label to blank
+ gtk_label_set_text (self->users.label, "");
return;
}
username = g_variant_get_string(variant, NULL);
+
// Just in case protect again.
if (username != NULL) {
g_debug ("Updating username label");