1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include <libnautilus-private/nautilus-search-engine.h>
#include <gtk/gtk.h>
static void
hits_added_cb (NautilusSearchEngine *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 (NautilusSearchEngine *engine, GSList *hits)
{
g_print ("hits subtracted\n");
while (hits) {
g_print (" - %s\n", (char *)hits->data);
hits = hits->next;
}
}
static void
finished_cb (NautilusSearchEngine *engine)
{
g_print ("finished!\n");
// gtk_main_quit ();
}
int
main (int argc, char* argv[])
{
NautilusSearchEngine *engine;
NautilusQuery *query;
gtk_init (&argc, &argv);
engine = nautilus_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 = nautilus_query_new ();
nautilus_query_set_text (query, "richard hult");
nautilus_search_engine_set_query (engine, query);
g_object_unref (query);
nautilus_search_engine_start (engine);
gtk_main ();
return 0;
}
|