diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-01-17 19:47:45 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-01-17 19:47:45 -0500 |
commit | cdb2fcb554500d13d147c17b7126c556f87014ae (patch) | |
tree | b2f86df4062b5aedbab36d64566f541d86da9499 /tests/gdkgears.c | |
parent | 4f50bf23d34debfdf442dc835c1abbcf51f8980b (diff) | |
download | gtk+-cdb2fcb554500d13d147c17b7126c556f87014ae.tar.gz |
gdkgears: add a way to remove gears
This is needed to test the GL resource cleanup
code paths.
Diffstat (limited to 'tests/gdkgears.c')
-rw-r--r-- | tests/gdkgears.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/gdkgears.c b/tests/gdkgears.c index 65c4f12fb1..56b5076b13 100644 --- a/tests/gdkgears.c +++ b/tests/gdkgears.c @@ -96,6 +96,17 @@ moar_gears (GtkButton *button, gpointer data) gtk_widget_show (gears); } +static void +less_gears (GtkButton *button, gpointer data) +{ + GtkContainer *container = GTK_CONTAINER (data); + GtkWidget *gears; + + gears = gtk_widget_get_last_child (GTK_WIDGET (container)); + if (gears) + gtk_widget_destroy (gears); +} + int main (int argc, char *argv[]) { @@ -213,11 +224,15 @@ main (int argc, char *argv[]) gtk_widget_show (bbox); button = gtk_button_new_with_label ("Moar gears!"); - gtk_widget_set_hexpand (button, TRUE); gtk_container_add (GTK_CONTAINER (bbox), button); g_signal_connect (button, "clicked", G_CALLBACK (moar_gears), extra_hbox); gtk_widget_show (button); + button = gtk_button_new_with_label ("Less gears!"); + gtk_container_add (GTK_CONTAINER (bbox), button); + g_signal_connect (button, "clicked", G_CALLBACK (less_gears), extra_hbox); + gtk_widget_show (button); + button = gtk_button_new_with_label ("Quit"); gtk_widget_set_hexpand (button, TRUE); gtk_container_add (GTK_CONTAINER (bbox), button); |