1 | /* |
2 | * Copyright (C) 2005 Novell, Inc. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
16 | * |
17 | * Author: Anders Carlsson <andersca@imendio.com> |
18 | * |
19 | * Based on nautilus-search-engine.h |
20 | */ |
21 | |
22 | #ifndef __GTK_SEARCH_ENGINE_H__ |
23 | #define __GTK_SEARCH_ENGINE_H__ |
24 | |
25 | #include "gtkquery.h" |
26 | #include "gtkfilesystemmodel.h" |
27 | #include <gio/gio.h> |
28 | |
29 | G_BEGIN_DECLS |
30 | |
31 | #define GTK_TYPE_SEARCH_ENGINE (_gtk_search_engine_get_type ()) |
32 | #define GTK_SEARCH_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEARCH_ENGINE, GtkSearchEngine)) |
33 | #define GTK_SEARCH_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SEARCH_ENGINE, GtkSearchEngineClass)) |
34 | #define GTK_IS_SEARCH_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEARCH_ENGINE)) |
35 | #define GTK_IS_SEARCH_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SEARCH_ENGINE)) |
36 | #define GTK_SEARCH_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SEARCH_ENGINE, GtkSearchEngineClass)) |
37 | |
38 | typedef struct _GtkSearchEngine GtkSearchEngine; |
39 | typedef struct _GtkSearchEngineClass GtkSearchEngineClass; |
40 | typedef struct _GtkSearchEnginePrivate GtkSearchEnginePrivate; |
41 | typedef struct _GtkSearchHit GtkSearchHit; |
42 | |
43 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkSearchEngine, g_object_unref) |
44 | |
45 | struct _GtkSearchHit |
46 | { |
47 | GFile *file; |
48 | GFileInfo *info; /* may be NULL */ |
49 | }; |
50 | |
51 | struct _GtkSearchEngine |
52 | { |
53 | GObject parent; |
54 | |
55 | GtkSearchEnginePrivate *priv; |
56 | }; |
57 | |
58 | struct _GtkSearchEngineClass |
59 | { |
60 | GObjectClass parent_class; |
61 | |
62 | /* VTable */ |
63 | void (*set_query) (GtkSearchEngine *engine, |
64 | GtkQuery *query); |
65 | void (*start) (GtkSearchEngine *engine); |
66 | void (*stop) (GtkSearchEngine *engine); |
67 | |
68 | /* Signals */ |
69 | void (*hits_added) (GtkSearchEngine *engine, |
70 | GList *hits); |
71 | void (*finished) (GtkSearchEngine *engine); |
72 | void (*error) (GtkSearchEngine *engine, |
73 | const char *error_message); |
74 | }; |
75 | |
76 | GType _gtk_search_engine_get_type (void); |
77 | |
78 | GtkSearchEngine* _gtk_search_engine_new (void); |
79 | |
80 | void _gtk_search_engine_set_query (GtkSearchEngine *engine, |
81 | GtkQuery *query); |
82 | void _gtk_search_engine_start (GtkSearchEngine *engine); |
83 | void _gtk_search_engine_stop (GtkSearchEngine *engine); |
84 | |
85 | void _gtk_search_engine_hits_added (GtkSearchEngine *engine, |
86 | GList *hits); |
87 | void _gtk_search_engine_finished (GtkSearchEngine *engine, |
88 | gboolean got_results); |
89 | void _gtk_search_engine_error (GtkSearchEngine *engine, |
90 | const char *error_message); |
91 | |
92 | void _gtk_search_hit_free (GtkSearchHit *hit); |
93 | GtkSearchHit *_gtk_search_hit_dup (GtkSearchHit *hit); |
94 | |
95 | void _gtk_search_engine_set_model (GtkSearchEngine *engine, |
96 | GtkFileSystemModel *model); |
97 | |
98 | G_END_DECLS |
99 | |
100 | #endif /* __GTK_SEARCH_ENGINE_H__ */ |
101 | |