Movie Info Provider test: Added main loop support
authorSimón Pena <spenap@gmail.com>
Sun, 16 May 2010 16:58:32 +0000 (18:58 +0200)
committerSimón Pena <spenap@gmail.com>
Sun, 16 May 2010 17:31:55 +0000 (19:31 +0200)
Mainloop support is added to the test, so that it keeps running
until the response is acquired (and still after that). It has
to be manually interrupted, but shows that the async query is working.

test/mvs-info-provider-test.c

index 344f82d..d0adfa1 100644 (file)
 #include "mvs-minfo-provider.h"
 #include "mvs-movie-info.h"
 
+static GMainLoop *loop = NULL;
+
+static void
+response_received_callback (MvsMInfoProvider minfo_provider,
+                            gpointer user_data)
+{
+        g_main_loop_quit (loop);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -34,10 +43,15 @@ main (int argc, char **argv)
 
         minfo_provider = mvs_minfo_provider_new ();
         movie_info = mvs_movie_info_new ();
+        loop = g_main_loop_new (NULL, FALSE);
+
+        mvs_minfo_provider_query (minfo_provider, "Zombieland");
 
-        mvs_minfo_provider_query (minfo_provider, "A query");
+        g_main_loop_run (loop);
 
         g_object_unref (minfo_provider);
         g_object_unref (movie_info);
+        g_main_loop_unref (loop);
+
         return 0;
 }