aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indicator-sus.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/indicator-sus.c b/src/indicator-sus.c
index 4e7d4b2..9368300 100644
--- a/src/indicator-sus.c
+++ b/src/indicator-sus.c
@@ -30,6 +30,7 @@ GtkLabel *
get_label (void)
{
GtkLabel * returnval = GTK_LABEL(gtk_label_new("Ted Gould"));
+ gtk_widget_show(GTK_WIDGET(returnval));
return returnval;
}
@@ -40,16 +41,39 @@ get_icon (void)
}
static void
-menu_add (GtkContainer * source, GtkWidget * addee, GtkMenu * addto, guint positionoffset)
+child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, guint (*posfunc) (void))
{
- GList * location = g_list_find(GTK_MENU_SHELL(source)->children, addee);
- guint position = g_list_position(GTK_MENU_SHELL(source)->children, location);
+ position += posfunc();
+
+ DbusmenuGtkClient * client = NULL;
+ gchar * errorstr = NULL;
+ switch (posfunc) {
+ case status_menu_pos_offset:
+ client = status_client;
+ errorstr = "Status";
+ break;
+ case users_menu_pos_offset:
+ client = users_client;
+ errorstr = "Users";
+ break;
+ case session_menu_pos_offset:
+ client = session_client;
+ errorstr = "Session";
+ break;
+ default:
+ g_warning("Child Added called with an unknown position function!");
+ return;
+ }
+
+ GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, child);
- position += positionoffset;
- g_debug("Adding a widget: %d", position);
+ if (widget == NULL) {
+ g_warning("Had a menu item added to the %s menu, but yet it didn't have a GtkWidget with it. Can't add that to a menu now can we? You need to figure this @#$# out!", errorstr);
+ return;
+ }
- gtk_menu_insert(addto, addee, position);
- gtk_widget_show(addee);
+ gtk_menu_insert(main_menu, GTK_WIDGET(widget), position);
+ gtk_widget_show(GTK_WIDGET(widget));
gtk_widget_hide(loading_item);
@@ -57,13 +81,6 @@ menu_add (GtkContainer * source, GtkWidget * addee, GtkMenu * addto, guint posit
}
static void
-child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, guint (*posfunc) (void))
-{
- menu_add(NULL, NULL, NULL, 0);
-
-}
-
-static void
child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint newpos, guint oldpos, guint (*posfunc) (void))
{