diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2009-10-08 13:26:22 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2009-10-08 13:26:22 -0400 |
commit | 17e8277f44ad41792c7ae8d079b48c0ce50edc71 (patch) | |
tree | 403d8c9e2f9dd239c46f9ac909d3bdb5a1cd123a /src/indicator-session.c | |
parent | a792c0de053093e09a3ca469b63fda56429b8ecb (diff) | |
parent | 5ff6b510c9be9df8bb30a00e0795af2d9dcc78ae (diff) | |
download | ayatana-indicator-session-17e8277f44ad41792c7ae8d079b48c0ce50edc71.tar.gz ayatana-indicator-session-17e8277f44ad41792c7ae8d079b48c0ce50edc71.tar.bz2 ayatana-indicator-session-17e8277f44ad41792c7ae8d079b48c0ce50edc71.zip |
* Upstream release 0.1.7
* Changing the icon so that if you are disconnected it is
'system-shutdown-panel' and making sure that we see it
sometimes by not allocating the EmpathyAccountManager isn't
allocated until status is set. (LP: #432635)
* Also fixes by happenstance: (LP: #444170 and LP: #437065)
* Handling the locking of the screensaver so that we ensure
the screensaver is active before suspending. Also, we
throttle it to ensure it doesn't start until after suspend.
(LP: #444391)
* Asynchronized the menu handling so that it's in the right
order with async startup. (LP: #440484)
* String change, "New Session" to "Switch User" (LP: #444494)
* Removed debian/patches/switch_user_lp-444494.patch
Diffstat (limited to 'src/indicator-session.c')
-rw-r--r-- | src/indicator-session.c | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c index a4bb5e1..c22aa1c 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -76,18 +76,60 @@ get_label (void) GtkImage * get_icon (void) { - g_debug("Changing status icon: '%s'", "user-offline"); - status_image = GTK_IMAGE(gtk_image_new_from_icon_name("user-offline", GTK_ICON_SIZE_MENU)); + g_debug("Changing status icon: '%s'", "system-shutdown-panel"); + status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); gtk_widget_show(GTK_WIDGET(status_image)); return status_image; } typedef struct _realized_data_t realized_data_t; struct _realized_data_t { - guint position; section_t section; }; +static void +resort_menu (void) +{ + guint location = 0; + guint clientnum; + + for (clientnum = 0; clientnum < 3; clientnum++) { + DbusmenuGtkClient * client = NULL; + if (clientnum == 0) client = status_client; + if (clientnum == 1) client = users_client; + if (clientnum == 2) client = session_client; + + if (client == NULL) continue; + + DbusmenuMenuitem * root = dbusmenu_client_get_root(DBUSMENU_CLIENT(client)); + + GList * children = dbusmenu_menuitem_get_children(root); + if (children == NULL) { + continue; + } + + GList * child; + for (child = children; child != NULL; child = g_list_next(child)) { + GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, DBUSMENU_MENUITEM(child->data)); + if (widget != NULL) { + gtk_menu_reorder_child(main_menu, GTK_WIDGET(widget), location); + location++; + } + } + + if (clientnum == 0) { + gtk_menu_reorder_child(main_menu, status_separator, location); + location++; + } + if (clientnum == 1) { + gtk_menu_reorder_child(main_menu, users_separator, location); + location++; + } + } + + return; +} + static void child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer section) { @@ -97,7 +139,6 @@ child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position return; } - data->position = position; data->section = GPOINTER_TO_UINT(section); g_signal_connect(G_OBJECT(child), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(child_realized), data); @@ -111,7 +152,6 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) g_return_if_fail(DBUSMENU_IS_MENUITEM(child)); realized_data_t * data = (realized_data_t *)userdata; - guint position = data->position; section_t section = data->section; g_free(data); @@ -145,8 +185,6 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) return; } - position += posfunc(); - g_debug("SUS: Adding child: %d", position); GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, child); if (widget == NULL) { @@ -154,9 +192,11 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) return; } - gtk_menu_insert(main_menu, GTK_WIDGET(widget), position); + gtk_menu_append(main_menu, GTK_WIDGET(widget)); gtk_widget_show(GTK_WIDGET(widget)); + resort_menu(); + gtk_widget_hide(loading_item); return; |