aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-09 13:44:50 -0500
committerTed Gould <ted@canonical.com>2009-09-09 13:44:50 -0500
commit5a886cf768167eaef5b3e3c648bb8cddfe2c28d7 (patch)
tree5495c665fd2cdea1e1d7f2b041a0b201e148e29b
parentf47cd3eaae4f33de08ba1a8d5f5ff15cf89f65fd (diff)
downloadayatana-indicator-messages-5a886cf768167eaef5b3e3c648bb8cddfe2c28d7.tar.gz
ayatana-indicator-messages-5a886cf768167eaef5b3e3c648bb8cddfe2c28d7.tar.bz2
ayatana-indicator-messages-5a886cf768167eaef5b3e3c648bb8cddfe2c28d7.zip
Switch to checking the separator by keeping track of the last one incase there are a bunch of launchers that are eclipsed at the end of the list. We'll have too many cases, it's easier just to see who we unhide.
-rw-r--r--src/messages-service.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index b611357..1013c7b 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -687,7 +687,7 @@ resort_menu (DbusmenuMenuitem * menushell)
guint position = 0;
GList * serverentry;
GList * launcherentry = launcherList;
- gboolean sep_hidden = FALSE;
+ DbusmenuMenuitem * last_separator = NULL;
g_debug("Reordering Menu:");
@@ -710,6 +710,7 @@ resort_menu (DbusmenuMenuitem * menushell)
if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
/* Only clear the visiblity if we're not eclipsed */
dbusmenu_menuitem_property_set(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "true");
+ last_separator = li->separator;
}
position++;
@@ -746,18 +747,10 @@ resort_menu (DbusmenuMenuitem * menushell)
dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->separator), position);
dbusmenu_menuitem_property_set(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "true");
position++;
+ last_separator = si->separator;
}
}
- /* If there are no more launchers to add we need to hide the
- separator on the last application item */
- if (launcherentry == NULL && serverList != NULL) {
- serverentry = g_list_last(serverList);
- serverList_t * si = (serverList_t *)serverentry->data;
- dbusmenu_menuitem_property_set(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "false");
- sep_hidden = TRUE;
- }
-
/* Put any leftover launchers in at the end of the list. */
while (launcherentry != NULL) {
launcherList_t * li = (launcherList_t *)launcherentry->data;
@@ -770,16 +763,20 @@ resort_menu (DbusmenuMenuitem * menushell)
/* 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);
- dbusmenu_menuitem_property_set(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "true");
+ if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
+ /* Only clear the visiblity if we're not eclipsed */
+ dbusmenu_menuitem_property_set(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "true");
+ last_separator = li->separator;
+ }
position++;
launcherentry = launcherentry->next;
}
- if (!sep_hidden && launcherList != NULL) {
- launcherentry = g_list_last(launcherList);
- launcherList_t * li = (launcherList_t *)launcherentry->data;
- dbusmenu_menuitem_property_set(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "false");
+ if (last_separator != NULL) {
+ dbusmenu_menuitem_property_set(last_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "false");
+ } else {
+ g_warning("No last separator on resort");
}
return;