tracker r1619 - in branches/xesam-support: . data src/libtracker src/libtracker-db src/libtracker-gtk src/tracker-indexer src/trackerd



Author: pvanhoof
Date: Tue Jun 10 09:51:34 2008
New Revision: 1619
URL: http://svn.gnome.org/viewvc/tracker?rev=1619&view=rev

Log:
        * svn merge -r 1608:1618 ../indexer-split



Modified:
   branches/xesam-support/ChangeLog
   branches/xesam-support/configure.ac
   branches/xesam-support/data/sqlite-stored-procs.sql
   branches/xesam-support/src/libtracker-db/tracker-db-dbus.c
   branches/xesam-support/src/libtracker-db/tracker-db-dbus.h
   branches/xesam-support/src/libtracker-db/tracker-db-manager.c
   branches/xesam-support/src/libtracker-gtk/tracker-metadata-tile.c
   branches/xesam-support/src/libtracker/tracker-search.c
   branches/xesam-support/src/libtracker/tracker-tag.c
   branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
   branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h
   branches/xesam-support/src/tracker-indexer/tracker-indexer.c
   branches/xesam-support/src/tracker-indexer/tracker-main.c
   branches/xesam-support/src/trackerd/Makefile.am
   branches/xesam-support/src/trackerd/tracker-files.c
   branches/xesam-support/src/trackerd/tracker-keywords.c
   branches/xesam-support/src/trackerd/tracker-main.c
   branches/xesam-support/src/trackerd/tracker-metadata.c
   branches/xesam-support/src/trackerd/tracker-search.c
   branches/xesam-support/src/trackerd/tracker-watcher.h

Modified: branches/xesam-support/configure.ac
==============================================================================
--- branches/xesam-support/configure.ac	(original)
+++ branches/xesam-support/configure.ac	Tue Jun 10 09:51:34 2008
@@ -79,6 +79,15 @@
 AC_SUBST(LIBPNG_CFLAGS)
 AC_SUBST(LIBPNG_LIBS)
 
+# Check we have the DBUS binding tool we need
+AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool)
+if test -z $DBUSBINDINGTOOL; then
+        AC_MSG_ERROR([Could not find 'dbus-binding-tool'])
+fi
+
+GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
+AC_SUBST(GLIB_GENMARSHAL)
+
 ####################################################################
 # DBus Service
 ####################################################################
@@ -152,6 +161,7 @@
 ####################################################################
 # Compiler warning checks
 ####################################################################
+
 AC_ARG_ENABLE(warnings,
               AS_HELP_STRING([--disable-warnings], [disable GCC warnings]),,
               [enable_warnings=yes])
@@ -173,7 +183,6 @@
 # Compiler generate debug code
 ####################################################################
 
-
 AC_ARG_ENABLE([debug_code],
               AS_HELP_STRING([--enable-debug-code], [build with debug symbols]),,
               [enable_debug_code=no])
@@ -195,32 +204,6 @@
 IT_PROG_INTLTOOL([0.35.0])
 
 ####################################################################
-# check for newer glib (>= 2.12.0) for g_option_context_set_summary ()
-# availability
-# used as well in tracker-configuration.c and tracker-metadata-tile.c
-# for other methods availability
-####################################################################
-RECENT_GLIB=2.12.0
-
-PKG_CHECK_MODULES(glib2, [ glib-2.0 >= $RECENT_GLIB ],
-                  [have_recent_glib=yes], [have_recent_glib=no])
-
-if test "$have_recent_glib" = "yes" ; then
-   AC_DEFINE(HAVE_RECENT_GLIB, 1, [Define if we have recent glib])
-fi
-
-AM_CONDITIONAL(HAVE_RECENT_GLIB, test "$have_recent_glib" = "yes")
-
-# Check we have the DBUS binding tool we need
-AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool)
-if test -z $DBUSBINDINGTOOL; then
-        AC_MSG_ERROR([Could not find 'dbus-binding-tool'])
-fi
-
-GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
-AC_SUBST(GLIB_GENMARSHAL)
-
-####################################################################
 # External QDBM check
 ####################################################################
 
@@ -391,8 +374,6 @@
 AC_SUBST(SQLITE3_CFLAGS)
 AC_SUBST(SQLITE3_LIBS)
 
