tracker r1988 - in branches/indexer-split: . src/tracker-indexer src/tracker-indexer/modules
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1988 - in branches/indexer-split: . src/tracker-indexer src/tracker-indexer/modules
- Date: Mon, 4 Aug 2008 10:05:59 +0000 (UTC)
Author: ifrade
Date: Mon Aug 4 10:05:59 2008
New Revision: 1988
URL: http://svn.gnome.org/viewvc/tracker?rev=1988&view=rev
Log:
Ask the module for the service type of an URI
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/tracker-indexer/modules/dummy.c
branches/indexer-split/src/tracker-indexer/modules/files.c
branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c
branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h
branches/indexer-split/src/tracker-indexer/tracker-indexer.c
branches/indexer-split/src/tracker-indexer/tracker-module.h
Modified: branches/indexer-split/src/tracker-indexer/modules/dummy.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/modules/dummy.c (original)
+++ branches/indexer-split/src/tracker-indexer/modules/dummy.c Mon Aug 4 10:05:59 2008
@@ -60,6 +60,20 @@
return NULL;
}
+gchar *
+tracker_module_file_get_service_type (const gchar *path)
+{
+ /* Implementing this function is optional.
+ *
+ * Return the service type for the incoming path.
+ *
+ * If this function is not implemented, the indexer will use
+ * the name of the module (tracker_module_get_name) as service.
+ *
+ */
+ return NULL;
+}
+
void
tracker_module_file_free_data (gpointer file_data)
{
Modified: branches/indexer-split/src/tracker-indexer/modules/files.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/modules/files.c (original)
+++ branches/indexer-split/src/tracker-indexer/modules/files.c Mon Aug 4 10:05:59 2008
@@ -48,6 +48,19 @@
return "Files";
}
+gchar *
+tracker_module_file_get_service_type (const gchar *uri)
+{
+ gchar *mimetype;
+ gchar *service_type;
+
+ mimetype = tracker_file_get_mime_type (uri);
+ service_type = tracker_ontology_get_service_type_for_mime (mimetype);
+ g_free (mimetype);
+
+ return service_type;
+}
+
static void
tracker_metadata_get_embedded (const char *path,
const char *mimetype,
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c Mon Aug 4 10:05:59 2008
@@ -151,6 +151,20 @@
}
}
+gchar *
+tracker_indexer_module_file_get_service_type (GModule *module,
+ const gchar *path)
+{
+ TrackerModuleFileGetServiceTypeFunc func;
+ if (g_module_symbol (module, "tracker_module_file_get_service_type", (gpointer *) &func)) {
+ return (func) (path);
+ } else {
+ return g_strdup (tracker_indexer_module_get_name (module));
+ }
+
+}
+
+
TrackerMetadata *
tracker_indexer_module_file_get_metadata (GModule *module,
TrackerFile *file)
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h Mon Aug 4 10:05:59 2008
@@ -45,6 +45,8 @@
TrackerFile *file,
gchar **dirname,
gchar **basename);
+gchar * tracker_indexer_module_file_get_service_type (GModule *module,
+ const gchar *path);
TrackerMetadata * tracker_indexer_module_file_get_metadata (GModule *module,
TrackerFile *file);
gchar * tracker_indexer_module_file_get_text (GModule *module,
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c Mon Aug 4 10:05:59 2008
@@ -916,16 +916,7 @@
gchar *text;
guint32 id;
- service_type = g_strdup (tracker_module_config_get_index_service (info->file->module_name));
-
- if (!service_type || !service_type[0]) {
- gchar *mimetype;
-
- g_free (service_type);
- mimetype = tracker_file_get_mime_type (info->file->path);
- service_type = tracker_ontology_get_service_type_for_mime (mimetype);
- g_free (mimetype);
- }
+ service_type = tracker_indexer_module_file_get_service_type (info->module, info->file->path);
service_def = tracker_ontology_get_service_type_by_name (service_type);
g_free (service_type);
@@ -1116,7 +1107,7 @@
field_def = tracker_ontology_get_field_def (property);
if (!field_def) {
- g_message ("Unknow field %d", property);
+ g_message ("Unknow field %s", property);
return FALSE;
}
@@ -1571,7 +1562,6 @@
GError **error) {
guint request_id;
- gboolean result;
GError *actual_error = NULL;
request_id = tracker_dbus_get_next_request_id ();
Modified: branches/indexer-split/src/tracker-indexer/tracker-module.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-module.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-module.h Mon Aug 4 10:05:59 2008
@@ -42,9 +42,10 @@
typedef gpointer (* TrackerModuleFileGetDataFunc) (const gchar *path);
typedef void (* TrackerModuleFileFreeDataFunc) (gpointer data);
-typedef void (* TrackerModuleFileGetUriFunc) (TrackerFile *file,
- gchar **dirname,
- gchar **basename);
+typedef gchar * (* TrackerModuleFileGetServiceTypeFunc) (const gchar *path);
+typedef void (* TrackerModuleFileGetUriFunc) (TrackerFile *file,
+ gchar **dirname,
+ gchar **basename);
typedef TrackerMetadata * (* TrackerModuleFileGetMetadataFunc) (TrackerFile *file);
typedef gchar * (* TrackerModuleFileGetText) (TrackerFile *path);
@@ -59,6 +60,7 @@
gpointer tracker_module_file_get_data (const gchar *path);
void tracker_module_file_free_data (gpointer file_data);
+gchar * tracker_module_file_get_service_type (const gchar *path);
void tracker_module_file_get_uri (TrackerFile *file,
gchar **dirname,
gchar **basename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]