tracker r2229 - in branches/indexer-split: . src/libtracker-common src/libtracker-db src/tracker-indexer src/trackerd tests/libtracker-common



Author: mr
Date: Mon Sep 15 11:29:51 2008
New Revision: 2229
URL: http://svn.gnome.org/viewvc/tracker?rev=2229&view=rev

Log:
	* src/libtracker-common/tracker-ontology.[ch]:
	* src/libtracker-db/tracker-db-manager.c:
	* src/tracker-indexer/tracker-indexer-db.c:
	* src/tracker-indexer/tracker-indexer.c:
	* src/tracker-indexer/tracker-metadata.c:
	* src/trackerd/tracker-db.c:
	* src/trackerd/tracker-files.c:
	* src/trackerd/tracker-metadata.c:
	* src/trackerd/tracker-xesam-live-search.c:
	* tests/libtracker-common/tracker-ontology-test.c: More ontology
	API improvements and added parameter checks for a lot of public
	functions which were missing them.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/libtracker-common/tracker-ontology.c
   branches/indexer-split/src/libtracker-common/tracker-ontology.h
   branches/indexer-split/src/libtracker-db/tracker-db-manager.c
   branches/indexer-split/src/tracker-indexer/tracker-indexer-db.c
   branches/indexer-split/src/tracker-indexer/tracker-indexer.c
   branches/indexer-split/src/tracker-indexer/tracker-metadata.c
   branches/indexer-split/src/trackerd/tracker-db.c
   branches/indexer-split/src/trackerd/tracker-files.c
   branches/indexer-split/src/trackerd/tracker-metadata.c
   branches/indexer-split/src/trackerd/tracker-xesam-live-search.c
   branches/indexer-split/tests/libtracker-common/tracker-ontology-test.c

Modified: branches/indexer-split/src/libtracker-common/tracker-ontology.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-ontology.c	(original)
+++ branches/indexer-split/src/libtracker-common/tracker-ontology.c	Mon Sep 15 11:29:51 2008
@@ -185,11 +185,11 @@
 
 void 
 tracker_ontology_service_add (TrackerService *service,
-				   GSList         *mimes,
-				   GSList         *mime_prefixes)
+			      GSList         *mimes,
+			      GSList         *mime_prefixes)
 {
 
-	GSList              *mime, *prefix;
+	GSList              *l;
 	ServiceMimePrefixes *service_mime_prefix;
 	gint                 id;
 	const gchar         *name;
@@ -206,16 +206,17 @@
 			     g_strdup_printf ("%d", id), 
 			     g_object_ref (service));
 