-
-
 ###############################################################################
 # Check for file monitor backends
 ###############################################################################
@@ -847,37 +828,44 @@
 AC_OUTPUT
 
 echo "
-Tracker-$VERSION:
+Build Configuration:
 
 	prefix:					${prefix}
 	source code location:			${srcdir}
 	compiler:				${CC}
-	enable gcc warnings:			$enable_warnings
-	build with debug symbols:		$enable_debug_code
-	file monitor backend to be used:	$primary_backend
-	inotify header location:		$inotify_header
-	ioprio support:				$have_ioprio
-	Win32:					$native_win32
-	HAL support:                    	$have_hal
-	unac accent stripper support:		$enable_unac
-	deskbar-applet support:			$enable_deskbar_applet
-	build search tool (GNOME):		$have_gnome
-	build preferences ui:			$enable_preferences
+
+	win32:					$native_win32
+
+	enable warnings:			$enable_warnings
+	enable debug symbols:    		$enable_debug_code
+
+	enable unac accent stripper:	  	$enable_unac
+
+	support for file monitoring:           	$primary_backend
+	support for ioprio:			$have_ioprio
+	support for HAL:                    	$have_hal
+
+Applications:
+
+	build deskbar-applet:			$enable_deskbar_applet
+	build tracker-search-tool:	        $have_gnome
+	build tracker-preferences:		$enable_preferences
+	build tracker-applet:	                $enable_trackerapplet
 	build libtracker-gtk:			$enable_libtrackergtk
-	tracker applet notification icon:	$enable_trackerapplet
 
-Metadata extractors:
+Metadata Extractors:
 
-	pdf:					$have_poppler
 	png:					yes
+	pdf:					$have_poppler
 	exif (jpeg):				$have_libexif
-	ms and openoffice (gsf):		$have_libgsf
+	ms & openoffice (gsf):		        $have_libgsf
+	xml / html formats:			$have_libxml2
+	embedded / sidecar xmp:			$have_exempi
 	video files:				$videos_are_handled ($videos_handler)
-	xml/html formats:			$have_libxml2
-	embedded/sidecar xmp:			$have_exempi
 
-"
+Warning:
+
+        You must make sure SQLite is compiled with --enable-threadsafe
+	otherwise expect pain!
 
-echo "
-****WARNING**** : You must make sure a version of SQLite compiled with --enable-threadsafe is available otherwise expect pain!
 "

Modified: branches/xesam-support/data/sqlite-stored-procs.sql
==============================================================================
--- branches/xesam-support/data/sqlite-stored-procs.sql	(original)
+++ branches/xesam-support/data/sqlite-stored-procs.sql	Tue Jun 10 09:51:34 2008
@@ -81,7 +81,7 @@
 
 GetByServiceType SELECT  DISTINCT F.Path || '/' || F.Name as uri  FROM Services F WHERE F.ServiceTypeID in (select TypeId from common.ServiceTypes where TypeName = ? or Parent = ?) LIMIT ?,?;
 
-SaveServiceContents REPLACE into ServiceContents (ServiceID, MetadataID, Content) values (?,?,?);
+SaveServiceContents REPLACE into ServiceContents (ServiceID, MetadataID, Content) values (?,?,compress (?));
 DeleteContent DELETE FROM ServiceContents where ServiceID = ? and MetadataId = ?;
 DeleteAllContents DELETE FROM ServiceContents where ServiceID = ?;
 GetContents Select uncompress (Content) from ServiceContents where ServiceID = ? and MetadataID = ? and Content is not null;

