From 5f599a8cabbbc451e6c0846598453eb2618d4405 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Sun, 12 Feb 2012 13:40:21 +0100 Subject: indicator_object_set_visible: only emit entry-{added,removed} when visibility actually changed Emitting those signals is semantically incorrect. It also confused indicator-loader and the panel, because they are not checking whether an entry is already present in their entry-added handlers. This led to gtk warnings ("widget already has a parent") and strange effects, such as the same menu being added multiple times into the panel. --- libindicator/indicator-object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index d0b3ecf..1d0db58 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -886,9 +886,16 @@ indicator_object_set_visible (IndicatorObject * io, gboolean visible) GList * l; GList * entries = get_all_entries (io); const guint signal_id = signals[visible ? ENTRY_ADDED : ENTRY_REMOVED]; + EntryVisibility visibility = visible ? ENTRY_VISIBLE : ENTRY_INVISIBLE; const GQuark detail = (GQuark)0; + for (l=entries; l!=NULL; l=l->next) - g_signal_emit(io, signal_id, detail, l->data); + { + IndicatorObjectEntry *entry = l->data; + EntryVisibility v = entry_get_private (io, entry)->visibility; + if (v == ENTRY_INIT || v != visibility) + g_signal_emit(io, signal_id, detail, entry); + } g_list_free (entries); } -- cgit v1.2.3