tracker r1636 - in branches/xesam-support: . src/trackerd



Author: pvanhoof
Date: Wed Jun 11 12:22:57 2008
New Revision: 1636
URL: http://svn.gnome.org/viewvc/tracker?rev=1636&view=rev

Log:
2008-06-11  Philip Van Hoof  <pvanhoof gnome org>

        * src/trackerd/tracker-xesam-live-search.c: List-field values in
        get_hit_data



Modified:
   branches/xesam-support/ChangeLog
   branches/xesam-support/src/trackerd/tracker-xesam-live-search.c

Modified: branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-live-search.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-live-search.c	Wed Jun 11 12:22:57 2008
@@ -536,40 +536,6 @@
 }
 
 
-
-// todo pvanhoof
-// These values are not used, but rather values from libtracker-db/tracker-db-manager.c, where they are loaded. I didn't remove them yet, since they are used elsewhere.
-
-typedef enum {
-	ARRAY_OF_INT,
-	ARRAY_OF_BOOLEAN,
-
-	/* Also usable for list of uris */
-	ARRAY_OF_STRING,
-
-	/* string, float, integer, boolean, datetime */
-	SANE_TYPE 
-} OntologyType;
-
-static OntologyType
-get_type_for (TrackerXesamLiveSearch *self, gchar *field)
-{
-	TrackerXesamField *def;
-
-	g_debug ("get_type_for: %s", field);
-
-	def = tracker_xesam_ontology_get_field_def (field);
-
-	if (def) {
-		g_debug ("type for %s is %d", field, tracker_xesam_field_get_data_type (def));
-	}
-
-	// todo pvanhoof: I am just printing the value, nothing else. See the todo above.
-
-	return SANE_TYPE;
-}
-
-
 typedef struct {
 	gint key;
 	gpointer value;
@@ -668,6 +634,8 @@
 		GValue      value_in = {0, };
 		gboolean    insert = FALSE;
 		gint        key;
+		TrackerXesamFieldType data_type;
+		TrackerXesamField *field_def;
 
 		_tracker_db_result_set_get_value (result_set, 0, &value_in);
 
@@ -714,15 +682,20 @@
 							  column, 
 							  &cur_value);
 
-			switch (get_type_for (self, fields[column-1])) {
-				case ARRAY_OF_STRING: {
+			field_def = tracker_xesam_ontology_get_field_def (fields[column-1]);
+			data_type = tracker_xesam_field_get_data_type (field_def);
+
+			switch (data_type) {
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_URLS:
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_URIS:
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_STRINGS: {
 					GValue    *variant;
 					GPtrArray *my_array;
 
 					if (row->len <= (unsigned int) column) {
 						variant = g_new0 (GValue, 1);
 						g_value_init (variant, 
-							      dbus_g_type_get_struct("GPtrArray", 
+							      dbus_g_type_get_collection ("GPtrArray", 
 										     G_TYPE_STRING));
 
 						my_array =  g_ptr_array_new ();
@@ -741,7 +714,7 @@
 
 				}
 				break;
-
+/*
 				case ARRAY_OF_INT: {
 					GValue *variant;
 					GArray *my_array;
@@ -750,7 +723,7 @@
 					if (row->len <= (unsigned int) column) {
 						variant = g_new0 (GValue, 1);
 						g_value_init (variant, 
-							      dbus_g_type_get_struct("GArray", 
+							      dbus_g_type_get_collection ("GArray", 
 										     G_TYPE_INT));
 
 						my_array =  g_array_new (FALSE, 
@@ -795,8 +768,12 @@
 					g_array_append_val (my_array, bool_val);
 				}
 				break;
-
-				case SANE_TYPE:
+*/
+				case TRACKER_XESAM_FIELD_TYPE_STRING:
+				case TRACKER_XESAM_FIELD_TYPE_FLOAT:
+				case TRACKER_XESAM_FIELD_TYPE_INTEGER:
+				case TRACKER_XESAM_FIELD_TYPE_BOOLEAN:
+				case TRACKER_XESAM_FIELD_TYPE_DATE:
 				default: {
 					if (insert) {
 						GValue *value = g_new0 (GValue, 1);



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