tracker r1528 - in branches/indexer-split: . data src/libtracker-common src/tracker-indexer/modules src/trackerd



Author: mr
Date: Thu May 29 11:29:59 2008
New Revision: 1528
URL: http://svn.gnome.org/viewvc/tracker?rev=1528&view=rev

Log:
	* src/tracker-indexer/modules/Makefile.am: Reorder some of the
	linking so it is done in the right order. This doesn't matter on
	Linux, but it does on Windows. Linking must occur with the system
	deps last. Yes that sucks.

	* src/trackerd/Makefile.am:
	* src/trackerd/tracker-dbus.[ch]:
	* src/trackerd/tracker-main.c: Added the tracker-indexer.xml file
	to the Makefile here but to produce the client side API so we can
	call _set_running() on the indexer to exec() the binary and start
	indexing when we are ready. So now we start the indexer when it is
	needed through DBus.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/data/Makefile.am
   branches/indexer-split/src/libtracker-common/tracker-hal.c
   branches/indexer-split/src/libtracker-common/tracker-hal.h
   branches/indexer-split/src/tracker-indexer/modules/Makefile.am
   branches/indexer-split/src/trackerd/Makefile.am
   branches/indexer-split/src/trackerd/tracker-dbus.c
   branches/indexer-split/src/trackerd/tracker-dbus.h
   branches/indexer-split/src/trackerd/tracker-main.c

Modified: branches/indexer-split/data/Makefile.am
==============================================================================
--- branches/indexer-split/data/Makefile.am	(original)
+++ branches/indexer-split/data/Makefile.am	Thu May 29 11:29:59 2008
@@ -27,7 +27,7 @@
 org.freedesktop.Tracker_servicedir = $(DBUS_SERVICES_DIR)
 org.freedesktop.Tracker_service_DATA = org.freedesktop.Tracker.service
 
-org.freedesktop.Tracker.Indexer_servicedir = $(DBUS_SERVICES_DIR) 
+org.freedesktop.Tracker.Indexer_servicedir = $(DBUS_SERVICES_DIR)
 org.freedesktop.Tracker.Indexer_service_DATA = org.freedesktop.Tracker.Indexer.service
 
 %.service: %.service.in

Modified: branches/indexer-split/src/libtracker-common/tracker-hal.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-hal.c	(original)
+++ branches/indexer-split/src/libtracker-common/tracker-hal.c	Thu May 29 11:29:59 2008
@@ -19,7 +19,7 @@
  * Boston, MA  02110-1301, USA.
  */
 
-#include <config.h>
+#include "config.h"
 
 #ifdef HAVE_HAL
 

Modified: branches/indexer-split/src/libtracker-common/tracker-hal.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-hal.h	(original)
+++ branches/indexer-split/src/libtracker-common/tracker-hal.h	Thu May 29 11:29:59 2008
@@ -21,8 +21,8 @@
 
 #ifdef HAVE_HAL
 
-#ifndef __TRACKERD_HAL_H__
-#define __TRACKERD_HAL_H__
+#ifndef __LIBTRACKER_HAL_H__
+#define __LIBTRACKER_HAL_H__
 
 #include <glib-object.h>
 
@@ -56,6 +56,6 @@
 
 G_END_DECLS
 
-#endif /* __TRACKERD_HAL_H__ */
+#endif /* __LIBTRACKER_HAL_H__ */
 
 #endif /* HAVE_HAL */

Modified: branches/indexer-split/src/tracker-indexer/modules/Makefile.am
==============================================================================
--- branches/indexer-split/src/tracker-indexer/modules/Makefile.am	(original)
+++ branches/indexer-split/src/tracker-indexer/modules/Makefile.am	Thu May 29 11:29:59 2008
@@ -6,26 +6,36 @@
 	-DLIBDIR=\""$(libdir)"\"					\
 	-DLOCALEDIR=\""$(localedir)"\" 					\
 	-DINDEXER_MODULES_DIR=\"$(indexer_modulesdir)\"			\
-	$(GLIB2_CFLAGS)							\
+	-I$(top_srcdir)/src						\
 	$(GMODULE_CFLAGS)						\
-	-I$(top_srcdir)/src
+	$(GLIB2_CFLAGS)
 
 indexer_modules_LTLIBRARIES = 						\
 	libtracker-indexer-applications.la				\
 	libtracker-indexer-files.la					\
 	libtracker-indexer-gaim-conversations.la
 
+# Applications module
 libtracker_indexer_applications_la_SOURCES = applications.c
 libtracker_indexer_applications_la_LDFLAGS = $(module_flags)
-libtracker_indexer_applications_la_LIBADD = $(GLIB2_LIBS)
+libtracker_indexer_applications_la_LIBADD = 				\
+	$(GMODULE_LIBS)							\
+	$(GLIB2_LIBS)
 
+# 	$(top_builddir)/src/libtracker-common/libtracker-common.la	
+
+# Files module
 libtracker_indexer_files_la_SOURCES = files.c
 libtracker_indexer_files_la_LDFLAGS = $(module_flags)
 libtracker_indexer_files_la_LIBADD = 					\
-	$(GLIB2_LIBS)							\
 	$(top_builddir)/src/libtracker-db/libtracker-db.la		\
-	$(top_builddir)/src/xdgmime/libxdgmime.la
+	$(top_builddir)/src/xdgmime/libxdgmime.la			\
+	$(GMODULE_LIBS)							\
+	$(GLIB2_LIBS)
 
