diff options
author | Ted Gould <ted@canonical.com> | 2009-06-19 13:38:01 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-06-19 13:38:01 -0500 |
commit | c99e8b57e531374bff266fedb16a3915618af701 (patch) | |
tree | 5050c6758c7ba77943ecc576b21d6413526e6cb9 | |
parent | 310a2c18788756cb5e5a5c321ce6ca918a786c6e (diff) | |
download | ayatana-indicator-session-c99e8b57e531374bff266fedb16a3915618af701.tar.gz ayatana-indicator-session-c99e8b57e531374bff266fedb16a3915618af701.tar.bz2 ayatana-indicator-session-c99e8b57e531374bff266fedb16a3915618af701.zip |
Bubbling up the position information to a final function to put things on the main menu.
-rw-r--r-- | src/indicator-sus.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/indicator-sus.c b/src/indicator-sus.c index 86c84e2..b2419b9 100644 --- a/src/indicator-sus.c +++ b/src/indicator-sus.c @@ -37,6 +37,50 @@ get_icon (void) return NULL; } +static void +menu_add (GtkContainer * source, GtkWidget * addee, GtkMenu * addto, guint positionoffset) +{ + + +} + +static void +status_menu_add (GtkContainer * container, GtkWidget * widget, gpointer userdata) +{ + menu_add(container, widget, GTK_MENU(userdata), 0); + gtk_widget_show(status_separator); + return; +} + +static void +users_menu_add (GtkContainer * container, GtkWidget * widget, gpointer userdata) +{ + guint position = 0; + if (SEPARATOR_SHOWN(status_separator)) { + GList * location = g_list_find(GTK_MENU_SHELL(main_menu)->children, status_separator); + position = g_list_position(GTK_MENU_SHELL(main_menu)->children, location) + 1; + } + + menu_add(container, widget, GTK_MENU(userdata), position); + gtk_widget_show(users_separator); + return; +} + +static void +session_menu_add (GtkContainer * container, GtkWidget * widget, gpointer userdata) +{ + guint position = 0; + if (SEPARATOR_SHOWN(users_separator)) { + GList * location = g_list_find(GTK_MENU_SHELL(main_menu)->children, users_separator); + position = g_list_position(GTK_MENU_SHELL(main_menu)->children, location) + 1; + } + + menu_add(container, widget, GTK_MENU(userdata), position); + gtk_widget_show(status_separator); + return; +} + + static gboolean build_status_menu (gpointer userdata) { @@ -60,6 +104,7 @@ build_status_menu (gpointer userdata) } status_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_STATUS_DBUS_NAME, INDICATOR_STATUS_DBUS_OBJECT)); + g_signal_connect(G_OBJECT(status_menu), "added", G_CALLBACK(status_menu_add), main_menu); status_separator = gtk_separator_menu_item_new(); gtk_widget_hide(status_separator); /* Should be default, I'm just being explicit. $(%*#$ hide already! */ @@ -90,6 +135,7 @@ build_users_menu (gpointer userdata) } users_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_USERS_DBUS_NAME, INDICATOR_USERS_DBUS_OBJECT)); + g_signal_connect(G_OBJECT(users_menu), "added", G_CALLBACK(users_menu_add), main_menu); users_separator = gtk_separator_menu_item_new(); gtk_widget_hide(users_separator); /* Should be default, I'm just being explicit. $(%*#$ hide already! */ @@ -120,6 +166,7 @@ build_session_menu (gpointer userdata) } session_menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + g_signal_connect(G_OBJECT(session_menu), "added", G_CALLBACK(session_menu_add), main_menu); return FALSE; } |