aboutsummaryrefslogtreecommitdiff
path: root/tests/test-loader.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-09-11 23:25:56 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-09-11 23:25:56 -0500
commit00d05564fe963f53d8f56601f0b2dad2834b9b00 (patch)
treeec56a4f7aec66aac5f7ed70ca3c2079d0f74be88 /tests/test-loader.c
parentee19af5cf98a77eb3e5df03769265193be1384f5 (diff)
downloadlibayatana-indicator-00d05564fe963f53d8f56601f0b2dad2834b9b00.tar.gz
libayatana-indicator-00d05564fe963f53d8f56601f0b2dad2834b9b00.tar.bz2
libayatana-indicator-00d05564fe963f53d8f56601f0b2dad2834b9b00.zip
In tests/test-loader and tests/dummy-indicator-visible.c, support hiding & re-showing IndicatorObjectEntries by caching their parent widgetry instead of using gtk_widget_destroy()
Diffstat (limited to 'tests/test-loader.c')
-rw-r--r--tests/test-loader.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/test-loader.c b/tests/test-loader.c
index 28c56aa..45901cb 100644
--- a/tests/test-loader.c
+++ b/tests/test-loader.c
@@ -156,22 +156,24 @@ test_loader_filename_dummy_signaler (void)
static void
visible_entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer box)
{
- // make a frame for the entry, and add the frame to the box
- GtkWidget * frame = gtk_frame_new (NULL);
- GtkWidget * child = GTK_WIDGET(entry->label);
+ GtkWidget * child = GTK_WIDGET (entry->label);
g_assert (child != NULL);
- gtk_container_add (GTK_CONTAINER(frame), child);
- gtk_box_pack_start (GTK_BOX(box), frame, FALSE, FALSE, 0);
- g_object_set_data (G_OBJECT(child), "frame-parent", frame);
+
+ if (g_object_get_data (G_OBJECT(child), "frame-parent") == NULL)
+ {
+ GtkWidget * frame = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER(frame), child);
+ gtk_box_pack_start (GTK_BOX(box), frame, FALSE, FALSE, 0);
+ g_object_set_data (G_OBJECT(child), "frame-parent", frame);
+ }
}
static void
visible_entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer box)
{
- // destroy this entry's frame
- gpointer parent = g_object_steal_data (G_OBJECT(entry->label), "frame-parent");
- if (GTK_IS_WIDGET(parent))
- gtk_widget_destroy(GTK_WIDGET(parent));
+ GtkWidget * child = GTK_WIDGET (entry->label);
+ g_assert (child != NULL);
+ g_assert (g_object_get_data (G_OBJECT(child), "frame-parent") != NULL);
}
void
@@ -218,7 +220,7 @@ test_loader_filename_dummy_visible (void)
g_assert(GTK_IS_LABEL(label));
g_assert(g_object_get_qdata(G_OBJECT(label), is_hidden_quark) != NULL);
list = gtk_container_get_children (GTK_CONTAINER(box));
- g_assert(g_list_length(list) == 0);
+ g_assert(g_list_length(list) == 1);
g_list_free(list);
// restore the entries and confirm that the label survived