+# Instant messaging module
 libtracker_indexer_gaim_conversations_la_SOURCES = gaim-conversations.c
 libtracker_indexer_gaim_conversations_la_LDFLAGS = $(module_flags)
-libtracker_indexer_gaim_conversations_la_LIBADD = $(GLIB2_LIBS)
+libtracker_indexer_gaim_conversations_la_LIBADD = 			\
+	$(GMODULE_LIBS)							\
+	$(GLIB2_LIBS)

Modified: branches/indexer-split/src/trackerd/Makefile.am
==============================================================================
--- branches/indexer-split/src/trackerd/Makefile.am	(original)
+++ branches/indexer-split/src/trackerd/Makefile.am	Thu May 29 11:29:59 2008
@@ -161,11 +161,15 @@
 	tracker-dbus-keywords-glue.h					\
 	tracker-dbus-metadata-glue.h					\
 	tracker-dbus-search-glue.h					\
-	tracker-dbus-xesam-glue.h
+	tracker-dbus-xesam-glue.h					\
+	tracker-indexer-client.h
 
 %-glue.h: $(top_builddir)/data/%.xml
 	$(DBUSBINDINGTOOL) --mode=glib-server --output=$@ --prefix=$(subst -,_,$*) $^
 
+%-client.h: $(top_builddir)/data/%.xml
+	$(DBUSBINDINGTOOL) --mode=glib-client --output=$@ --prefix=$(subst -,_,$*) $^
+
 BUILT_SOURCES = 							\
 	$(dbus_sources)							\
 	$(marshal_sources)

Modified: branches/indexer-split/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.c	Thu May 29 11:29:59 2008
@@ -39,11 +39,13 @@
 #include "tracker-dbus-search-glue.h"
 #include "tracker-dbus-xesam.h"
 #include "tracker-dbus-xesam-glue.h"
+#include "tracker-indexer-client.h"
 #include "tracker-utils.h"
 #include "tracker-watch.h"
 
 static DBusGConnection *connection;
 static DBusGProxy      *proxy;
+static DBusGProxy      *proxy_for_indexer;
 static GSList          *objects;
 
 static gboolean
@@ -186,6 +188,11 @@
 		proxy = NULL;
 	}
 
+	if (proxy_for_indexer) {
+		g_object_unref (proxy_for_indexer);
+		proxy_for_indexer = NULL;
+	}
+
 	connection = NULL;
 }
 
@@ -315,3 +322,36 @@
 
         return NULL;
 }
+
+void
+tracker_dbus_start_indexer (void)
+{
+	GError *error = NULL;
+
+	if (!connection) {
+		g_critical ("DBus support must be initialized before starting the indexer!");
+		return;
+	}
+
+	if (!proxy_for_indexer) {
+		/* Get proxy for Service / Path / Interface of the indexer */
+		proxy_for_indexer = dbus_g_proxy_new_for_name (connection,
+							       "org.freedesktop.Tracker.Indexer", 
+ 							       "/org/freedesktop/Tracker/Indexer",
+							       "org.freedesktop.Tracker.Indexer");
+		
+		if (!proxy_for_indexer) {
+			g_critical ("Couldn't create a DBusGProxy to the indexer service");
+			return;
+		}
+	}
+
+	org_freedesktop_Tracker_Indexer_set_running (proxy_for_indexer, 
+						     TRUE, 
+						     &error);
+
+	if (error) {
+		g_warning ("Couldn't start indexer, %s",
+			   error->message);
+	}
+}

Modified: branches/indexer-split/src/trackerd/tracker-dbus.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.h	(original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.h	Thu May 29 11:29:59 2008
@@ -36,6 +36,7 @@
 void     tracker_dbus_shutdown         (void);
 gboolean tracker_dbus_register_objects (Tracker       *tracker);
 GObject *tracker_dbus_get_object       (GType          type);
+void     tracker_dbus_start_indexer    (void);
 
 G_END_DECLS
 

Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-main.c	Thu May 29 11:29:59 2008
@@ -705,11 +705,13 @@
 	g_mutex_unlock (tracker->metadata_check_mutex);
 	g_mutex_unlock (tracker->files_check_mutex);
 
+#if 0
 	/* We wait now for the thread to exit and join, then clean up
 	 * the mutexts and conds. 
 	 */
 	g_message ("Waiting for thread to finish");
 	g_thread_join (thread_to_join);
+#endif
 
 	/* Clean up */
 #if 0
@@ -979,6 +981,27 @@
 			g_critical ("File monitoring failed to start");
 		} 
 		else if (tracker_config_get_enable_indexing (tracker->config)) {
+			gint initial_sleep;
+
+			initial_sleep = tracker_config_get_initial_sleep (tracker->config);
+			g_message ("Sleeping for:%d secs before starting...", initial_sleep);
+			
+			while (initial_sleep > 0) {
+				g_usleep (G_USEC_PER_SEC);
+				
+				initial_sleep --;
+				
+				if (!tracker->is_running || tracker->shutdown) {
+					break;
+				}
+			}
+			
+			if (tracker->is_running && !tracker->shutdown) {
+				g_message ("Starting indexer...");
+				tracker_dbus_start_indexer ();
+			}
+
+#if 0
 			thread = g_thread_create_full ((GThreadFunc) tracker_process_files, 
 						       tracker,
 						       (gulong) tracker_config_get_thread_stack_size (tracker->config),
@@ -986,6 +1009,7 @@
 						       FALSE, 
 						       G_THREAD_PRIORITY_NORMAL, 
 						       NULL);
+#endif
 		} else {
 			g_message ("Indexing disabled, waiting for DBus requests...");
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]