Modified: branches/xesam-support/src/libtracker-db/tracker-db-dbus.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-dbus.c	(original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-dbus.c	Tue Jun 10 09:51:34 2008
@@ -25,6 +25,7 @@
 
 gchar **
 tracker_dbus_query_result_to_strv (TrackerDBResultSet *result_set, 
+				   gint                column,
                                    gint               *count)
 {
 	gchar **strv = NULL;
@@ -38,7 +39,7 @@
 		strv = g_new (gchar*, rows + 1);
 		
 		while (valid) {
-			tracker_db_result_set_get (result_set, 0, &strv[i], -1);
+			tracker_db_result_set_get (result_set, column, &strv[i], -1);
 			valid = tracker_db_result_set_iter_next (result_set);
 			i++;
 		}

Modified: branches/xesam-support/src/libtracker-db/tracker-db-dbus.h
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-dbus.h	(original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-dbus.h	Tue Jun 10 09:51:34 2008
@@ -29,6 +29,7 @@
 #include "tracker-db-interface.h"
 
 gchar **    tracker_dbus_query_result_to_strv       (TrackerDBResultSet *result_set,
+						     gint                column,
 						     gint               *count);
 GHashTable *tracker_dbus_query_result_to_hash_table (TrackerDBResultSet *result_set);
 GPtrArray * tracker_dbus_query_result_to_ptr_array  (TrackerDBResultSet *result_set);

Modified: branches/xesam-support/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-manager.c	(original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-manager.c	Tue Jun 10 09:51:34 2008
@@ -127,6 +127,7 @@
 						gboolean            attach_all);
 
 static gboolean      initialized;
+static gboolean      attach_all;
 static GHashTable   *prepared_queries;
 static gchar        *services_dir;
 static gchar        *sql_dir;
@@ -151,8 +152,7 @@
 }
 
 void 
-set_up_databases (gboolean     attach_all,
-		  const gchar *data_dir,
+set_up_databases (const gchar *data_dir,
 		  const gchar *user_data_dir,
 		  const gchar *sys_tmp_root_dir)
 {
@@ -169,7 +169,6 @@
                                              sys_tmp_root_dir);
                 
                 dbs[i].abs_filename = g_build_filename (dir, dbs[i].file, NULL);
-		dbs[i].iface = db_interface_create (i, attach_all);
         }
 
 	g_message ("Setting up all databases completed");
@@ -1193,6 +1192,97 @@
 	return buf;
 }
 
+static GByteArray *
+function_compress_string (const gchar *text)
+{
+	GByteArray *array;
+	z_stream zs;
+	gchar *buf, *swap;
+	guchar obuf[ZLIBBUFSIZ];
+	gint rv, asiz, bsiz, osiz, size;
+
+	size = strlen (text);
+
+	zs.zalloc = Z_NULL;
+	zs.zfree = Z_NULL;
+	zs.opaque = Z_NULL;
+
+	if (deflateInit2 (&zs, 6, Z_DEFLATED, 15, 6, Z_DEFAULT_STRATEGY) != Z_OK) {
+		return NULL;
+	}
+
+	asiz = size + 16;
+
+	if (asiz < ZLIBBUFSIZ) {
+		asiz = ZLIBBUFSIZ;
+	}
+
+	if (!(buf = malloc (asiz))) {
+		deflateEnd (&zs);
+		return NULL;
+	}
+
+	bsiz = 0;
+	zs.next_in = (unsigned char *) text;
+	zs.avail_in = size;
+	zs.next_out = obuf;
+	zs.avail_out = ZLIBBUFSIZ;
+
+	while ((rv = deflate (&zs, Z_FINISH)) == Z_OK) {
+		osiz = ZLIBBUFSIZ - zs.avail_out;
+
+		if (bsiz + osiz > asiz) {
+			asiz = asiz * 2 + osiz;
+
+			if (!(swap = realloc (buf, asiz))) {
+				free (buf);
+				deflateEnd (&zs);
+				return NULL;
+			}
+
+			buf = swap;
+		}
+
+		memcpy (buf + bsiz, obuf, osiz);
+		bsiz += osiz;
+		zs.next_out = obuf;
+		zs.avail_out = ZLIBBUFSIZ;
+	}
+
+	if (rv != Z_STREAM_END) {
+		free (buf);
+		deflateEnd (&zs);
+		return NULL;
+	}
+
+	osiz = ZLIBBUFSIZ - zs.avail_out;
+
+	if (bsiz + osiz + 1 > asiz) {
+		asiz = asiz * 2 + osiz;
+
+		if (!(swap = realloc (buf, asiz))) {
+			free (buf);
+			deflateEnd (&zs);
+			return NULL;
+		}
+
+		buf = swap;
+	}
+
+	memcpy (buf + bsiz, obuf, osiz);
+	bsiz += osiz;
+	buf[bsiz] = '\0';
+
+	array = g_byte_array_new ();
+	g_byte_array_append (array, (const guint8 *) buf, bsiz);
+
+	g_free (buf);
+
+	deflateEnd (&zs);
+
+	return array;
+}
+
 static GValue
 function_uncompress (TrackerDBInterface *interface,
 		     gint                argc,
@@ -1224,6 +1314,30 @@
 	return result;
 }
 
+static GValue
+function_compress (TrackerDBInterface *interface,
+		   gint                argc,
+		   GValue              values[])
+{
+	GByteArray *array;
+	GValue result = { 0, };
+	const gchar *text;
+
+	text = g_value_get_string (&values[0]);
+
+	array = function_compress_string (text);
+
+	if (!array) {
+		g_warning ("Compress failed");
+		return result;
+	}
+
+	g_value_init (&result, TRACKER_TYPE_DB_BLOB);
+	g_value_take_boxed (&result, array);
+
+	return result;
+}
+
 static void
 db_set_params (TrackerDBInterface *iface,
 	       gint                cache_size,
@@ -1538,7 +1652,10 @@
 						     "uncompress", 
 						     function_uncompress, 
 						     1);
-
+	tracker_db_interface_sqlite_create_function (iface,
+						     "compress",
+						     function_compress,
+						     1);
 	return iface;
 }
 
