aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-10 15:22:57 -0600
committerTed Gould <ted@gould.cx>2011-03-10 15:22:57 -0600
commit5cf62744287e975ba81a27f08ee9f273b1a426b2 (patch)
tree328ed04747a87e1342f9fddefc97c296112dd154 /src
parent81022fc8b072cb04d3f2ebe8841c2f0b865870b7 (diff)
downloadayatana-indicator-session-5cf62744287e975ba81a27f08ee9f273b1a426b2.tar.gz
ayatana-indicator-session-5cf62744287e975ba81a27f08ee9f273b1a426b2.tar.bz2
ayatana-indicator-session-5cf62744287e975ba81a27f08ee9f273b1a426b2.zip
Embed the function so it's not one separator ever, but once per run
Diffstat (limited to 'src')
-rw-r--r--src/session-service.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/session-service.c b/src/session-service.c
index 123a12b..eb045c1 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -539,19 +539,6 @@ sort_app_infos (gconstpointer a, gconstpointer b)
return g_strcmp0(namea, nameb);
}
-static void
-add_extra_separator_once (DbusmenuMenuitem *menu)
-{
- static gboolean added = FALSE;
-
- if (!added) {
- DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
- dbusmenu_menuitem_child_append(menu, separator);
- added = TRUE;
- }
-}
-
/* Builds up the menu for us */
static void
rebuild_items (DbusmenuMenuitem *root,
@@ -777,11 +764,18 @@ rebuild_items (DbusmenuMenuitem *root,
/* Turn each one into a separate menu item */
GList * launcher = NULL;
+ gboolean sepadded = FALSE;
for (launcher = launchers; launcher != NULL; launcher = g_list_next(launcher)) {
GAppInfo * appinfo = G_APP_INFO(launcher->data);
/* Make sure we have a separator */
- add_extra_separator_once (root);
+ if (!sepadded) {
+ DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_append(root, separator);
+ g_object_unref(separator);
+ sepadded = TRUE;
+ }
/* Build the item */
DbusmenuMenuitem * desktop_mi = dbusmenu_menuitem_new();