1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * Copyright (C) 2005 Novell, Inc.
4  *
5  * Caja is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * Caja is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; see the file COPYING.  If not,
17  * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * Author: Anders Carlsson <andersca@imendio.com>
21  *
22  */
23 
24 #ifndef CAJA_SEARCH_ENGINE_H
25 #define CAJA_SEARCH_ENGINE_H
26 
27 #include <glib-object.h>
28 
29 #include "caja-query.h"
30 
31 #define CAJA_TYPE_SEARCH_ENGINE		(caja_search_engine_get_type ())
32 #define CAJA_SEARCH_ENGINE(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_SEARCH_ENGINE, CajaSearchEngine))
33 #define CAJA_SEARCH_ENGINE_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_SEARCH_ENGINE, CajaSearchEngineClass))
34 #define CAJA_IS_SEARCH_ENGINE(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_SEARCH_ENGINE))
35 #define CAJA_IS_SEARCH_ENGINE_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_SEARCH_ENGINE))
36 #define CAJA_SEARCH_ENGINE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_SEARCH_ENGINE, CajaSearchEngineClass))
37 
38 typedef struct CajaSearchEngineDetails CajaSearchEngineDetails;
39 
40 typedef struct CajaSearchEngine
41 {
42     GObject parent;
43     CajaSearchEngineDetails *details;
44 } CajaSearchEngine;
45 
46 typedef struct
47 {
48     GObjectClass parent_class;
49 
50     /* VTable */
51     void (*set_query) (CajaSearchEngine *engine, CajaQuery *query);
52     void (*start) (CajaSearchEngine *engine);
53     void (*stop) (CajaSearchEngine *engine);
54     gboolean (*is_indexed) (CajaSearchEngine *engine);
55 
56     /* Signals */
57     void (*hits_added) (CajaSearchEngine *engine, GList *hits);
58     void (*hits_subtracted) (CajaSearchEngine *engine, GList *hits);
59     void (*finished) (CajaSearchEngine *engine);
60     void (*error) (CajaSearchEngine *engine, const char *error_message);
61 } CajaSearchEngineClass;
62 
63 GType          caja_search_engine_get_type  (void);
64 gboolean       caja_search_engine_enabled (void);
65 
66 CajaSearchEngine* caja_search_engine_new       (void);
67 
68 void           caja_search_engine_set_query (CajaSearchEngine *engine, CajaQuery *query);
69 void	       caja_search_engine_start (CajaSearchEngine *engine);
70 void	       caja_search_engine_stop (CajaSearchEngine *engine);
71 gboolean       caja_search_engine_is_indexed (CajaSearchEngine *engine);
72 
73 void	       caja_search_engine_hits_added (CajaSearchEngine *engine, GList *hits);
74 void	       caja_search_engine_hits_subtracted (CajaSearchEngine *engine, GList *hits);
75 void	       caja_search_engine_finished (CajaSearchEngine *engine);
76 void	       caja_search_engine_error (CajaSearchEngine *engine, const char *error_message);
77 
78 #endif /* CAJA_SEARCH_ENGINE_H */
79