Hi,
currently tracker_add_watch_dir ()/ tracker_remove_watch_dir()/... are
declared at several places.
This patches merges tracker-fam.h and tracker-inotify.h into a single
file tracker-watch.h.
The *.c files have been simplified and now only have to #include
"tracker-watch.h"
I also removed the declaration of this functions from
src/trackerd/tracker-db-sqlite.h and instead used #include
"tracker-watch.h".
This way we avoid duplication and have a single place where the watch
functions are declared.
Please review and add comments. If there are no complaints, I'm going
to commit this soon.
I also intended to move line 139-150 in src/trackerd/trackerd.c
(everything between #ifdef POLL_ONLY #endif) into a separate file
tracker-poll.c. This way we would have a nice separation between
declaration and implementation of the watch functions.
If there is agreement here, I will create a separate resp. updated
patch for that.
Cheers,
Michael
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
Index: src/trackerd/tracker-inotify.c
===================================================================
--- src/trackerd/tracker-inotify.c (Revision 979)
+++ src/trackerd/tracker-inotify.c (Arbeitskopie)
@@ -23,8 +23,18 @@
#include <glib.h>
#include <glib/gstdio.h>
-#include "tracker-inotify.h"
+#include "tracker-watch.h"
+#include "config.h"
+
+
+#ifdef HAVE_INOTIFY_LINUX
+#include <linux/inotify.h>
+#include "linux-inotify-syscalls.h"
+#else
+#include <sys/inotify.h>
+#endif
+
#define INOTIFY_WATCH_LIMIT "/proc/sys/fs/inotify/max_user_watches"
/* project wide global vars */
Index: src/trackerd/tracker-email-utils.c
===================================================================
--- src/trackerd/tracker-email-utils.c (Revision 979)
+++ src/trackerd/tracker-email-utils.c (Arbeitskopie)
@@ -36,16 +36,9 @@
#include "tracker-email-evolution.h"
#include "tracker-email-thunderbird.h"
#include "tracker-email-kmail.h"
+#include "tracker-watch.h"
-#ifdef HAVE_INOTIFY
-# include "tracker-inotify.h"
-#else
-# ifdef HAVE_FAM
-# include "tracker-fam.h"
-# endif
-#endif
-
extern Tracker *tracker;
Index: src/trackerd/tracker-inotify.h
===================================================================
--- src/trackerd/tracker-inotify.h (Revision 979)
+++ src/trackerd/tracker-inotify.h (Arbeitskopie)
@@ -1,47 +0,0 @@
-/* Tracker - indexer and metadata database engine
- * Copyright (C) 2006, Mr Jamie McCracken ([EMAIL PROTECTED])
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-
-#ifndef _TRACKER_INOTIFY_H_
-#define _TRACKER_INOTIFY_H_
-
-#include "config.h"
-
-
-#ifdef HAVE_INOTIFY_LINUX
-#include <linux/inotify.h>
-#include "linux-inotify-syscalls.h"
-#else
-# include <sys/inotify.h>
-#endif
-
-#include "tracker-db.h"
-
-gboolean tracker_start_watching (void);
-void tracker_end_watching (void);
-
-gboolean tracker_add_watch_dir (const char *dir, DBConnection *db_con);
-void tracker_remove_watch_dir (const char *dir, gboolean delete_subdirs, DBConnection *db_con);
-
-gboolean tracker_is_directory_watched (const char *dir, DBConnection *db_con);
-int tracker_count_watch_dirs (void);
-
-
-#endif
Index: src/trackerd/tracker-email-thunderbird.c
===================================================================
--- src/trackerd/tracker-email-thunderbird.c (Revision 979)
+++ src/trackerd/tracker-email-thunderbird.c (Arbeitskopie)
@@ -25,14 +25,8 @@
#include "tracker-email-thunderbird.h"
#include "tracker-db-email.h"
+#include "tracker-watch.h"
-#ifdef HAVE_INOTIFY
-# include "tracker-inotify.h"
-#else
-# ifdef HAVE_FAM
-# include "tracker-fam.h"
-# endif
-#endif
typedef enum
{
Index: src/trackerd/tracker-fam.c
===================================================================
--- src/trackerd/tracker-fam.c (Revision 979)
+++ src/trackerd/tracker-fam.c (Arbeitskopie)
@@ -22,7 +22,7 @@
#include <glib.h>
#include <glib/gstdio.h>
-#include "tracker-fam.h"
+#include "tracker-watch.h"
extern Tracker *tracker;
Index: src/trackerd/trackerd.c
===================================================================
--- src/trackerd/trackerd.c (Revision 979)
+++ src/trackerd/trackerd.c (Arbeitskopie)
@@ -44,13 +44,6 @@
#include "tracker-ioprio.h"
#endif
-#ifdef HAVE_INOTIFY
-# include "tracker-inotify.h"
-#else
-# ifdef HAVE_FAM
-# include "tracker-fam.h"
-# endif
-#endif
#ifndef HAVE_INOTIFY
# ifndef HAVE_FAM
@@ -77,6 +70,7 @@
#include "tracker-email-utils.h"
#include "tracker-cache.h"
#include "tracker-indexer.h"
+#include "tracker-watch.h"
#include "tracker-os-dependant.h"
Index: src/trackerd/tracker-fam.h
===================================================================
--- src/trackerd/tracker-fam.h (Revision 979)
+++ src/trackerd/tracker-fam.h (Arbeitskopie)
@@ -1,36 +0,0 @@
-/* Tracker - indexer and metadata database engine
- * Copyright (C) 2006, Mr Jamie McCracken ([EMAIL PROTECTED])
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-
-#ifndef _TRACKER_FAM_H_
-#define _TRACKER_FAM_H_
-
-#include "tracker-db.h"
-
-gboolean tracker_start_watching (void);
-void tracker_end_watching (void);
-
-gboolean tracker_add_watch_dir (const char *dir, DBConnection *db_con);
-void tracker_remove_watch_dir (const char *dir, gboolean delete_subdirs, DBConnection *db_con);
-
-gboolean tracker_is_directory_watched (const char *dir, DBConnection *db_con);
-int tracker_count_watch_dirs (void);
-
-#endif
Index: src/trackerd/tracker-email-evolution.c
===================================================================
--- src/trackerd/tracker-email-evolution.c (Revision 979)
+++ src/trackerd/tracker-email-evolution.c (Arbeitskopie)
@@ -35,16 +35,9 @@
#include "tracker-db-email.h"
#include "tracker-cache.h"
#include "tracker-dbus.h"
+#include "tracker-watch.h"
-#ifdef HAVE_INOTIFY
-# include "tracker-inotify.h"
-#else
-# ifdef HAVE_FAM
-# include "tracker-fam.h"
-# endif
-#endif
-
#define EVOLUTION_MAIL_DIR_S ".evolution/mail"
Index: src/trackerd/tracker-watch.h
===================================================================
--- src/trackerd/tracker-watch.h (Revision 978)
+++ src/trackerd/tracker-watch.h (Arbeitskopie)
@@ -19,19 +19,10 @@
-#ifndef _TRACKER_INOTIFY_H_
-#define _TRACKER_INOTIFY_H_
+#ifndef _TRACKER_WATCH_H_
+#define _TRACKER_WATCH_H_
-#include "config.h"
-
-#ifdef HAVE_INOTIFY_LINUX
-#include <linux/inotify.h>
-#include "linux-inotify-syscalls.h"
-#else
-# include <sys/inotify.h>
-#endif
-
#include "tracker-db.h"
gboolean tracker_start_watching (void);
Index: src/trackerd/tracker-email-kmail.c
===================================================================
--- src/trackerd/tracker-email-kmail.c (Revision 979)
+++ src/trackerd/tracker-email-kmail.c (Arbeitskopie)
@@ -27,16 +27,9 @@
#include "tracker-email-kmail.h"
#include "tracker-email-utils.h"
#include "tracker-db-email.h"
+#include "tracker-watch.h"
-#ifdef HAVE_INOTIFY
-# include "tracker-inotify.h"
-#else
-# ifdef HAVE_FAM
-# include "tracker-fam.h"
-# endif
-#endif
-
typedef struct {
gchar *imap_path;
gchar *file;
Index: src/trackerd/tracker-db-sqlite.c
===================================================================
--- src/trackerd/tracker-db-sqlite.c (Revision 979)
+++ src/trackerd/tracker-db-sqlite.c (Arbeitskopie)
@@ -41,6 +41,7 @@
#include "tracker-cache.h"
#include "tracker-metadata.h"
#include "tracker-utils.h"
+#include "tracker-watch.h"
#include "config.h"
Index: src/trackerd/tracker-db-sqlite.h
===================================================================
--- src/trackerd/tracker-db-sqlite.h (Revision 979)
+++ src/trackerd/tracker-db-sqlite.h (Arbeitskopie)
@@ -216,11 +216,6 @@
void tracker_db_delete_service (DBConnection *db_con, guint32 id, const char *uri);
-gboolean tracker_add_watch_dir (const char *dir, DBConnection *db_con);
-void tracker_remove_watch_dir (const char *dir, gboolean delete_subdirs, DBConnection *db_con);
-gboolean tracker_is_directory_watched (const char *dir, DBConnection *db_con);
-int tracker_count_watch_dirs (void);
-
FieldData * tracker_db_get_metadata_field (DBConnection *db_con, const char *service, const char *field_name, int field_count, gboolean is_select, gboolean is_condition);
void tracker_db_start_index_transaction (DBConnection *db_con);
Index: src/trackerd/Makefile.am
===================================================================
--- src/trackerd/Makefile.am (Revision 979)
+++ src/trackerd/Makefile.am (Arbeitskopie)
@@ -16,13 +16,11 @@
if HAVE_INOTIFY
inotify_sources = \
linux-inotify-syscalls.h \
- tracker-inotify.c \
- tracker-inotify.h
+ tracker-inotify.c
else
if HAVE_FAM
fam_sources = \
- tracker-fam.c \
- tracker-fam.h
+ tracker-fam.c
endif
endif
@@ -94,7 +92,8 @@
tracker-utils.h \
tracker-ioprio.c \
tracker-ioprio.h \
- tracker-os-dependant.h
+ tracker-os-dependant.h \
+ tracker-watch.h
if OS_WIN32
trackerd_win_libs = -lws2_32 -lkernel32
_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list