2007/10/31, Michael Biebl <[EMAIL PROTECTED]>:
> 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.
It seems I missed to also merge
src/trackerd/tracker-win-fs-changes.h, which contains redundant
declarations of these functions in my first patches.
I now also cleaned up src/trackerd/trackerd.c and move the polling
implementation into src/trackerd/tracker-poll.c.
Updated and hopefully finally patch attached.
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/tracker-poll.c
===================================================================
--- src/trackerd/tracker-poll.c (Revision 0)
+++ src/trackerd/tracker-poll.c (Revision 0)
@@ -0,0 +1,34 @@
+/* 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.
+ */
+#include <string.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "tracker-watch.h"
+
+extern Tracker *tracker;
+
+gboolean tracker_start_watching (void){tracker->watch_limit = 0; return TRUE;}
+void tracker_end_watching (void){return;}
+
+gboolean tracker_add_watch_dir (const gchar *dir, DBConnection *db_con){return FALSE;}
+void tracker_remove_watch_dir (const gchar *dir, gboolean delete_subdirs, DBConnection *db_con) {return;}
+gboolean tracker_is_directory_watched (const gchar *dir, DBConnection *db_con) {return FALSE;}
+int tracker_count_watch_dirs (void) {return 0;}
+
Index: src/trackerd/trackerd.c
===================================================================
--- src/trackerd/trackerd.c (Revision 979)
+++ src/trackerd/trackerd.c (Arbeitskopie)
@@ -44,22 +44,7 @@
#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
-# ifndef OS_WIN32
-# define POLL_ONLY
-# endif
-# endif
-#endif
-
#ifdef HAVE_HAL
#include <dbus/dbus-glib-lowlevel.h>
#include <libhal.h>
@@ -77,6 +62,7 @@
#include "tracker-email-utils.h"
#include "tracker-cache.h"
#include "tracker-indexer.h"
+#include "tracker-watch.h"
#include "tracker-os-dependant.h"
@@ -142,19 +128,6 @@
static void scan_directory (const gchar *uri, DBConnection *db_con);
-#ifdef POLL_ONLY
-
- gboolean tracker_start_watching (void){tracker->watch_limit = 0; return TRUE;}
- void tracker_end_watching (void){return;}
-
- gboolean tracker_add_watch_dir (const gchar *dir, DBConnection *db_con){return FALSE;}
- void tracker_remove_watch_dir (const gchar *dir, gboolean delete_subdirs, DBConnection *db_con) {return;}
- gboolean tracker_is_directory_watched (const gchar *dir, DBConnection *db_con) {return FALSE;}
- int tracker_count_watch_dirs (void) {return 0;}
-
-
-#endif /* POLL_ONLY */
-
static gchar **no_watch_dirs = NULL;
static gchar **watch_dirs = NULL;
static gchar **crawl_dirs = NULL;
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-win-fs-changes.c
===================================================================
--- src/trackerd/tracker-win-fs-changes.c (Revision 979)
+++ src/trackerd/tracker-win-fs-changes.c (Arbeitskopie)
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include "tracker-win-fs-changes.h"
+#include "tracker-watch.h"
#include <unistd.h>
Index: src/trackerd/tracker-watch.h
===================================================================
--- src/trackerd/tracker-watch.h (Revision 0)
+++ src/trackerd/tracker-watch.h (Revision 0)
@@ -0,0 +1,38 @@
+/* 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_WATCH_H_
+#define _TRACKER_WATCH_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-win-fs-changes.h
===================================================================
--- src/trackerd/tracker-win-fs-changes.h (Revision 979)
+++ src/trackerd/tracker-win-fs-changes.h (Arbeitskopie)
@@ -1,35 +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_WIN_FS_CHANGES_H_
-#define _TRACKER_WIN_FS_CHANGES_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-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)
@@ -14,26 +14,25 @@
if HAVE_INOTIFY
-inotify_sources = \
+watch_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
+watch_sources =tracker-fam.c
+else
+if OS_WIN32
+watch_sources = tracker-win-fs-changes.c
+else
+watch_sources = tracker-poll.c
endif
endif
+endif
if OS_WIN32
-win_sources = \
- tracker-win-fs-changes.c \
- tracker-win-fs-changes.h \
- tracker-os-dependant-win.c
+win_sources = tracker-os-dependant-win.c
else
-unix_sources = \
- tracker-os-dependant-unix.c
+unix_sources = tracker-os-dependant-unix.c
endif
db_sources = \
@@ -53,8 +52,7 @@
trackerd_SOURCES = \
trackerd.c \
- $(inotify_sources) \
- $(fam_sources) \
+ $(watch_sources) \
$(win_sources) \
$(unix_sources) \
$(db_sources) \
@@ -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