[gnome-bluetooth] lib: Drop gtk_main() and gtk_main_quit()



commit c9c0c854c0af32d713217eba0f16eaf583cd9b20
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Oct 27 13:36:03 2021 -0300

    lib: Drop gtk_main() and gtk_main_quit()
    
    As per documented in the migration guide, replace gtk_main() with a
    manual iteration of the main context, and simply remove gtk_main_quit()

 lib/test-client.c         | 3 ++-
 lib/test-pairing-dialog.c | 5 ++---
 lib/test-settings.c       | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/lib/test-client.c b/lib/test-client.c
index 288a7712..258b17de 100644
--- a/lib/test-client.c
+++ b/lib/test-client.c
@@ -306,7 +306,8 @@ int main(int argc, char *argv[])
 
        create_window();
 
-       gtk_main();
+       while (g_list_model_get_n_items (gtk_window_get_toplevels()) > 0)
+               g_main_context_iteration (NULL, TRUE);
 
        g_object_unref(client);
 
diff --git a/lib/test-pairing-dialog.c b/lib/test-pairing-dialog.c
index aaaaa663..9c8ddc00 100644
--- a/lib/test-pairing-dialog.c
+++ b/lib/test-pairing-dialog.c
@@ -28,7 +28,6 @@ response_cb (GtkDialog *dialog,
            response == GTK_RESPONSE_DELETE_EVENT) {
                if (response != GTK_RESPONSE_DELETE_EVENT)
                        gtk_window_destroy (GTK_WINDOW (dialog));
-               gtk_main_quit ();
                return;
        }
 
@@ -39,7 +38,6 @@ response_cb (GtkDialog *dialog,
                                                   "My device");
        } else {
                gtk_window_destroy (GTK_WINDOW (dialog));
-               gtk_main_quit ();
        }
 }
 
@@ -92,7 +90,8 @@ int main (int argc, char **argv)
 
        gtk_widget_show (window);
 
-       gtk_main ();
+       while (g_list_model_get_n_items (gtk_window_get_toplevels()) > 0)
+               g_main_context_iteration (NULL, TRUE);
 
        return 0;
 }
diff --git a/lib/test-settings.c b/lib/test-settings.c
index 3d995399..5fdc833e 100644
--- a/lib/test-settings.c
+++ b/lib/test-settings.c
@@ -15,7 +15,8 @@ int main (int argc, char **argv)
 
        gtk_window_present(GTK_WINDOW(window));
 
-       gtk_main ();
+       while (g_list_model_get_n_items (gtk_window_get_toplevels()) > 0)
+               g_main_context_iteration (NULL, TRUE);
 
        return 0;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]