summaryrefslogtreecommitdiff
path: root/test/test-caja-search-engine.c
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 22:24:23 -0300
committerPerberos <[email protected]>2011-12-01 22:24:23 -0300
commit0e004c696b0e68b2cff37a4c3315b022a35eaf43 (patch)
tree43261e815529cb9518ed7be37af13b846af8b26b /test/test-caja-search-engine.c
downloadcaja-0e004c696b0e68b2cff37a4c3315b022a35eaf43.tar.bz2
caja-0e004c696b0e68b2cff37a4c3315b022a35eaf43.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'test/test-caja-search-engine.c')
-rw-r--r--test/test-caja-search-engine.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/test-caja-search-engine.c b/test/test-caja-search-engine.c
new file mode 100644
index 00000000..6a4ace70
--- /dev/null
+++ b/test/test-caja-search-engine.c
@@ -0,0 +1,58 @@
+#include <libcaja-private/caja-search-engine.h>
+#include <gtk/gtk.h>
+
+static void
+hits_added_cb (CajaSearchEngine *engine, GSList *hits)
+{
+ g_print ("hits added\n");
+ while (hits) {
+ g_print (" - %s\n", (char *)hits->data);
+ hits = hits->next;
+ }
+}
+
+static void
+hits_subtracted_cb (CajaSearchEngine *engine, GSList *hits)
+{
+ g_print ("hits subtracted\n");
+ while (hits) {
+ g_print (" - %s\n", (char *)hits->data);
+ hits = hits->next;
+ }
+}
+
+static void
+finished_cb (CajaSearchEngine *engine)
+{
+ g_print ("finished!\n");
+// gtk_main_quit ();
+}
+
+int
+main (int argc, char* argv[])
+{
+ CajaSearchEngine *engine;
+ CajaQuery *query;
+
+ g_thread_init (NULL);
+
+ gtk_init (&argc, &argv);
+
+ engine = caja_search_engine_new ();
+ g_signal_connect (engine, "hits-added",
+ G_CALLBACK (hits_added_cb), NULL);
+ g_signal_connect (engine, "hits-subtracted",
+ G_CALLBACK (hits_subtracted_cb), NULL);
+ g_signal_connect (engine, "finished",
+ G_CALLBACK (finished_cb), NULL);
+
+ query = caja_query_new ();
+ caja_query_set_text (query, "richard hult");
+ caja_search_engine_set_query (engine, query);
+ g_object_unref (query);
+
+ caja_search_engine_start (engine);
+
+ gtk_main ();
+ return 0;
+}