aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-17 15:28:46 -0500
committerTed Gould <ted@gould.cx>2010-03-17 15:28:46 -0500
commit6a3728388fdf6454d2029c3d6ae0b1c71ad6222e (patch)
tree25b7dcd25adaf76ed85f83aeb98e6e86259222c9 /src
parent1d79b928f9df7e3185ba5846b06f3c7675ba4fea (diff)
downloadayatana-indicator-session-6a3728388fdf6454d2029c3d6ae0b1c71ad6222e.tar.gz
ayatana-indicator-session-6a3728388fdf6454d2029c3d6ae0b1c71ad6222e.tar.bz2
ayatana-indicator-session-6a3728388fdf6454d2029c3d6ae0b1c71ad6222e.zip
Watch for the logged in property changing and hide or show the logged in widget depending on it.
Diffstat (limited to 'src')
-rw-r--r--src/indicator-session.c15
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;
}