aboutsummaryrefslogtreecommitdiff
path: root/libindicator/indicator-object.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-02-14 11:48:37 -0600
committerTed Gould <ted@gould.cx>2012-02-14 11:48:37 -0600
commita820ba783386064dfa221586e0d0f9b0234d5be6 (patch)
treeae0374f9fbafd4bffd511da5070dadf5e0526658 /libindicator/indicator-object.c
parente81d0ecfe1899acc60fb50a5fbc03823a132139d (diff)
parentf099181abb550bbc7bb409e76ad22f58dc7f14c4 (diff)
downloadlibayatana-indicator-a820ba783386064dfa221586e0d0f9b0234d5be6.tar.gz
libayatana-indicator-a820ba783386064dfa221586e0d0f9b0234d5be6.tar.bz2
libayatana-indicator-a820ba783386064dfa221586e0d0f9b0234d5be6.zip
Import upstream version 0.4.91
Diffstat (limited to 'libindicator/indicator-object.c')
-rw-r--r--libindicator/indicator-object.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c
index 849fb9f..a348d9a 100644
--- a/libindicator/indicator-object.c
+++ b/libindicator/indicator-object.c
@@ -336,20 +336,9 @@ indicator_object_init (IndicatorObject *self)
static void
indicator_object_dispose (GObject *object)
{
- IndicatorObject * io = INDICATOR_OBJECT(object);
-
/* Ensure that hidden entries are re-added so their widgetry will
be cleaned up properly by the client */
- GList * l;
- GList * entries = get_all_entries (io);
- const GQuark detail = (GQuark)0;
- for (l=entries; l!=NULL; l=l->next) {
- IndicatorObjectEntry * entry = l->data;
- if (entry_get_private(io, entry)->visibility == ENTRY_INVISIBLE) {
- g_signal_emit(io, signals[ENTRY_ADDED], detail, entry);
- }
- }
- g_list_free (entries);
+ indicator_object_set_visible (INDICATOR_OBJECT (object), TRUE);
G_OBJECT_CLASS (indicator_object_parent_class)->dispose (object);
}
@@ -507,6 +496,8 @@ get_entries_default (IndicatorObject * io)
if (!priv->gotten_entries) {
IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io);
+ priv->entry.parent_object = io;
+
if (class->get_label) {
priv->entry.label = class->get_label(io);
}
@@ -551,7 +542,7 @@ get_entries_default (IndicatorObject * io)
static GList*
get_all_entries (IndicatorObject * io)
{
- GList * all_entries = NULL;
+ GList * all_entries = NULL, *l;
g_return_val_if_fail(INDICATOR_IS_OBJECT(io), NULL);
IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io);
@@ -559,8 +550,18 @@ get_all_entries (IndicatorObject * io)
if (class->get_entries == NULL)
g_error("No get_entries function on object. It must have been deleted?!?!");
else
+ {
all_entries = class->get_entries(io);
+ for (l = all_entries; l; l = l->next)
+ {
+ IndicatorObjectEntry *entry = l->data;
+
+ if (entry)
+ entry->parent_object = io;
+ }
+ }
+
return all_entries;
}
@@ -758,8 +759,13 @@ indicator_object_entry_being_removed (IndicatorObject * io, IndicatorObjectEntry
entry_get_private (io, entry)->visibility = ENTRY_INVISIBLE;
+ if (entry)
+ entry->parent_object = NULL;
+
if (class->entry_being_removed != NULL)
+ {
class->entry_being_removed (io, entry);
+ }
}
static void
@@ -770,8 +776,13 @@ indicator_object_entry_was_added (IndicatorObject * io, IndicatorObjectEntry * e
entry_get_private (io, entry)->visibility = ENTRY_VISIBLE;
+ if (entry)
+ entry->parent_object = io;
+
if (class->entry_was_added != NULL)
+ {
class->entry_was_added (io, entry);
+ }
}
/**
@@ -861,9 +872,14 @@ 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);
+
+ for (l=entries; l!=NULL; l=l->next) {
+ IndicatorObjectEntry *entry = l->data;
+ if (entry_get_private (io, entry)->visibility != visibility)
+ g_signal_emit(io, signal_id, detail, entry);
+ }
g_list_free (entries);
}