diff options
author | Ted Gould <ted@canonical.com> | 2009-08-19 21:15:37 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-19 21:15:37 -0500 |
commit | 74df2c7eb2914922bf68940994751b8369991300 (patch) | |
tree | 00fcb8dbc2608f4616e452e797f85f5299fda194 /src | |
parent | 72be94fdd1299c2bcec99e169f4800ff6e89c516 (diff) | |
download | ayatana-indicator-messages-74df2c7eb2914922bf68940994751b8369991300.tar.gz ayatana-indicator-messages-74df2c7eb2914922bf68940994751b8369991300.tar.bz2 ayatana-indicator-messages-74df2c7eb2914922bf68940994751b8369991300.zip |
Adding the launcher list to the resorting function. This looks more complex than it is, it's just merging the two lists on the fly in alphabetical order.
Diffstat (limited to 'src')
-rw-r--r-- | src/messages-service.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c index 1d8c61c..3f2974e 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -321,11 +321,27 @@ resort_menu (DbusmenuMenuitem * menushell) { guint position = 0; GList * serverentry; + GList * launcherentry = launcherList; g_debug("Reordering Menu:"); for (serverentry = serverList; serverentry != NULL; serverentry = serverentry->next) { serverList_t * si = (serverList_t *)serverentry->data; + + if (launcherentry != NULL) { + launcherList_t * li = (launcherList_t *)launcherentry->data; + while (launcherentry != NULL && g_strcmp0(launcher_menu_item_get_name(li->menuitem), app_menu_item_get_name(si->menuitem)) < 0) { + g_debug("\tMoving launcher '%s' to position %d", launcher_menu_item_get_name(li->menuitem), position); + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->menuitem), position); + + position++; + launcherentry = launcherentry->next; + if (launcherentry != NULL) { + li = (launcherList_t *)launcherentry->data; + } + } + } + if (si->menuitem != NULL) { g_debug("\tMoving app %s to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position); dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->menuitem), position); @@ -344,6 +360,15 @@ resort_menu (DbusmenuMenuitem * menushell) } } + while (launcherentry != NULL) { + launcherList_t * li = (launcherList_t *)launcherentry->data; + g_debug("\tMoving launcher '%s' to position %d", launcher_menu_item_get_name(li->menuitem), position); + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->menuitem), position); + + position++; + launcherentry = launcherentry->next; + } + return; } |