aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indicator-sus.c47
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;
}