From 6e5ab2c2a461de7aa2666290f694411a9649e3b7 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 2 Sep 2020 17:20:30 +0200 Subject: Fix duplicate location in the datetime indicator. Fixes AyatanaIndicators/ayatana-indicator-datetime#14. --- libayatana-indicator/indicator-ng.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libayatana-indicator/indicator-ng.c b/libayatana-indicator/indicator-ng.c index 5d34139..b31d298 100644 --- a/libayatana-indicator/indicator-ng.c +++ b/libayatana-indicator/indicator-ng.c @@ -354,12 +354,13 @@ static void indicator_ng_menu_section_changed(GMenuModel *pMenuSection, gint nPo for (guint nSection = 0; nSection < nSections; nSection++) { GMenuModel *pSection = g_menu_model_get_item_link(pModel, nSection, G_MENU_LINK_SECTION); + guint nSubsections = 0; if (pSection) { gchar *sNamespace; gboolean bNamespace = g_menu_model_get_item_attribute(pModel, nSection, G_MENU_ATTRIBUTE_ACTION_NAMESPACE, "s", &sNamespace); - guint nSubsections = g_menu_model_get_n_items(pSection); + nSubsections = g_menu_model_get_n_items(pSection); for (guint nSubsection = 0; nSubsection < nSubsections; nSubsection++) { @@ -405,7 +406,7 @@ static void indicator_ng_menu_section_changed(GMenuModel *pMenuSection, gint nPo g_object_unref(pSection); } - if (!g_str_equal(self->name, "ayatana-indicator-messages")) + if (pSection && nSubsections) { nMenuItem++; } -- cgit v1.2.3