@@ -1583,7 +1700,10 @@
 						     "uncompress", 
 						     function_uncompress, 
 						     1);
-
+	tracker_db_interface_sqlite_create_function (iface,
+						     "compress",
+						     function_compress,
+						     1);
 	return iface;
 }
 
@@ -1819,7 +1939,7 @@
 }
 
 static TrackerDBInterface *
-db_interface_create (TrackerDB db, 
+db_interface_create (TrackerDB db,
 		     gboolean  attach_all)
 {
 	switch (db) {
@@ -1905,6 +2025,7 @@
 		return;
 	}
 
+	attach_all = attach_all_dbs;
 
 	/* Since we don't reference this enum anywhere, we do
 	 * it here to make sure it exists when we call
@@ -1936,8 +2057,7 @@
 	load_prepared_queries ();
 
 	/* Configure database locations and interfaces */
-	set_up_databases (attach_all_dbs, 
-			  data_dir, 
+	set_up_databases (data_dir, 
 			  user_data_dir, 
 			  sys_tmp_dir);
 
@@ -1959,8 +2079,10 @@
                         g_free (dbs[i].abs_filename);
 			dbs[i].abs_filename = NULL;
 
-			g_object_unref (dbs[i].iface);
-			dbs[i].iface = NULL;
+			if (dbs[i].iface) {
+				g_object_unref (dbs[i].iface);
+				dbs[i].iface = NULL;
+			}
                 }
         }
 
@@ -1994,6 +2116,10 @@
 TrackerDBInterface *
 tracker_db_manager_get_db_interface (TrackerDB db)
 {
+	if (!dbs[db].iface) {
+		dbs[db].iface = db_interface_create (db, attach_all);
+	}
+
 	return dbs[db].iface;
 }
 
@@ -2042,9 +2168,9 @@
 		}
 
 		if (i == TRACKER_DB_FILE_METADATA) { 
-			return dbs[TRACKER_DB_FILE_CONTENTS].iface;
+			return tracker_db_manager_get_db_interface (TRACKER_DB_FILE_CONTENTS);
 		} else if (i == TRACKER_DB_EMAIL_METADATA) { 
-			return dbs[TRACKER_DB_EMAIL_CONTENTS].iface;
+			return tracker_db_manager_get_db_interface (TRACKER_DB_EMAIL_CONTENTS);
 		}
 	}	
 

Modified: branches/xesam-support/src/libtracker-gtk/tracker-metadata-tile.c
==============================================================================
--- branches/xesam-support/src/libtracker-gtk/tracker-metadata-tile.c	(original)
+++ branches/xesam-support/src/libtracker-gtk/tracker-metadata-tile.c	Tue Jun 10 09:51:34 2008
@@ -33,146 +33,6 @@
 
 #define TRACKER_METADATA_TILE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_METADATA_TILE, TrackerMetadataTilePrivate))
 
