1 /*
2  * Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU 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  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef __TRACKER_MINER_FS_FILES_H__
21 #define __TRACKER_MINER_FS_FILES_H__
22 
23 #include <libtracker-miner/tracker-miner.h>
24 
25 #include "tracker-config.h"
26 
27 G_BEGIN_DECLS
28 
29 #define TRACKER_TYPE_MINER_FILES         (tracker_miner_files_get_type())
30 #define TRACKER_MINER_FILES(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_MINER_FILES, TrackerMinerFiles))
31 #define TRACKER_MINER_FILES_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), TRACKER_TYPE_MINER_FILES, TrackerMinerFilesClass))
32 #define TRACKER_IS_MINER_FILES(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_MINER_FILES))
33 #define TRACKER_IS_MINER_FILES_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c),  TRACKER_TYPE_MINER_FILES))
34 #define TRACKER_MINER_FILES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_MINER_FILES, TrackerMinerFilesClass))
35 
36 typedef struct TrackerMinerFiles TrackerMinerFiles;
37 typedef struct TrackerMinerFilesClass TrackerMinerFilesClass;
38 typedef struct TrackerMinerFilesPrivate TrackerMinerFilesPrivate;
39 
40 struct TrackerMinerFiles {
41 	TrackerMinerFS parent_instance;
42 	TrackerMinerFilesPrivate *private;
43 };
44 
45 struct TrackerMinerFilesClass {
46 	TrackerMinerFSClass parent_class;
47 };
48 
49 GType         tracker_miner_files_get_type                 (void) G_GNUC_CONST;
50 
51 TrackerMiner *tracker_miner_files_new                      (TrackerConfig  *config,
52                                                             GError        **error);
53 
54 /* Convenience functions for --eligible tracker-miner-fs cmdline */
55 gboolean      tracker_miner_files_check_file               (GFile             *file,
56                                                             GSList            *ignored_file_paths,
57                                                             GSList            *ignored_file_patterns);
58 gboolean      tracker_miner_files_check_directory          (GFile             *file,
59                                                             GSList            *index_recursive_directories,
60                                                             GSList            *index_single_directories,
61                                                             GSList            *ignored_directory_paths,
62                                                             GSList            *ignored_directory_patterns);
63 gboolean      tracker_miner_files_check_directory_contents (GFile             *parent,
64                                                             GList             *children,
65                                                             GSList            *ignored_content);
66 gboolean      tracker_miner_files_monitor_directory        (GFile             *file,
67                                                             gboolean           enable_monitors,
68                                                             GSList            *directories_to_check);
69 gboolean      tracker_miner_files_is_file_eligible         (TrackerMinerFiles *miner,
70                                                             GFile             *file);
71 
72 /* Global functions to handle timestamp files */
73 gboolean tracker_miner_files_get_first_index_done (void);
74 void     tracker_miner_files_set_first_index_done (gboolean done);
75 
76 guint64  tracker_miner_files_get_last_crawl_done  (void);
77 void     tracker_miner_files_set_last_crawl_done  (gboolean done);
78 
79 gboolean tracker_miner_files_get_need_mtime_check (void);
80 void     tracker_miner_files_set_need_mtime_check (gboolean needed);
81 
82 void     tracker_miner_files_set_mtime_checking   (TrackerMinerFiles *miner,
83                                                    gboolean           mtime_checking);
84 
85 void     tracker_miner_files_writeback_file       (TrackerMinerFiles *mf,
86                                                    GFile             *file,
87                                                    GStrv              rdf_types,
88                                                    GPtrArray         *results);
89 void     tracker_miner_files_writeback_notify     (TrackerMinerFiles *mf,
90                                                    GFile             *file,
91                                                    const GError      *error);
92 
93 G_END_DECLS
94 
95 #endif /* __TRACKER_MINER_FS_FILES_H__ */
96