diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-12 13:40:21 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-12 13:40:21 +0100 |
commit | 5f599a8cabbbc451e6c0846598453eb2618d4405 (patch) | |
tree | a6e69d1a5ffb9ed4e7f2fc622e417a3122074afb /libindicator/indicator-object.c | |
parent | 233fdd70cdb48ae8818baf416399989841333fcf (diff) | |
download | libayatana-indicator-5f599a8cabbbc451e6c0846598453eb2618d4405.tar.gz libayatana-indicator-5f599a8cabbbc451e6c0846598453eb2618d4405.tar.bz2 libayatana-indicator-5f599a8cabbbc451e6c0846598453eb2618d4405.zip |
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.
Diffstat (limited to 'libindicator/indicator-object.c')
-rw-r--r-- | libindicator/indicator-object.c | 9 |
1 files changed, 8 insertions, 1 deletions
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); } |