From 6a3728388fdf6454d2029c3d6ae0b1c71ad6222e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Mar 2010 15:28:46 -0500 Subject: Watch for the logged in property changing and hide or show the logged in widget depending on it. --- src/indicator-session.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; } -- cgit v1.2.3