-#ifndef HAVE_RECENT_GLIB
-/**********************************************************************
- *
- * The following functions are copied from the GLIB 2.12
- * source code, to lower requirement on glib to 2.10 that ships with 
- * Dapper
- *
- **********************************************************************/
-
-/* converts a broken down date representation, relative to UTC, to
- * a timestamp; it uses timegm() if it's available. */
-static time_t
-mktime_utc (struct tm *tm)
-{
-  time_t retval;
-  
-#ifndef HAVE_TIMEGM
-  static const gint days_before[] =
-  {
-    0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
-  };
-#endif
-
-#ifndef HAVE_TIMEGM
-  if (tm->tm_mon < 0 || tm->tm_mon > 11)
-    return (time_t) -1;
-
-  retval = (tm->tm_year - 70) * 365;
-  retval += (tm->tm_year - 68) / 4;
-  retval += days_before[tm->tm_mon] + tm->tm_mday - 1;
-  
-  if (tm->tm_year % 4 == 0 && tm->tm_mon < 2)
-    retval -= 1;
-  
-  retval = ((((retval * 24) + tm->tm_hour) * 60) + tm->tm_min) * 60 + tm->tm_sec;
-#else
-  retval = timegm (tm);
-#endif /* !HAVE_TIMEGM */
-  
-  return retval;
-}
-
-
-
-/**
-* g_time_val_from_iso8601:
-* @iso_date: a ISO 8601 encoded date string
-* @time_: a #GTimeVal
-*
-* Converts a string containing an ISO 8601 encoded date and time
-* to a #GTimeVal and puts it into @time_.
-*
-* Return value: %TRUE if the conversion was successful.
-*
-*/
-gboolean
-g_time_val_from_iso8601 (const gchar *iso_date,
-                         GTimeVal    *time_)
-{
-  struct tm tm;
-  long val;
-
-  g_return_val_if_fail (iso_date != NULL, FALSE);
-  g_return_val_if_fail (time_ != NULL, FALSE);
- 
-  val = strtoul (iso_date, (char **)&iso_date, 10);
-   if (*iso_date == '-')
-     {
-       /* YYYY-MM-DD */
-      tm.tm_year = val - 1900;
-      iso_date++;
-      tm.tm_mon = strtoul (iso_date, (char **)&iso_date, 10) - 1;
-      
-      if (*iso_date++ != '-')
-        return FALSE;
-      
-      tm.tm_mday = strtoul (iso_date, (char **)&iso_date, 10);
-    }
-  else
-    {
-      /* YYYYMMDD */
-      tm.tm_mday = val % 100;
-      tm.tm_mon = (val % 10000) / 100 - 1;
-      tm.tm_year = val / 10000 - 1900;
-    }
-
-  if (*iso_date++ != 'T')
-    return FALSE;
-  
-  val = strtoul (iso_date, (char **)&iso_date, 10);
-  if (*iso_date == ':')
-    {
-      /* hh:mm:ss */
-      tm.tm_hour = val;
-      iso_date++;
-      tm.tm_min = strtoul (iso_date, (char **)&iso_date, 10);
-      
-      if (*iso_date++ != ':')
-        return FALSE;
-      
-      tm.tm_sec = strtoul (iso_date, (char **)&iso_date, 10);
-    }
-  else
-    {
-      /* hhmmss */
-      tm.tm_sec = val % 100;
-      tm.tm_min = (val % 10000) / 100;
-      tm.tm_hour = val / 10000;
-    }
-
-  time_->tv_sec = mktime_utc (&tm);
-  time_->tv_usec = 1;
-  
-  if (*iso_date == '.')
-    time_->tv_usec = strtoul (iso_date + 1, (char **)&iso_date, 10);
-    
-  if (*iso_date == '+' || *iso_date == '-')
-    {
-      gint sign = (*iso_date == '+') ? -1 : 1;
-      
-      val = 60 * strtoul (iso_date + 1, (char **)&iso_date, 10);
-      
-      if (*iso_date == ':')
-        val = 60 * val + strtoul (iso_date + 1, NULL, 10);
-      else
-        val = 60 * (val / 100) + (val % 100);
-
-      time_->tv_sec += (time_t) (val * sign);
-    }
-
-  return TRUE;
-}
-/**********************************************************************
- *
- *                     End of copied functions.
- *
- **********************************************************************/
-#endif /* HAVE_RECENT_GLIB */
-
-
 G_DEFINE_TYPE (TrackerMetadataTile, tracker_metadata_tile, GTK_TYPE_EVENT_BOX)
 
 struct TrackerMetadataTilePrivate {

Modified: branches/xesam-support/src/libtracker/tracker-search.c
==============================================================================
--- branches/xesam-support/src/libtracker/tracker-search.c	(original)
+++ branches/xesam-support/src/libtracker/tracker-search.c	Tue Jun 10 09:51:34 2008
@@ -97,11 +97,7 @@
 			       _("The list of recognized services is:"),
 			       "\n\tDocuments Emails EmailAttachments Music Images Videos Text Development Applications Conversations Folders Files",
 			       NULL);
