summaryrefslogtreecommitdiff
path: root/tests/testtreecolumns.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-02-09 22:24:47 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-02-09 23:12:32 -0500
commita6c54669007f3932d6e2813e618bb106579fd28f (patch)
tree13835ffeb8a11f13a6fc142023050a6bac0f9354 /tests/testtreecolumns.c
parentc78971165215ca749af68c3f6f16fb7eca08e142 (diff)
downloadgtk+-a6c54669007f3932d6e2813e618bb106579fd28f.tar.gz
Stop using gtk_main and gtk_main_quit
Replace these calls with direct use of GMainContext api.
Diffstat (limited to 'tests/testtreecolumns.c')
-rw-r--r--tests/testtreecolumns.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c
index b22f5fbf95..7f44f7f18c 100644
--- a/tests/testtreecolumns.c
+++ b/tests/testtreecolumns.c
@@ -707,6 +707,17 @@ static const char *row_targets[] = {
"GTK_TREE_MODEL_ROW"
};
+static void
+quit_cb (GtkWidget *widget,
+ gpointer data)
+{
+ gboolean *done = data;
+
+ *done = TRUE;
+
+ g_main_context_wakeup (NULL);
+}
+
int
main (int argc, char *argv[])
{
@@ -720,6 +731,7 @@ main (int argc, char *argv[])
GtkTreeModel *sample_model;
GdkContentFormats *targets;
gint i;
+ gboolean done = FALSE;
gtk_init ();
@@ -744,7 +756,7 @@ main (int argc, char *argv[])
/* Set up the test windows. */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
gtk_window_set_title (GTK_WINDOW (window), "Top Window");
swindow = gtk_scrolled_window_new (NULL, NULL);
@@ -753,7 +765,7 @@ main (int argc, char *argv[])
gtk_widget_show (window);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
gtk_window_set_title (GTK_WINDOW (window), "Bottom Window");
swindow = gtk_scrolled_window_new (NULL, NULL);
@@ -763,7 +775,7 @@ main (int argc, char *argv[])
/* Set up the main window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
gtk_window_set_default_size (GTK_WINDOW (window), 500, 300);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -897,7 +909,9 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_widget_show (window);
- gtk_main ();
+
+ while (!done)
+ g_main_context_iteration (NULL, TRUE);
return 0;
}