summaryrefslogtreecommitdiff
path: root/tests/testscale.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/testscale.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/testscale.c')
-rw-r--r--tests/testscale.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/testscale.c b/tests/testscale.c
index 33280dcf37..4c7bc652e7 100644
--- a/tests/testscale.c
+++ b/tests/testscale.c
@@ -88,6 +88,17 @@ extra (GtkToggleButton *button)
}
}
+static void
+quit_cb (GtkWidget *widget,
+ gpointer data)
+{
+ gboolean *done = data;
+
+ *done = TRUE;
+
+ g_main_context_wakeup (NULL);
+}
+
int main (int argc, char *argv[])
{
GtkWidget *window;
@@ -113,12 +124,13 @@ int main (int argc, char *argv[])
gdouble pos_marks[4] = { 0.0, 33.3, 66.6, 100.0 };
const gchar *pos_labels[4] = { "Left", "Right", "Top", "Bottom" };
+ gboolean done = FALSE;
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Ranges with marks");
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
flipbox = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_hexpand (flipbox, TRUE);
@@ -228,7 +240,8 @@ int main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (box2), button);
gtk_widget_show (window);
- gtk_main ();
+ while (!done)
+ g_main_context_iteration (NULL, TRUE);
return 0;
}