-
-#ifdef HAVE_RECENT_GLIB
-	g_option_context_set_summary (context, summary);
-#endif /* HAVE_RECENT_GLIB */
-
+        g_option_context_set_summary (context, summary);
 	g_option_context_add_main_entries (context, entries, NULL);
 	g_option_context_parse (context, &argc, &argv, &error);
 

Modified: branches/xesam-support/src/libtracker/tracker-tag.c
==============================================================================
--- branches/xesam-support/src/libtracker/tracker-tag.c	(original)
+++ branches/xesam-support/src/libtracker/tracker-tag.c	Tue Jun 10 09:51:34 2008
@@ -73,11 +73,13 @@
 int 
 main (int argc, char **argv) 
 {
-	TrackerClient *client = NULL;
-	GOptionContext *context = NULL;
-	GError *error = NULL;
-	gchar *example;
-	int i = 0, k;
+	TrackerClient  *client;
+	GOptionContext *context;
+	GError         *error = NULL;
+	gchar          *example;
+        gchar          *summary;
+	gint            i = 0;
+        gint            k;
 
 	setlocale (LC_ALL, "");
 
@@ -85,28 +87,29 @@
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
         textdomain (GETTEXT_PACKAGE);
 
-	/* Translators: this messagge will apper immediately after the  */
-	/* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>     */
+	/* Translators: this messagge will apper immediately after the  
+         * usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>     
+         */
 	context = g_option_context_new (_("FILE... - manipulate tags on files"));
+	example = g_strconcat ( "-a ", _("TAG"), 
+                               " -a ", _("TAG"), 
+                               " -a ", _("TAG"), 
+                               NULL);
+
+	/* Translators: this message will appear after the usage string 
+	 * and before the list of options, showing an usage example.   
+         */
+        summary = g_strconcat (_("To add, remove, or search for multiple tags "
+                                 "at the same time, join multiple options like:"), 
+                               "\n\n\t", 
+                               example, 
+                               NULL);
 
-	example = g_strconcat ("-a ", _("TAG"), " -a ", _("TAG"), " -a ", _("TAG"), NULL);
-
-
-#ifdef HAVE_RECENT_GLIB
-	/* Translators: this message will appear after the usage string */
-	/* and before the list of options, showing an usage example.    */
-	g_option_context_set_summary (context,
-				      g_strconcat(_("To add, remove, or search for multiple tags "
-						    "at the same time, join multiple options like:"), 
-						  "\n\n\t", 
-						  example, NULL));
-
-#endif /* HAVE_RECENT_GLIB */
-
+	g_option_context_set_summary (context, summary);	     
 	g_option_context_add_main_entries (context, entries, NULL);
 	g_option_context_parse (context, &argc, &argv, &error);
-
 	g_option_context_free (context);
+        g_free (summary);
 	g_free (example);
 	
 	if (error) {

Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c	(original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c	Tue Jun 10 09:51:34 2008
@@ -200,3 +200,22 @@
 	g_free (id_str);
 }
 
+void
+tracker_db_set_text (TrackerDBInterface *iface,
+		     guint32             id,
+		     const gchar        *text)
+{
+	TrackerField *field;
+	gchar *id_str;
+
+	id_str = tracker_guint32_to_string (id);
+	field = tracker_ontology_get_field_def ("File:Contents");
+
+	tracker_db_interface_execute_procedure (iface, NULL,
+						"SaveServiceContents",
+						id_str,
+						tracker_field_get_id (field),
+						text,
+						NULL);
+	g_free (id_str);
+}

Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h	(original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h	Tue Jun 10 09:51:34 2008
@@ -40,6 +40,9 @@
                                         guint32             id,
                                         TrackerField       *field,
                                         const gchar        *value);
+void     tracker_db_set_text           (TrackerDBInterface *iface,
+					guint32             id,
+					const gchar        *text);
 gboolean tracker_db_create_event       (TrackerDBInterface *iface,
                                         guint32             id,
                                         guint32             service_id,

Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.c	(original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.c	Tue Jun 10 09:51:34 2008
@@ -165,14 +165,6 @@
 		tracker_index_free (priv->index);
 	}
 
-	if (priv->common) {
-		g_object_unref (priv->common);
-	}
-
-	if (priv->metadata) {
-		g_object_unref (priv->metadata);
-	}
-
 	G_OBJECT_CLASS (tracker_indexer_parent_class)->finalize (object);
 }
 
@@ -287,6 +279,7 @@
 
 	priv->common = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
 	priv->metadata = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_METADATA);
+	priv->contents = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_CONTENTS);
 
 	tracker_indexer_set_running (indexer, TRUE);
 
