aboutsummaryrefslogtreecommitdiff
path: root/src/messages-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-09 13:34:32 -0500
committerTed Gould <ted@canonical.com>2009-09-09 13:34:32 -0500
commit14e60e91042be1373bffd83040d411ef40664b1d (patch)
tree005cdeb95ff50215b0436329b35a8c70923e91c1 /src/messages-service.c
parentbf8b441386fe6c85c74fe57f7fc6d088051094d9 (diff)
downloadayatana-indicator-messages-14e60e91042be1373bffd83040d411ef40664b1d.tar.gz
ayatana-indicator-messages-14e60e91042be1373bffd83040d411ef40664b1d.tar.bz2
ayatana-indicator-messages-14e60e91042be1373bffd83040d411ef40664b1d.zip
Hiding the last item on the list depending on who is last.
Diffstat (limited to 'src/messages-service.c')
-rw-r--r--src/messages-service.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index b672489..3f0173a 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -687,6 +687,7 @@ resort_menu (DbusmenuMenuitem * menushell)
guint position = 0;
GList * serverentry;
GList * launcherentry = launcherList;
+ gboolean sep_hidden = FALSE;
g_debug("Reordering Menu:");
@@ -706,6 +707,7 @@ 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");
position++;
launcherentry = launcherentry->next;
@@ -739,10 +741,20 @@ resort_menu (DbusmenuMenuitem * menushell)
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);
+ dbusmenu_menuitem_property_set(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "true");
position++;
}
}
+ /* 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;
@@ -755,11 +767,18 @@ 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");
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");
+ }
+
return;
}