aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog9
-rw-r--r--debian/patches/switch_user_lp-444494.patch13
-rw-r--r--src/indicator-session.c52
-rw-r--r--src/users-service.c2
4 files changed, 56 insertions, 20 deletions
diff --git a/debian/changelog b/debian/changelog
index 8081ae0..0e85b0b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+indicator-session (0.1.6-0ubuntu3~ppa1) UNRELEASED; urgency=low
+
+ * Asynchronized the menu handling so that it's in the right
+ order with async startup.
+ * String change, "New Session" to "Switch User" (LP: #444494)
+ * Removed debian/patches/switch_user_lp-444494.patch
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 06 Oct 2009 18:09:08 -0400
+
indicator-session (0.1.6-0ubuntu2) UNRELEASED; urgency=low
* debian/patches/switch_user_lp-444494.patch
diff --git a/debian/patches/switch_user_lp-444494.patch b/debian/patches/switch_user_lp-444494.patch
deleted file mode 100644
index 6c4bdf8..0000000
--- a/debian/patches/switch_user_lp-444494.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-=== modified file 'src/users-service.c'
---- src/users-service.c 2009-09-30 02:03:36 +0000
-+++ src/users-service.c 2009-10-05 20:38:14 +0000
-@@ -342,7 +342,7 @@
- if (check_new_session ())
- {
- mi = dbusmenu_menuitem_new ();
-- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session..."));
-+ dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Switch User..."));
- dbusmenu_menuitem_child_append (root, mi);
- g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL);
- }
-
diff --git a/src/indicator-session.c b/src/indicator-session.c
index a4bb5e1..c367e3a 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -84,10 +84,52 @@ get_icon (void)
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;
diff --git a/src/users-service.c b/src/users-service.c
index 9877ba6..5a189c8 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -342,7 +342,7 @@ rebuild_items (DbusmenuMenuitem *root,
if (check_new_session ())
{
mi = dbusmenu_menuitem_new ();
- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session..."));
+ dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Switch User..."));
dbusmenu_menuitem_child_append (root, mi);
g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL);
}