@@ -463,6 +456,7 @@
 		id = tracker_db_get_new_service_id (priv->common);
 
 		if (tracker_db_create_service (priv->metadata, id, service, info->path, metadata)) {
+			gchar *text;
 			guint32 eid;
 
 			eid = tracker_db_get_new_event_id (priv->common);
@@ -472,6 +466,13 @@
 			tracker_db_increment_stats (priv->common, service);
 
 			index_metadata (indexer, id, service, metadata);
+
+			text = tracker_indexer_module_get_text (info->module, info->path);
+
+			if (text) {
+				tracker_db_set_text (priv->contents, id, text);
+				g_free (text);
+			}
 		}
 
 		g_hash_table_destroy (metadata);

Modified: branches/xesam-support/src/tracker-indexer/tracker-main.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-main.c	(original)
+++ branches/xesam-support/src/tracker-indexer/tracker-main.c	Tue Jun 10 09:51:34 2008
@@ -186,7 +186,7 @@
 	TrackerIndexer *indexer;
 	GOptionContext *context;
 	GError	       *error = NULL;
-	gchar	       *summary = NULL;
+	gchar	       *summary;
 	gchar	       *example;
         gchar          *filename;
 
@@ -214,7 +214,6 @@
 			       "-e ", _("DIRECTORY"),
 			       NULL);
 
-#ifdef HAVE_RECENT_GLIB
 	/* Translators: this message will appear after the usage
 	 * string and before the list of options, showing an usage
 	 * example.
@@ -224,9 +223,8 @@
 				     "\n"
 				     "\t%s"),
 				   example);
-	g_option_context_set_summary (context, summary);
-#endif /* HAVE_RECENT_GLIB */
 
+	g_option_context_set_summary (context, summary);
 	g_option_context_add_main_entries (context, entries, NULL);
 	g_option_context_parse (context, &argc, &argv, &error);
 	g_option_context_free (context);

Modified: branches/xesam-support/src/trackerd/Makefile.am
==============================================================================
--- branches/xesam-support/src/trackerd/Makefile.am	(original)
+++ branches/xesam-support/src/trackerd/Makefile.am	Tue Jun 10 09:51:34 2008
@@ -64,7 +64,6 @@
 endif # HAVE_FAM
 endif # HAVE_INOTIFY
 
-
 #
 # Daemon sources
 #

