2008-05-05 Paolo Borelli <pborelli@katamail.com>
[nautilus.git] / test / test-nautilus-search-engine.c
blob3113ce455782a843d219897ca7d8e6e6d583e869
1 #include <libnautilus-private/nautilus-search-engine.h>
2 #include <gtk/gtk.h>
4 static void
5 hits_added_cb (NautilusSearchEngine *engine, GSList *hits)
6 {
7 g_print ("hits added\n");
8 while (hits) {
9 g_print (" - %s\n", (char *)hits->data);
10 hits = hits->next;
14 static void
15 hits_subtracted_cb (NautilusSearchEngine *engine, GSList *hits)
17 g_print ("hits subtracted\n");
18 while (hits) {
19 g_print (" - %s\n", (char *)hits->data);
20 hits = hits->next;
24 static void
25 finished_cb (NautilusSearchEngine *engine)
27 g_print ("finished!\n");
28 // gtk_main_quit ();
31 int
32 main (int argc, char* argv[])
34 NautilusSearchEngine *engine;
35 NautilusQuery *query;
37 g_thread_init (NULL);
39 gtk_init (&argc, &argv);
41 engine = nautilus_search_engine_new ();
42 g_signal_connect (engine, "hits-added",
43 G_CALLBACK (hits_added_cb), NULL);
44 g_signal_connect (engine, "hits-subtracted",
45 G_CALLBACK (hits_subtracted_cb), NULL);
46 g_signal_connect (engine, "finished",
47 G_CALLBACK (finished_cb), NULL);
49 query = nautilus_query_new ();
50 nautilus_query_set_text (query, "richard hult");
51 nautilus_search_engine_set_query (engine, query);
52 g_object_unref (query);
54 nautilus_search_engine_start (engine);
56 gtk_main ();
57 return 0;