aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-session.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-17 23:36:13 -0600
committerTed Gould <ted@gould.cx>2010-02-17 23:36:13 -0600
commit7723397ac8f8f5875ffac86f007b9321a503a846 (patch)
tree377dfe931171ea83f78d4d7c287c8a1b09e4717a /src/indicator-session.c
parent765a3b87d9812680615dcb7278e16fea8f0fa1d1 (diff)
downloadayatana-indicator-session-7723397ac8f8f5875ffac86f007b9321a503a846.tar.gz
ayatana-indicator-session-7723397ac8f8f5875ffac86f007b9321a503a846.tar.bz2
ayatana-indicator-session-7723397ac8f8f5875ffac86f007b9321a503a846.zip
Fleshing out the building of the user item
Diffstat (limited to 'src/indicator-session.c')
-rw-r--r--src/indicator-session.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index d931bcd..a39e4a0 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -135,11 +135,33 @@ get_icon (IndicatorObject * io)
return status_image;
}
+/* Builds an item with a hip little logged in icon. */
static gboolean
new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client)
{
+ GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new());
+ GtkWidget * hbox = gtk_hbox_new(FALSE, 0);
+
+ GtkWidget * label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, USER_ITEM_PROP_NAME));
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+ gtk_widget_show(label);
+
+ GtkWidget * icon = gtk_image_new_from_icon_name("account-logged-in", GTK_ICON_SIZE_MENU);
+ gtk_misc_set_alignment(GTK_MISC(icon), 1.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);
+ if (dbusmenu_menuitem_property_get_bool(newitem, USER_ITEM_PROP_LOGGED_IN)) {
+ gtk_widget_show(icon);
+ } else {
+ gtk_widget_hide(icon);
+ }
+
+ gtk_container_add(GTK_CONTAINER(gmi), hbox);
+ gtk_widget_show(hbox);
+
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
- return FALSE;
+ return TRUE;
}
/* Indicator based function to get the menu for the whole