Modified: branches/xesam-support/src/trackerd/tracker-files.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-files.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-files.c	Tue Jun 10 09:51:34 2008
@@ -585,7 +585,7 @@
 						      offset, 
 						      max_hits);
 
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 
 	if (result_set) {
 		g_object_unref (result_set);
@@ -634,7 +634,7 @@
 						   max_hits, 
 						   FALSE);
 
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 
 	if (result_set) {
 		g_object_unref (result_set);
@@ -686,7 +686,7 @@
 						   max_hits, 
 						   TRUE);
 
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 		
 	if (result_set) {
 		g_object_unref (result_set);

Modified: branches/xesam-support/src/trackerd/tracker-keywords.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-keywords.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-keywords.c	Tue Jun 10 09:51:34 2008
@@ -202,7 +202,7 @@
 	result_set = tracker_db_metadata_get (iface, 
 					      id, 
 					      "User:Keywords");
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 
 	if (result_set) {
 		g_object_unref (result_set);
@@ -495,7 +495,7 @@
 	g_debug (query);
 
 	result_set = tracker_db_interface_execute_query (iface, NULL, query);
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 
 	if (result_set) {
 		g_object_unref (result_set);

Modified: branches/xesam-support/src/trackerd/tracker-main.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-main.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-main.c	Tue Jun 10 09:51:34 2008
@@ -680,6 +680,7 @@
 	GError         *error = NULL;
 	GSList         *l;
 	gchar          *example;
+	gchar          *summary;
 	gboolean        need_index;
 
         g_type_init ();
@@ -708,22 +709,20 @@
 			       " -e ", _("DIRECTORY"),
 			       NULL);
 
-#ifdef HAVE_RECENT_GLIB
-        /* Translators: this message will appear after the usage string */
-        /* and before the list of options, showing an usage example.    */
-        g_option_context_set_summary (context,
-                                      g_strconcat(_("To include or exclude multiple directories "
-                                                    "at the same time, join multiple options like:"),
-
-                                                  "\n\n\t",
-                                                  example, 
-						  NULL));
-
-#endif /* HAVE_RECENT_GLIB */
+        /* Translators: this message will appear after the usage string 
+         * and before the list of options, showing an usage example.   
+	 */
+	summary = g_strconcat (_("To include or exclude multiple directories "
+				 "at the same time, join multiple options like:"),
+			       "\n\n\t",
+			       example, 
+			       NULL);
 
+        g_option_context_set_summary (context, summary);
 	g_option_context_add_main_entries (context, entries, NULL);
 	g_option_context_parse (context, &argc, &argv, &error);
 	g_option_context_free (context);
+	g_free (summary);
 	g_free (example);
 
 	if (error) {

Modified: branches/xesam-support/src/trackerd/tracker-metadata.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-metadata.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-metadata.c	Tue Jun 10 09:51:34 2008
@@ -185,7 +185,7 @@
 	g_debug (query);
 
 	result_set = tracker_db_interface_execute_query (iface, NULL, query);
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 	g_free (query);
 
 	if (result_set) {
@@ -425,11 +425,11 @@
 				  "class:'%s'",
 				  class);
 
-	iface = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_METADATA);
+	iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
 
-	result_set = tracker_db_metadata_get_types (iface, class, TRUE);
+	result_set = tracker_db_metadata_get_types (iface, class, FALSE);
 	if (result_set) {
-		*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+		*values = tracker_dbus_query_result_to_strv (result_set, 1, NULL);
 		g_object_unref (result_set);
 	}
 
@@ -466,7 +466,7 @@
 						    class_formatted, 
 						    TRUE);
 	if (result_set) {
-		*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+		*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 		g_object_unref (result_set);
 	}
 
@@ -500,7 +500,7 @@
 					   NULL);
 	
 	if (result_set) {
-		*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+		*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 		g_object_unref (result_set);
 	}
 

Modified: branches/xesam-support/src/trackerd/tracker-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-search.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-search.c	Tue Jun 10 09:51:34 2008
@@ -1090,7 +1090,7 @@
 	/* 					 text,  */
 	/* 					 offset,  */
 	/* 					 search_sanity_check_max_hits (max_hits)); */
-	*values = tracker_dbus_query_result_to_strv (result_set, NULL);
+	*values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
 
 	if (result_set) {
 		g_object_unref (result_set);

Modified: branches/xesam-support/src/trackerd/tracker-watcher.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-watcher.h	(original)
+++ branches/xesam-support/src/trackerd/tracker-watcher.h	Tue Jun 10 09:51:34 2008
@@ -28,12 +28,12 @@
 
 gboolean tracker_watcher_init           (void);
 void     tracker_watcher_shutdown       (void);
-gboolean tracker_watcher_add_dir        (const char         *dir,
+gboolean tracker_watcher_add_dir        (const gchar        *dir,
 					 TrackerDBInterface *iface);
-void     tracker_watcher_remove_dir     (const char         *dir,
+void     tracker_watcher_remove_dir     (const gchar        *dir,
 					 gboolean            delete_subdirs,
 					 TrackerDBInterface *iface);
-gboolean tracker_watcher_is_dir_watched (const char         *dir,
+gboolean tracker_watcher_is_dir_watched (const gchar        *dir,
 					 TrackerDBInterface *iface);
 gint     tracker_watcher_get_dir_count  (void);
 



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