diff options
-rw-r--r-- | src/indicator-session.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c index c21579a..9cf58a5 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -216,6 +216,19 @@ get_icon (IndicatorObject * io) return INDICATOR_SESSION(io)->status_image; } +static void +user_property_change (DbusmenuMenuitem * item, const gchar * property, const GValue * value, gpointer user_data) +{ + if (g_strcmp0(property, USER_ITEM_PROP_LOGGED_IN) == 0) { + if (g_value_get_boolean(value)) { + gtk_widget_show(GTK_WIDGET(user_data)); + } else { + gtk_widget_hide(GTK_WIDGET(user_data)); + } + } + return; +} + /* Builds an item with a hip little logged in icon. */ static gboolean new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) @@ -242,6 +255,8 @@ new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuCl dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); + g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(user_property_change), icon); + return TRUE; } |