-	for (mime = mimes; mime != NULL && mime->data != NULL; mime = mime->next) {
+	for (l = mimes; l && l->data; l = l->next) {
 		g_hash_table_insert (mime_service, 
-				     mime->data, 
+				     l->data, 
 				     GINT_TO_POINTER (id));
 	}
 
-	for (prefix = mime_prefixes; prefix != NULL; prefix = prefix->next) {
+	for (l = mime_prefixes; l; l = l->next) {
 		service_mime_prefix = g_new0 (ServiceMimePrefixes, 1);
-		service_mime_prefix->prefix = prefix->data;
+		service_mime_prefix->prefix = l->data;
 		service_mime_prefix->service = id;
+
 		mime_prefix_service = g_slist_prepend (mime_prefix_service, 
 						       service_mime_prefix);
 	}
@@ -224,6 +225,8 @@
 TrackerService *
 tracker_ontology_get_service_by_name (const gchar *service_str)
 {
+	g_return_val_if_fail (service_str != NULL, NULL);
+
 	return ontology_hash_lookup_by_str (service_table, service_str);
 }
 
@@ -248,6 +251,8 @@
 	ServiceMimePrefixes *item;
 	GSList              *prefix_service;
 
+	g_return_val_if_fail (mime != NULL, g_strdup ("Other"));
+
 	/* Try a complete mime */
 	id = g_hash_table_lookup (mime_service, mime);
 	if (id) {
@@ -273,6 +278,8 @@
 {
 	TrackerService *service;
 
+	g_return_val_if_fail (service_str != NULL, -1);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 
 	if (!service) {
@@ -288,6 +295,8 @@
 	TrackerService *service;
 	const gchar    *parent = NULL;
 
+	g_return_val_if_fail (service_str != NULL, NULL);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 	
 	if (service) {
@@ -385,7 +394,11 @@
 	GList          *field_types, *l;
 	GSList         *names;
 	const gchar    *prefix;
-	const gchar    *parent_prefix = NULL;
+	const gchar    *parent_prefix;
+
+	g_return_val_if_fail (service_str != NULL, NULL);
+
+	parent_prefix = NULL;
 
 	if (service_str) {
 		TrackerService *service;
@@ -446,6 +459,8 @@
 gboolean
 tracker_ontology_service_is_valid (const gchar *service_str)
 {
+	g_return_val_if_fail (service_str != NULL, FALSE);
+
 	return tracker_ontology_get_service_id_by_name (service_str) != -1;
 }
 
@@ -454,6 +469,8 @@
 {
 	TrackerService *service;
 
+	g_return_val_if_fail (service_str != NULL, FALSE);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 
 	if (!service) {
@@ -468,6 +485,8 @@
 {
 	TrackerService *service;
 
+	g_return_val_if_fail (service_str != NULL, FALSE);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 
 	if (!service) {
@@ -482,6 +501,8 @@
 {
 	TrackerService *service;
 
+	g_return_val_if_fail (service_str != NULL, FALSE);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 
 	if (!service) {
@@ -496,6 +517,8 @@
 {
 	TrackerService *service;
 
+	g_return_val_if_fail (service_str != NULL, FALSE);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 
 	if (!service) {
@@ -513,6 +536,9 @@
 	gint            i;
 	const GSList   *l;
 
+	g_return_val_if_fail (service_str != NULL, 0);
+	g_return_val_if_fail (meta_name != NULL, 0);
+
 	service = ontology_hash_lookup_by_str (service_table, service_str);
 
 	if (!service) {
@@ -566,7 +592,7 @@
  * Service directories
  */
 GSList *
-tracker_ontology_get_dirs_for_service_type (const gchar *service)
+tracker_ontology_service_get_paths (const gchar *service)
 {
 	GSList *list = NULL;
 	GSList *l;
@@ -587,7 +613,7 @@
 }
 
 void
-tracker_ontology_add_dir_to_service_type (const gchar *service,  
+tracker_ontology_service_add_path (const gchar *service,  
 					  const gchar *path)
 {
 	g_return_if_fail (service != NULL);
@@ -604,7 +630,7 @@
 }
 
 void
-tracker_ontology_remove_dir_to_service_type (const gchar *service,  
+tracker_ontology_service_remove_path (const gchar *service,  
 					     const gchar *path)
 {
 	GSList *found;
@@ -627,7 +653,7 @@
 }
 
 gchar *
-tracker_ontology_get_service_type_for_dir (const gchar *path)
+tracker_ontology_service_get_by_path (const gchar *path)
 {
 	GSList *l;
 
@@ -649,9 +675,9 @@
 	return g_strdup ("Files");
 }
 
-/* Field Handling */
+/* Field mechanics */
 void
-tracker_ontology_add_field (TrackerField *field)
+tracker_ontology_field_add (TrackerField *field)
 {
 	g_return_if_fail (TRACKER_IS_FIELD (field));
 	g_return_if_fail (tracker_field_get_name (field) != NULL);
@@ -661,16 +687,50 @@
 			     g_object_ref (field));
 }
 
+TrackerField *
+tracker_ontology_get_field_by_name (const gchar *name) 
+{
+	g_return_val_if_fail (name != NULL, NULL);
+
+	return ontology_hash_lookup_by_str (metadata_table, name);
+}
+
+TrackerField *  
+tracker_ontology_get_field_by_id (gint id)
+{
+	GList *values;
+	GList *l;
+
+	/* TODO Create a hashtable with id -> field def. More efficient */
+
+	values = g_hash_table_get_values (metadata_table);
+	
+	for (l = values; l; l = l->next) {
+		TrackerField *field;
+
+		field = l->data;
+
+		if (atoi (tracker_field_get_id (field)) == id) {
+			return field;
+		}
+	}
+
+	return NULL;
+}
+
 gchar *
-tracker_ontology_get_field_column_in_services (TrackerField *field, 
-					       const gchar  *service_type)
+tracker_ontology_get_field_name_by_service_name (TrackerField *field, 
+						 const gchar  *service_str)
 {
 	const gchar *field_name;
 	const gchar *meta_name;
 	gint         key_field;
 
+	g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
+	g_return_val_if_fail (service_str != NULL, NULL);
+
 	meta_name = tracker_field_get_name (field);
-	key_field = tracker_ontology_service_get_key_metadata (service_type, 
+	key_field = tracker_ontology_service_get_key_metadata (service_str, 
 							       meta_name);
 
 	if (key_field > 0) {
@@ -687,11 +747,16 @@
 	}
 }
 
+/*
+ * Field data 
+ */
 gchar *
-tracker_ontology_get_display_field (TrackerField *field)
+tracker_ontology_field_get_display_name (TrackerField *field)
 {
 	TrackerFieldType type;
 
+	g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
+
 	type = tracker_field_get_data_type (field);
 
 	if (type == TRACKER_FIELD_TYPE_INDEX ||
@@ -703,75 +768,54 @@
 	return g_strdup ("MetaDataValue");
 }
 
-gboolean
-tracker_ontology_field_is_child_of (const gchar *child, const gchar *parent) 
+const gchar *
+tracker_ontology_field_get_id (const gchar *name)
 {
-	TrackerField *def_child;
-	TrackerField *def_parent;
-	const GSList *tmp;
-
-	def_child = tracker_ontology_get_field_def (child);
-
-	if (!def_child) {
-		return FALSE;
-	}
-
-	def_parent = tracker_ontology_get_field_def (parent);
+	TrackerField *field;
 
-	if (!def_parent) {
-		return FALSE;
-	}
+	g_return_val_if_fail (name != NULL, NULL);
 
-	for (tmp = tracker_field_get_child_ids (def_parent); tmp; tmp = tmp->next) {
-		
-		if (!tmp->data) return FALSE;
+	field = tracker_ontology_get_field_by_name (name);
 
-		if (strcmp (tracker_field_get_id (def_child), tmp->data) == 0) {
-			return TRUE;
-		}
+	if (field) {
+		return tracker_field_get_id (field);
 	}
-
-	return FALSE;
-}
-
-TrackerField *
-tracker_ontology_get_field_def (const gchar *name) 
-{
-	return ontology_hash_lookup_by_str (metadata_table, name);
+	
+	return NULL;
 }
 
-TrackerField *  
-tracker_ontology_get_field_def_by_id (gint id)
+gboolean
+tracker_ontology_field_is_child_of (const gchar *field_str_child, 
+				    const gchar *field_str_parent) 
 {
-	GList *values = NULL, *iter;
+	TrackerField *field_child;
+	TrackerField *field_parent;
+	const GSList *l;
 
-	/* TODO Create a hashtable with id -> field def. More efficient */
+	g_return_val_if_fail (field_str_child != NULL, FALSE);
+	g_return_val_if_fail (field_str_parent != NULL, FALSE);
 
-	values = g_hash_table_get_values (metadata_table);
-	
-	for (iter = values; iter != NULL; iter = iter->next) {
-		TrackerField *def;
+	field_child = tracker_ontology_get_field_by_name (field_str_child);
 
-		def = (TrackerField *) iter->data;
-		if (atoi(tracker_field_get_id (def)) == id) {
-			return def;
-		}
+	if (!field_child) {
+		return FALSE;
 	}
 
-	return NULL;
-}
+	field_parent = tracker_ontology_get_field_by_name (field_str_parent);
 
-const gchar *
-tracker_ontology_get_field_id (const gchar *name)
-{
-	TrackerField *field;
+	if (!field_parent) {
+		return FALSE;
+	}
 
-	field = tracker_ontology_get_field_def (name);
+	for (l = tracker_field_get_child_ids (field_parent); l; l = l->next) {
+		if (!l->data) {
+			return FALSE;
+		}
 
-	if (field) {
-		return tracker_field_get_id (field);
+		if (strcmp (tracker_field_get_id (field_child), l->data) == 0) {
+			return TRUE;
+		}
 	}
-	
-	return NULL;
-}
 
+	return FALSE;
+}

Modified: branches/indexer-split/src/libtracker-common/tracker-ontology.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-ontology.h	(original)
+++ branches/indexer-split/src/libtracker-common/tracker-ontology.h	Mon Sep 15 11:29:51 2008
@@ -29,55 +29,55 @@
 
 G_BEGIN_DECLS
 
-void            tracker_ontology_init                         (void);
-void            tracker_ontology_shutdown                     (void);
+void            tracker_ontology_init                           (void);
+void            tracker_ontology_shutdown                       (void);
 
 /* Service mechanics */
-void            tracker_ontology_service_add                  (TrackerService *service,
-							       GSList         *mimes,
-							       GSList         *mime_prefixes);
-TrackerService *tracker_ontology_get_service_by_name          (const gchar    *service_str);
-gchar *         tracker_ontology_get_service_by_id            (gint            id);
-gchar *         tracker_ontology_get_service_by_mime          (const gchar    *mime);
-gint            tracker_ontology_get_service_id_by_name       (const gchar    *service_str);
-TrackerDBType   tracker_ontology_get_service_db_by_name       (const gchar    *service_str);
-
-gchar *         tracker_ontology_get_service_parent           (const gchar    *service_str);
-gchar *         tracker_ontology_get_service_parent_by_id     (gint            id);
-gint            tracker_ontology_get_service_parent_id_by_id  (gint            id);
-
-GSList *        tracker_ontology_get_service_names_registered (void);
-GSList *        tracker_ontology_get_field_names_registered   (const gchar    *service_str);
+void            tracker_ontology_service_add                    (TrackerService *service,
+								 GSList         *mimes,
+								 GSList         *mime_prefixes);
+TrackerService *tracker_ontology_get_service_by_name            (const gchar    *service_str);
+gchar *         tracker_ontology_get_service_by_id              (gint            id);
+gchar *         tracker_ontology_get_service_by_mime            (const gchar    *mime);
+gint            tracker_ontology_get_service_id_by_name         (const gchar    *service_str);
+TrackerDBType   tracker_ontology_get_service_db_by_name         (const gchar    *service_str);
+gchar *         tracker_ontology_get_service_parent             (const gchar    *service_str);
+gchar *         tracker_ontology_get_service_parent_by_id       (gint            id);
+gint            tracker_ontology_get_service_parent_id_by_id    (gint            id);
+GSList *        tracker_ontology_get_service_names_registered   (void);
+GSList *        tracker_ontology_get_field_names_registered     (const gchar    *service_str);
 
 /* Service data */
-gboolean        tracker_ontology_service_is_valid             (const gchar    *service_str);
-gboolean        tracker_ontology_service_has_embedded         (const gchar    *service_str);
-gboolean        tracker_ontology_service_has_metadata         (const gchar    *service_str);
-gboolean        tracker_ontology_service_has_thumbnails       (const gchar    *service_str);
-gboolean        tracker_ontology_service_has_text             (const gchar    *service_str);
-gint            tracker_ontology_service_get_key_metadata     (const gchar    *service_str,
-							       const gchar    *meta_name);
-gboolean        tracker_ontology_service_get_show_directories (const gchar    *service_str);
-gboolean        tracker_ontology_service_get_show_files       (const gchar    *service_str);
-
-/* Service directories */
-GSList *        tracker_ontology_get_dirs_for_service_type    (const gchar    *service_str);
-void            tracker_ontology_add_dir_to_service_type      (const gchar    *service_str,
-							       const gchar    *path);
-void            tracker_ontology_remove_dir_to_service_type   (const gchar    *service_str,
-							       const gchar    *path);
-gchar *         tracker_ontology_get_service_type_for_dir     (const gchar    *path);
-
-/* Field handling */
-void            tracker_ontology_add_field                    (TrackerField   *field);
-gchar *         tracker_ontology_get_field_column_in_services (TrackerField   *field,
-							       const gchar    *service_str);
-gchar *         tracker_ontology_get_display_field            (TrackerField   *field);
-gboolean        tracker_ontology_field_is_child_of            (const gchar    *child,
-							       const gchar    *parent);
-TrackerField *  tracker_ontology_get_field_def                (const gchar    *name);
-const gchar *   tracker_ontology_get_field_id                 (const gchar    *name);
-TrackerField *  tracker_ontology_get_field_def_by_id          (gint            id);
+gboolean        tracker_ontology_service_is_valid               (const gchar    *service_str);
+gboolean        tracker_ontology_service_has_embedded           (const gchar    *service_str);
+gboolean        tracker_ontology_service_has_metadata           (const gchar    *service_str);
+gboolean        tracker_ontology_service_has_thumbnails         (const gchar    *service_str);
+gboolean        tracker_ontology_service_has_text               (const gchar    *service_str);
+gint            tracker_ontology_service_get_key_metadata       (const gchar    *service_str,
+								 const gchar    *meta_name);
+gboolean        tracker_ontology_service_get_show_directories   (const gchar    *service_str);
+gboolean        tracker_ontology_service_get_show_files         (const gchar    *service_str);
+
+/* Service paths */
+GSList *        tracker_ontology_service_get_paths              (const gchar    *service_str);
+gchar *         tracker_ontology_service_get_by_path            (const gchar    *path);
+void            tracker_ontology_service_add_path               (const gchar    *service_str,
+								 const gchar    *path);
+void            tracker_ontology_service_remove_path            (const gchar    *service_str,
+								 const gchar    *path);
+
+/* Field mechanics */
+void            tracker_ontology_field_add                      (TrackerField   *field);
+TrackerField *  tracker_ontology_get_field_by_name              (const gchar    *name);
+TrackerField *  tracker_ontology_get_field_by_id                (gint            id);
+gchar *         tracker_ontology_get_field_name_by_service_name (TrackerField   *field,
+								 const gchar    *service_str);
+
+/* Field data */
+gchar *         tracker_ontology_field_get_display_name         (TrackerField   *field);
+const gchar *   tracker_ontology_field_get_id                   (const gchar    *name);
+gboolean        tracker_ontology_field_is_child_of              (const gchar    *child,
+								 const gchar    *parent);
 
 G_END_DECLS
 

Modified: branches/indexer-split/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-manager.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-manager.c	Mon Sep 15 11:29:51 2008
@@ -252,7 +252,7 @@
 	groups = g_key_file_get_groups (key_file, NULL);
 
 	for (i = 0; groups[i]; i++) {
-		def = tracker_ontology_get_field_def (groups[i]);
+		def = tracker_ontology_get_field_by_name (groups[i]);
 
 		if (!def) {
 			tracker_db_interface_execute_procedure (iface, 
@@ -1620,7 +1620,7 @@
 				   tracker_field_get_name (def),
 				   tracker_field_get_weight (def));
 
-			tracker_ontology_add_field (def);
+			tracker_ontology_field_add (def);
 			g_object_unref (def);
 
 			valid = tracker_db_result_set_iter_next (result_set);
@@ -1702,7 +1702,7 @@
 			 *                 tracker_field_get_name (def),
 			 *                 tracker_field_get_data_type (def));
 			 *
-			 * tracker_ontology_add_field (def);
+			 * tracker_ontology_field_add (def);
 			 */
 			valid = tracker_db_result_set_iter_next (result_set);
 			g_object_unref (def);

Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer-db.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer-db.c	(original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer-db.c	Mon Sep 15 11:29:51 2008
@@ -338,7 +338,7 @@
 			tracker_db_result_set_get (result_set, 0, &metadata_id, 1, &value, -1);
 		}
 		
-		field_def = tracker_ontology_get_field_def_by_id (metadata_id);
+		field_def = tracker_ontology_get_field_by_id (metadata_id);
 		if (!field_def) {
 			g_critical ("Field id %d in database but not in tracker-ontology",
 				    metadata_id);
@@ -789,7 +789,7 @@
 	gchar *id_str;
 
 	id_str = tracker_guint32_to_string (id);
-	field = tracker_ontology_get_field_def ("File:Contents");
+	field = tracker_ontology_get_field_by_name ("File:Contents");
 	iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
 							     TRACKER_DB_CONTENT_TYPE_CONTENTS);
 
@@ -812,7 +812,7 @@
 	TrackerDBResultSet *result_set;
 
 	service_id_str = tracker_guint32_to_string (id);
-	field = tracker_ontology_get_field_def ("File:Contents");
+	field = tracker_ontology_get_field_by_name ("File:Contents");
 	iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
 							     TRACKER_DB_CONTENT_TYPE_CONTENTS);
 
@@ -842,7 +842,7 @@
 	gchar *service_id_str;
 
 	service_id_str = tracker_guint32_to_string (id);
-	field = tracker_ontology_get_field_def ("File:Contents");
+	field = tracker_ontology_get_field_by_name ("File:Contents");
 	iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
 							     TRACKER_DB_CONTENT_TYPE_CONTENTS);
 

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 Sep 15 11:29:51 2008
@@ -1497,7 +1497,7 @@
 		return FALSE;
 	}
 
-	field_def = tracker_ontology_get_field_def (property);
+	field_def = tracker_ontology_get_field_by_name (property);
 	if (!field_def) {
 		g_set_error (error, 
 			     g_quark_from_string (TRACKER_INDEXER_ERROR), 
@@ -1633,7 +1633,7 @@
 		return FALSE;
 	}
 
-	field_def = tracker_ontology_get_field_def (property);
+	field_def = tracker_ontology_get_field_by_name (property);
 	if (!field_def) {
 		g_set_error (error, 
 			     g_quark_from_string (TRACKER_INDEXER_ERROR), 

Modified: branches/indexer-split/src/tracker-indexer/tracker-metadata.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-metadata.c	(original)
+++ branches/indexer-split/src/tracker-indexer/tracker-metadata.c	Mon Sep 15 11:29:51 2008
@@ -80,7 +80,7 @@
 {
         TrackerField *field;
 
-        field = tracker_ontology_get_field_def (field_name);
+        field = tracker_ontology_get_field_by_name (field_name);
 
 	g_return_if_fail (TRACKER_IS_FIELD (field));
         g_return_if_fail (tracker_field_get_multiple_values (field) == FALSE);
@@ -97,7 +97,7 @@
 {
         TrackerField *field;
 
-        field = tracker_ontology_get_field_def (field_name);
+        field = tracker_ontology_get_field_by_name (field_name);
 
 	g_return_if_fail (TRACKER_IS_FIELD (field));
         g_return_if_fail (tracker_field_get_multiple_values (field) == TRUE);
@@ -113,7 +113,7 @@
 {
         TrackerField *field;
 
-        field = tracker_ontology_get_field_def (field_name);
+        field = tracker_ontology_get_field_by_name (field_name);
 
 	g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
         g_return_val_if_fail (tracker_field_get_multiple_values (field) == FALSE, NULL);
@@ -127,7 +127,7 @@
 {
         TrackerField *field;
 
-        field = tracker_ontology_get_field_def (field_name);
+        field = tracker_ontology_get_field_by_name (field_name);
 
 	g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
         g_return_val_if_fail (tracker_field_get_multiple_values (field) == TRUE, NULL);

Modified: branches/indexer-split/src/trackerd/tracker-db.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-db.c	Mon Sep 15 11:29:51 2008
@@ -214,7 +214,7 @@
 		bytes_compressed = length;
 	}
 
-	field_id = tracker_ontology_get_field_id ("File:Contents");
+	field_id = tracker_ontology_field_get_id ("File:Contents");
 
 	if (!field_id) {
 		g_warning ("Metadata not found for type:'File:Contents'");
@@ -666,7 +666,7 @@
 {
 	gint key_field;
 
-	/* Replace with tracker_ontology_get_field_column_in_services */
+	/* Replace with tracker_ontology_get_field_name_by_service_name */
 	key_field = tracker_ontology_service_get_key_metadata (service, meta_name);
 
 	if (key_field > 0) {
@@ -1205,7 +1205,7 @@
 	g_return_val_if_fail (id, NULL);
 	g_return_val_if_fail (key, NULL);
 
-	def = tracker_ontology_get_field_def (key);
+	def = tracker_ontology_get_field_by_name (key);
 
 	if (!def) {
 		g_warning ("Metadata not found for id:'%s' and type:'%s'", id, key);
@@ -1528,7 +1528,7 @@
 		return NULL;
 	}
 
-	def = tracker_ontology_get_field_def (key);
+	def = tracker_ontology_get_field_by_name (key);
 
 	if (!def) {
 		g_warning ("Metadata type:'%s' not found", key);
@@ -1860,7 +1860,7 @@
 	g_return_if_fail (private != NULL);
 
 	/* Get type details */
-	def = tracker_ontology_get_field_def (key);
+	def = tracker_ontology_get_field_by_name (key);
 
 	if (!def) {
 		return;
@@ -2028,7 +2028,7 @@
 	g_return_if_fail (key != NULL);
 
 	/* Get type details */
-	def = tracker_ontology_get_field_def(key);
+	def = tracker_ontology_get_field_by_name(key);
 
 	if (!def) {
 		return;
@@ -2920,7 +2920,7 @@
 	g_return_val_if_fail (service != NULL, NULL);
 	g_return_val_if_fail (field_name != NULL, NULL);
 
-	def = tracker_ontology_get_field_def (field_name);
+	def = tracker_ontology_get_field_by_name (field_name);
 
 	if (def) {
 		gchar       *alias;
@@ -2962,7 +2962,7 @@
 			gchar *str;
 			gchar *display_field;
 
-			display_field = tracker_ontology_get_display_field (def);
+			display_field = tracker_ontology_field_get_display_name (def);
 			str = g_strdup_printf ("M%d.%s", field_count, display_field);
 			tracker_field_data_set_select_field (field_data, str);
 			tracker_field_data_set_needs_join (field_data, TRUE);

Modified: branches/indexer-split/src/trackerd/tracker-files.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-files.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-files.c	Mon Sep 15 11:29:51 2008
@@ -731,7 +731,7 @@
 
 	/* Get fields for metadata list provided */
 	for (i = 0; i < g_strv_length (fields); i++) {
-		defs[i] = tracker_ontology_get_field_def (fields[i]);
+		defs[i] = tracker_ontology_get_field_by_name (fields[i]);
 
 		if (!defs[i]) {
 			tracker_dbus_request_failed (request_id,
@@ -787,7 +787,7 @@
 		} else {
 			gchar *display_field;
 
-			display_field = tracker_ontology_get_display_field (defs[i-1]);
+			display_field = tracker_ontology_field_get_display_name (defs[i-1]);
 			g_string_append_printf (sql, ", M%d.%s ", i, display_field);
 			g_free (display_field);
 			needs_join[i - 1] = TRUE;

Modified: branches/indexer-split/src/trackerd/tracker-metadata.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-metadata.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-metadata.c	Mon Sep 15 11:29:51 2008
@@ -180,7 +180,7 @@
 	/* Checking keys */
 	for (i = 0; i < g_strv_length (keys); i++) {
 		
-		if (tracker_ontology_get_field_def (keys[i]) == NULL) {
+		if (tracker_ontology_get_field_by_name (keys[i]) == NULL) {
 			tracker_dbus_request_failed (request_id,
 						     &actual_error,
 						     "Metadata field '%s' not registered in the system", 
@@ -288,7 +288,7 @@
 		TrackerField *field_def;
 		gchar       **value;
 
-		field_def = tracker_ontology_get_field_def (keys[i]);
+		field_def = tracker_ontology_get_field_by_name (keys[i]);
 
 		if (field_def == NULL) {
 			tracker_dbus_request_failed (request_id,
@@ -360,7 +360,7 @@
 				  "metadata type:'%s'",
 				  metadata);
 
-	def = tracker_ontology_get_field_def (metadata);
+	def = tracker_ontology_get_field_by_name (metadata);
 	if (!def) {
 		tracker_dbus_request_failed (request_id,
 					     &actual_error, 

Modified: branches/indexer-split/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-live-search.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-live-search.c	Mon Sep 15 11:29:51 2008
@@ -683,7 +683,7 @@
 							  column, 
 							  &cur_value);
 
-			field_def = tracker_ontology_get_field_def (fields[column-1]);
+			field_def = tracker_ontology_get_field_by_name (fields[column-1]);
 			data_type = tracker_field_get_data_type (field_def);
 
 			if (tracker_field_get_multiple_values (field_def)) {

Modified: branches/indexer-split/tests/libtracker-common/tracker-ontology-test.c
==============================================================================
--- branches/indexer-split/tests/libtracker-common/tracker-ontology-test.c	(original)
+++ branches/indexer-split/tests/libtracker-common/tracker-ontology-test.c	Mon Sep 15 11:29:51 2008
@@ -176,7 +176,7 @@
 	tracker_ontology_service_add (gossip_def, NULL, NULL); 
 	tracker_ontology_service_add (new_gaim_def, NULL, NULL); 
 
-        tracker_ontology_add_field (field_title);
+        tracker_ontology_field_add (field_title);
 
 	g_slist_free (mimes);
 	g_slist_free (mime_prefixes);
@@ -319,9 +319,9 @@
 {
         TrackerField *field;
 
-        field = tracker_ontology_get_field_def ("App.Title");
+        field = tracker_ontology_get_field_by_name ("App.Title");
         g_assert (field);
-        g_assert (!tracker_ontology_get_field_def ("nooooo"));
+        g_assert (!tracker_ontology_get_field_by_name ("nooooo"));
 }
 
 static void



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