From ee6bc3c94baf3d985de68e4f6ca1c2d30ab8d811 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 17:22:19 -0500 Subject: Build the separator after checking to see which entry to use. That way we've always got one. --- src/messages-service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index f751d77..8321406 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -562,10 +562,6 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha sl_item->attention = FALSE; sl_item->count = 0; - /* Build a separator */ - sl_item->separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - /* Incase we got an indicator first */ GList * alreadythere = g_list_find_custom(serverList, sl_item, serverList_equal); if (alreadythere != NULL) { @@ -579,6 +575,10 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort); } + /* Build a separator */ + sl_item->separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + /* Connect the signals up to the menu item */ g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_COUNT_CHANGED, G_CALLBACK(server_count_changed), sl_item); g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_NAME_CHANGED, G_CALLBACK(server_name_changed), menushell); -- cgit v1.2.3 From b8013ea21382428e7b4fcd3b7cf874dd01bee941 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 21:58:45 -0500 Subject: Make the visibility of indictor items and separators follow the visibility of the application item. --- src/messages-service.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index 8321406..515e8b3 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -904,6 +904,13 @@ resort_menu (DbusmenuMenuitem * menushell) if (imi->menuitem != NULL) { g_debug("\tMoving indicator on %s id %d to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(imi->server), INDICATE_LISTENER_INDICATOR_ID(imi->indicator), position); + + if (si->menuitem == NULL || !dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(si->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE)) { + dbusmenu_menuitem_property_set_bool(imi->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + } else { + dbusmenu_menuitem_property_set_bool(imi->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + } + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(imi->menuitem), position); position++; } @@ -912,10 +919,17 @@ resort_menu (DbusmenuMenuitem * menushell) /* 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); + + if (si->menuitem == NULL || !dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(si->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE)) { + dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + /* Note, this isn't the last if we can't see it */ + } else { + dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + last_separator = si->separator; + } + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->separator), position); - dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); position++; - last_separator = si->separator; } } -- cgit v1.2.3 From e82a10312f3996dcaa312fb3f4e813c13561e992 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 22:13:41 -0500 Subject: Ensuring that the visibility property is set on the application entries. --- src/app-menu-item.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 87423c0..03f4833 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -128,6 +128,8 @@ app_menu_item_init (AppMenuItem *self) priv->root = NULL; priv->shortcuts = NULL; + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + return; } -- cgit v1.2.3 From 36901661f757e0980f5bfca0d01da53cfdf32da2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 22:25:19 -0500 Subject: Making application items default to invisible, and only become visible if they get a valid desktop file. --- src/app-menu-item.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 03f4833..ef30333 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -128,7 +128,7 @@ app_menu_item_init (AppMenuItem *self) priv->root = NULL; priv->shortcuts = NULL; - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); return; } @@ -319,6 +319,8 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar priv->desktop = g_strdup(value); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + update_label(self); const gchar * def_icon = get_default_icon(priv->desktop); -- cgit v1.2.3 From 59518d6b4119b0a3bd8cce7ab4c1a139b7b1a652 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 00:15:22 -0500 Subject: Fixing a mixed up signal name. Small memory leak. --- src/indicator-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 48b9abf..70d5aa0 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -467,7 +467,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(indicator_prop_change_cb), mi_data); - g_signal_connect(G_OBJECT(newitem), "destroyed", G_CALLBACK(g_free), mi_data); + g_signal_connect(G_OBJECT(newitem), "destroy", G_CALLBACK(g_free), mi_data); return TRUE; } -- cgit v1.2.3 From 6d2cbc37090e80472aa3a5719d681d8ba786c505 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 00:18:11 -0500 Subject: Actually, more correctly, that should be a weak ref. --- src/indicator-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 70d5aa0..d0794cb 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -467,7 +467,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(indicator_prop_change_cb), mi_data); - g_signal_connect(G_OBJECT(newitem), "destroy", G_CALLBACK(g_free), mi_data); + g_object_weak_ref(G_OBJECT(newitem), (GWeakNotify)g_free, mi_data); return TRUE; } -- cgit v1.2.3 From 9c8c6c5bc337a6453c6a9ad2b0f3d02af5860e7e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 00:24:02 -0500 Subject: Dropping a useless warning --- src/indicator-messages.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index d0794cb..f47eccd 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -384,8 +384,6 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, i g_object_unref(resized_pixbuf); } } - } else { - g_warning("Indicator Item property '%s' unknown", prop); } return; -- cgit v1.2.3 From 3dcc91b1d7d8f8c5cb9e713eeab8c7fcf2437e30 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 09:54:24 -0500 Subject: We only want to increment the position if we didn't find an entry --- src/messages-service.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index 515e8b3..88da0e0 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -794,15 +794,16 @@ menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) { if (msl->found) return; - msl->position++; - if (!IS_APP_MENU_ITEM(data_mi)) { + msl->position++; return; } AppMenuItem * appmenu = APP_MENU_ITEM(data_mi); if (!g_strcmp0(INDICATE_LISTENER_SERVER_DBUS_NAME((IndicateListenerServer*)msl->server), INDICATE_LISTENER_SERVER_DBUS_NAME(app_menu_item_get_server(appmenu)))) { msl->found = TRUE; + } else { + msl->position++; } return; -- cgit v1.2.3