diff options
author | Ted Gould <ted@canonical.com> | 2009-09-09 12:50:52 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-09-09 12:50:52 -0500 |
commit | e1230edce3236b5825d4ea1da82ac3a5b6fda684 (patch) | |
tree | 943e7cac8f3c77fa1b542eabdef625ad8902c94f /src | |
parent | 240672fb38a107d0ab2dfd9e8daf23262f762a4c (diff) | |
download | ayatana-indicator-messages-e1230edce3236b5825d4ea1da82ac3a5b6fda684.tar.gz ayatana-indicator-messages-e1230edce3236b5825d4ea1da82ac3a5b6fda684.tar.bz2 ayatana-indicator-messages-e1230edce3236b5825d4ea1da82ac3a5b6fda684.zip |
Putting the separators into the resorting of the menu.
Diffstat (limited to 'src')
-rw-r--r-- | src/messages-service.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c index e5471ce..990cb3c 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -674,6 +674,11 @@ check_hidden (void) return; } +/* This function takes care of putting the menu in the right order. + It basically it rebuilds the order by looking through all the + applications and launchers and puts them in the right place. The + menu functions will handle the cases where they don't move so this + is a good way to ensure everything is right. */ static void resort_menu (DbusmenuMenuitem * menushell) { @@ -686,13 +691,21 @@ resort_menu (DbusmenuMenuitem * menushell) for (serverentry = serverList; serverentry != NULL; serverentry = serverentry->next) { serverList_t * si = (serverList_t *)serverentry->data; + /* Looking to see if there are any launchers we need to insert + into the menu structure. We put as many as we need to. */ 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) { + /* Putting the launcher item in */ 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++; + /* Putting the launcher separator in */ + g_debug("\tMoving launcher separator to position %d", position); + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->separator), position); position++; + launcherentry = launcherentry->next; if (launcherentry != NULL) { li = (launcherList_t *)launcherentry->data; @@ -700,12 +713,15 @@ resort_menu (DbusmenuMenuitem * menushell) } } + /* Putting the app menu item in */ 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); position++; } + /* Putting all the indicators that are related to this application + after it. */ GList * imentry; for (imentry = si->imList; imentry != NULL; imentry = imentry->next) { imList_t * imi = (imList_t *)imentry->data; @@ -716,14 +732,29 @@ resort_menu (DbusmenuMenuitem * menushell) position++; } } + + /* Lastly putting the separator in */ + if (si->separator != NULL) { + g_debug("\tMoving app %s separator to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position); + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->separator), position); + position++; + } } + /* Put any leftover launchers in at the end of the list. */ while (launcherentry != NULL) { launcherList_t * li = (launcherList_t *)launcherentry->data; + + /* Putting the launcher in */ 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++; + /* Putting the launcher separator in */ + g_debug("\tMoving launcher separator to position %d", position); + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->separator), position); position++; + launcherentry = launcherentry->next; } |