From a6c54669007f3932d6e2813e618bb106579fd28f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Feb 2020 22:24:47 -0500 Subject: Stop using gtk_main and gtk_main_quit Replace these calls with direct use of GMainContext api. --- testsuite/gtk/displayclose.c | 1 - testsuite/gtk/templates.c | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'testsuite/gtk') diff --git a/testsuite/gtk/displayclose.c b/testsuite/gtk/displayclose.c index 47794a476d..b1f66e2a32 100644 --- a/testsuite/gtk/displayclose.c +++ b/testsuite/gtk/displayclose.c @@ -24,7 +24,6 @@ main (int argc, char **argv) gdk_display_manager_set_default_display (gdk_display_manager_get (), display); win = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_signal_connect (win, "destroy", G_CALLBACK (gtk_main_quit), NULL); but = gtk_button_new_with_label ("Try to Exit"); g_signal_connect_swapped (but, "clicked", diff --git a/testsuite/gtk/templates.c b/testsuite/gtk/templates.c index d3ed82653b..1ec40ab045 100644 --- a/testsuite/gtk/templates.c +++ b/testsuite/gtk/templates.c @@ -180,7 +180,7 @@ static void test_app_chooser_dialog_basic (void) { GtkWidget *widget; - gboolean done; + gboolean done = FALSE; widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "text/plain"); g_assert (GTK_IS_APP_CHOOSER_DIALOG (widget)); @@ -189,7 +189,6 @@ test_app_chooser_dialog_basic (void) * the main context then app_chooser_online_get_default_ready_cb() * will be eventually called and segfault. */ - done = FALSE; g_timeout_add (500, main_loop_quit_cb, &done); while (!done) g_main_context_iteration (NULL, TRUE); @@ -224,6 +223,7 @@ static void test_file_chooser_widget_basic (void) { GtkWidget *widget; + gboolean done = FALSE; /* This test also tests the internal GtkPathBar widget */ g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL); @@ -240,8 +240,9 @@ test_file_chooser_widget_basic (void) * Since we assert all automated children are finalized we * can catch this */ - g_timeout_add (100, main_loop_quit_cb, NULL); - gtk_main(); + g_timeout_add (100, main_loop_quit_cb, &done); + while (!done) + g_main_context_iteration (NULL, TRUE); gtk_widget_destroy (widget); } @@ -272,13 +273,15 @@ static void test_file_chooser_button_basic (void) { GtkWidget *widget; + gboolean done = FALSE; g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL); widget = gtk_file_chooser_button_new ("Choose a file !", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); g_assert (GTK_IS_FILE_CHOOSER_BUTTON (widget)); - g_timeout_add (100, main_loop_quit_cb, NULL); - gtk_main(); + g_timeout_add (100, main_loop_quit_cb, &done); + while (!done) + g_main_context_iteration (NULL, TRUE); gtk_widget_destroy (widget); } -- cgit v1.2.1