[nautilus/menial-but-very-rewarding-work-that-made-my-fingers-numb: 7/7] tests: directory-async: Use GMainLoop



commit 205bc9b5a9a845303d069c8397e8fbb52407d541
Author: Ernestas Kulik <ernestask gnome org>
Date:   Fri May 18 14:51:58 2018 +0300

    tests: directory-async: Use GMainLoop
    
    Using the GTK+ main loop doesn’t make a lot of sense in this case.

 test/automated/display/test-nautilus-directory-async.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/test/automated/display/test-nautilus-directory-async.c 
b/test/automated/display/test-nautilus-directory-async.c
index 281dccc32..a4dc24e05 100644
--- a/test/automated/display/test-nautilus-directory-async.c
+++ b/test/automated/display/test-nautilus-directory-async.c
@@ -1,10 +1,10 @@
-#include <gtk/gtk.h>
 #include <src/nautilus-directory.h>
 #include <src/nautilus-file-utilities.h>
 #include <src/nautilus-search-directory.h>
 #include <src/nautilus-file.h>
 #include <unistd.h>
 
+static GMainLoop *main_loop;
 void *client1, *client2;
 
 static void
@@ -48,7 +48,7 @@ static void
 done_loading (NautilusDirectory *directory)
 {
     g_print ("done loading\n");
-    gtk_main_quit ();
+    g_main_loop_quit (main_loop);
 }
 
 int
@@ -62,7 +62,7 @@ main (int    argc,
     client1 = g_new0 (int, 1);
     client2 = g_new0 (int, 1);
 
-    gtk_init (&argc, &argv);
+    main_loop = g_main_loop_new (NULL, FALSE);
 
     nautilus_ensure_extension_points ();
 
@@ -93,6 +93,9 @@ main (int    argc,
                                          NULL, NULL);
 
 
-    gtk_main ();
+    g_main_loop_run (main_loop);
+
+    g_main_loop_unref (main_loop);
+
     return 0;
 }


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