[tracker] Rename TrackerField to TrackerProperty
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] Rename TrackerField to TrackerProperty
- Date: Thu, 16 Apr 2009 05:27:14 -0400 (EDT)
commit b8e6b6310465267c4446077d3cc6af9cde97df39
Author: Jürg Billeter <j bitron ch>
Date: Wed Apr 15 11:46:39 2009 +0200
Rename TrackerField to TrackerProperty
---
.../libtracker-common-sections.txt | 76 +-
.../libtracker-common/libtracker-common.types | 2 +-
src/libtracker-common/Makefile.am | 4 +-
src/libtracker-common/tracker-common.h | 2 +-
src/libtracker-common/tracker-field.c | 753 --------------------
src/libtracker-common/tracker-field.h | 116 ---
src/libtracker-common/tracker-ontology.c | 62 +-
src/libtracker-common/tracker-ontology.h | 12 +-
src/libtracker-common/tracker-property.c | 753 ++++++++++++++++++++
src/libtracker-common/tracker-property.h | 116 +++
src/libtracker-data/tracker-data-backup.c | 4 +-
src/libtracker-data/tracker-data-manager.h | 2 +-
src/libtracker-data/tracker-data-metadata.c | 30 +-
src/libtracker-data/tracker-data-metadata.h | 4 +-
src/libtracker-data/tracker-data-query.c | 52 +-
src/libtracker-data/tracker-data-query.h | 4 +-
src/libtracker-data/tracker-data-update.c | 94 ++--
src/libtracker-data/tracker-data-update.h | 4 +-
src/libtracker-data/tracker-turtle.c | 6 +-
src/libtracker-data/tracker-turtle.h | 2 +-
src/libtracker-db/tracker-db-manager.c | 42 +-
src/tracker-fts/tracker-fts.c | 26 +-
src/tracker-indexer/tracker-indexer.c | 52 +-
.../tracker-module-metadata-private.h | 4 +-
.../tracker-module-metadata-utils.c | 10 +-
src/tracker-indexer/tracker-module-metadata.c | 24 +-
src/tracker-indexer/tracker-removable-device.c | 8 +-
tests/libtracker-common/Makefile.am | 4 +-
tests/libtracker-common/tracker-field-test.c | 46 +-
tests/libtracker-common/tracker-ontology-test.c | 28 +-
30 files changed, 1171 insertions(+), 1171 deletions(-)
diff --git a/docs/reference/libtracker-common/libtracker-common-sections.txt b/docs/reference/libtracker-common/libtracker-common-sections.txt
index 1c385e0..ef35a8c 100644
--- a/docs/reference/libtracker-common/libtracker-common-sections.txt
+++ b/docs/reference/libtracker-common/libtracker-common-sections.txt
@@ -135,46 +135,46 @@ tracker_string_replace
tracker_throttle
</SECTION>
-<INCLUDE>libtracker-common/tracker-field.h</INCLUDE>
+<INCLUDE>libtracker-common/tracker-property.h</INCLUDE>
<SECTION>
-<FILE>tracker-field</FILE>
-<TITLE>Fields</TITLE>
-TrackerField
-tracker_field_new
-tracker_field_append_child_id
-tracker_field_get_child_ids
-tracker_field_get_data_type
-tracker_field_get_delimited
-tracker_field_get_embedded
-tracker_field_get_field_name
-tracker_field_get_filtered
-tracker_field_get_id
-tracker_field_get_multiple_values
-tracker_field_get_name
-tracker_field_get_store_metadata
-tracker_field_get_weight
-tracker_field_set_child_ids
-tracker_field_set_data_type
-tracker_field_set_delimited
-tracker_field_set_embedded
-tracker_field_set_field_name
-tracker_field_set_filtered
-tracker_field_set_id
-tracker_field_set_multiple_values
-tracker_field_set_name
-tracker_field_set_store_metadata
-tracker_field_set_weight
-tracker_field_type_to_string
+<FILE>tracker-property</FILE>
+<TITLE>Properties</TITLE>
+TrackerProperty
+tracker_property_new
+tracker_property_append_child_id
+tracker_property_get_child_ids
+tracker_property_get_data_type
+tracker_property_get_delimited
+tracker_property_get_embedded
+tracker_property_get_field_name
+tracker_property_get_filtered
+tracker_property_get_id
+tracker_property_get_multiple_values
+tracker_property_get_name
+tracker_property_get_store_metadata
+tracker_property_get_weight
+tracker_property_set_child_ids
+tracker_property_set_data_type
+tracker_property_set_delimited
+tracker_property_set_embedded
+tracker_property_set_field_name
+tracker_property_set_filtered
+tracker_property_set_id
+tracker_property_set_multiple_values
+tracker_property_set_name
+tracker_property_set_store_metadata
+tracker_property_set_weight
+tracker_property_type_to_string
<SUBSECTION Standard>
-TRACKER_FIELD
-TRACKER_IS_FIELD
-TRACKER_TYPE_FIELD
-tracker_field_get_type
-TRACKER_FIELD_CLASS
-TRACKER_IS_FIELD_CLASS
-TRACKER_FIELD_GET_CLASS
-TRACKER_TYPE_FIELD_TYPE
-tracker_field_type_get_type
+TRACKER_PROPERTY
+TRACKER_IS_PROPERTY
+TRACKER_TYPE_PROPERTY
+tracker_property_get_type
+TRACKER_PROPERTY_CLASS
+TRACKER_IS_PROPERTY_CLASS
+TRACKER_PROPERTY_GET_CLASS
+TRACKER_TYPE_PROPERTY_TYPE
+tracker_property_type_get_type
</SECTION>
<INCLUDE>libtracker-common/tracker-type-utils.h</INCLUDE>
diff --git a/docs/reference/libtracker-common/libtracker-common.types b/docs/reference/libtracker-common/libtracker-common.types
index cbf5574..0393afd 100644
--- a/docs/reference/libtracker-common/libtracker-common.types
+++ b/docs/reference/libtracker-common/libtracker-common.types
@@ -2,7 +2,7 @@
tracker_class_get_type
tracker_config_get_type
-tracker_field_get_type
tracker_hal_get_type
tracker_language_get_type
+tracker_property_get_type
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index 8d48ff0..a5169c3 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -38,7 +38,6 @@ libtracker_common_la_SOURCES = \
tracker-class.c \
tracker-config.c \
tracker-dbus.c \
- tracker-field.c \
tracker-file-utils.c \
tracker-ioprio.c \
tracker-language.c \
@@ -48,6 +47,7 @@ libtracker_common_la_SOURCES = \
tracker-nfs-lock.c \
tracker-ontology.c \
tracker-parser.c \
+ tracker-property.c \
tracker-type-utils.c \
tracker-utils.c \
tracker-thumbnailer.c \
@@ -67,12 +67,12 @@ libtracker_commoninclude_HEADERS = \
tracker-class.h \
tracker-common.h \
tracker-config.h \
- tracker-field.h \
tracker-file-utils.h \
tracker-language.h \
tracker-module-config.h \
tracker-ontology.h \
tracker-parser.h \
+ tracker-property.h \
tracker-type-utils.h \
tracker-utils.h
diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h
index f93542f..4fb22d3 100644
--- a/src/libtracker-common/tracker-common.h
+++ b/src/libtracker-common/tracker-common.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
#define __LIBTRACKER_COMMON_INSIDE__
#include "tracker-config.h"
-#include "tracker-field.h"
+#include "tracker-property.h"
#include "tracker-file-utils.h"
#include "tracker-hal.h"
#include "tracker-language.h"
diff --git a/src/libtracker-common/tracker-field.c b/src/libtracker-common/tracker-field.c
deleted file mode 100644
index cbc382c..0000000
--- a/src/libtracker-common/tracker-field.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
- * Copyright (C) 2008, Nokia (urho konttori nokia com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#include "tracker-field.h"
-
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_FIELD, TrackerFieldPriv))
-
-typedef struct _TrackerFieldPriv TrackerFieldPriv;
-
-struct _TrackerFieldPriv {
- gchar *id;
- gchar *name;
-
- TrackerFieldType data_type;
- gchar *field_name;
- gint weight;
- gboolean embedded;
- gboolean multiple_values;
- gboolean delimited;
- gboolean filtered;
- gboolean store_metadata;
-
- GSList *child_ids;
-};
-
-static void field_finalize (GObject *object);
-static void field_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void field_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-
-enum {
- PROP_0,
- PROP_ID,
- PROP_NAME,
- PROP_DATA_TYPE,
- PROP_FIELD_NAME,
- PROP_WEIGHT,
- PROP_EMBEDDED,
- PROP_MULTIPLE_VALUES,
- PROP_DELIMITED,
- PROP_FILTERED,
- PROP_STORE_METADATA,
- PROP_CHILD_IDS
-};
-
-GType
-tracker_field_type_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const GEnumValue values[] = {
- { TRACKER_FIELD_TYPE_KEYWORD,
- "TRACKER_FIELD_TYPE_KEYWORD",
- "keyword" },
- { TRACKER_FIELD_TYPE_INDEX,
- "TRACKER_FIELD_TYPE_INDEX",
- "index" },
- { TRACKER_FIELD_TYPE_FULLTEXT,
- "TRACKER_FIELD_TYPE_FULLTEXT",
- "fulltext" },
- { TRACKER_FIELD_TYPE_STRING,
- "TRACKER_FIELD_TYPE_STRING",
- "string" },
- { TRACKER_FIELD_TYPE_INTEGER,
- "TRACKER_FIELD_TYPE_INTEGER",
- "integer" },
- { TRACKER_FIELD_TYPE_DOUBLE,
- "TRACKER_FIELD_TYPE_DOUBLE",
- "double" },
- { TRACKER_FIELD_TYPE_DATE,
- "TRACKER_FIELD_TYPE_DATE",
- "date" },
- { TRACKER_FIELD_TYPE_BLOB,
- "TRACKER_FIELD_TYPE_BLOB",
- "blob" },
- { TRACKER_FIELD_TYPE_STRUCT,
- "TRACKER_FIELD_TYPE_STRUCT",
- "struct" },
- { TRACKER_FIELD_TYPE_LINK,
- "TRACKER_FIELD_TYPE_LINK",
- "link" },
- { 0, NULL, NULL }
- };
-
- etype = g_enum_register_static ("TrackerFieldType", values);
- }
-
- return etype;
-}
-
-G_DEFINE_TYPE (TrackerField, tracker_field, G_TYPE_OBJECT);
-
-const gchar *
-tracker_field_type_to_string (TrackerFieldType fieldtype)
-{
- GType type;
- GEnumClass *enum_class;
- GEnumValue *enum_value;
-
- type = tracker_field_type_get_type ();
- enum_class = G_ENUM_CLASS (g_type_class_peek (type));
- enum_value = g_enum_get_value (enum_class, fieldtype);
-
- if (!enum_value) {
- return NULL;
- }
-
- return enum_value->value_nick;
-}
-
-static void
-tracker_field_class_init (TrackerFieldClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = field_finalize;
- object_class->get_property = field_get_property;
- object_class->set_property = field_set_property;
-
- g_object_class_install_property (object_class,
- PROP_ID,
- g_param_spec_string ("id",
- "id",
- "Unique identifier for this field",
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_NAME,
- g_param_spec_string ("name",
- "name",
- "Field name",
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_DATA_TYPE,
- g_param_spec_enum ("data-type",
- "data-type",
- "Field data type",
- tracker_field_type_get_type (),
- TRACKER_FIELD_TYPE_INDEX,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_FIELD_NAME,
- g_param_spec_string ("field-name",
- "field-name",
- "Column in services table with the contents of this metadata",
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_WEIGHT,
- g_param_spec_int ("weight",
- "weight",
- "Boost to the score",
- 0,
- G_MAXINT,
- 0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_EMBEDDED,
- g_param_spec_boolean ("embedded",
- "embedded",
- "Embedded",
- TRUE,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_MULTIPLE_VALUES,
- g_param_spec_boolean ("multiple-values",
- "multiple-values",
- "Multiple values",
- TRUE,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_DELIMITED,
- g_param_spec_boolean ("delimited",
- "delimited",
- "Delimited",
- FALSE,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_FILTERED,
- g_param_spec_boolean ("filtered",
- "filtered",
- "Filtered",
- FALSE,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_STORE_METADATA,
- g_param_spec_boolean ("store-metadata",
- "store-metadata",
- "Store metadata",
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_CHILD_IDS,
- g_param_spec_pointer ("child-ids",
- "child-ids",
- "Child ids",
- G_PARAM_READWRITE));
-
- g_type_class_add_private (object_class, sizeof (TrackerFieldPriv));
-}
-
-static void
-tracker_field_init (TrackerField *field)
-{
-}
-
-static void
-field_finalize (GObject *object)
-{
- TrackerFieldPriv *priv;
-
- priv = GET_PRIV (object);
-
- g_free (priv->id);
- g_free (priv->name);
-
- if (priv->field_name) {
- g_free (priv->field_name);
- }
-
- g_slist_foreach (priv->child_ids, (GFunc) g_free, NULL);
- g_slist_free (priv->child_ids);
-
- (G_OBJECT_CLASS (tracker_field_parent_class)->finalize) (object);
-}
-
-static void
-field_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- TrackerFieldPriv *priv;
-
- priv = GET_PRIV (object);
-
- switch (param_id) {
- case PROP_ID:
- g_value_set_string (value, priv->id);
- break;
- case PROP_NAME:
- g_value_set_string (value, priv->name);
- break;
- case PROP_DATA_TYPE:
- g_value_set_enum (value, priv->data_type);
- break;
- case PROP_FIELD_NAME:
- g_value_set_string (value, priv->field_name);
- break;
- case PROP_WEIGHT:
- g_value_set_int (value, priv->weight);
- break;
- case PROP_EMBEDDED:
- g_value_set_boolean (value, priv->embedded);
- break;
- case PROP_MULTIPLE_VALUES:
- g_value_set_boolean (value, priv->multiple_values);
- break;
- case PROP_DELIMITED:
- g_value_set_boolean (value, priv->delimited);
- break;
- case PROP_FILTERED:
- g_value_set_boolean (value, priv->filtered);
- break;
- case PROP_STORE_METADATA:
- g_value_set_boolean (value, priv->store_metadata);
- break;
- case PROP_CHILD_IDS:
- g_value_set_pointer (value, priv->child_ids);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
-field_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (param_id) {
- case PROP_ID:
- tracker_field_set_id (TRACKER_FIELD (object),
- g_value_get_string (value));
- break;
- case PROP_NAME:
- tracker_field_set_name (TRACKER_FIELD (object),
- g_value_get_string (value));
- break;
- case PROP_DATA_TYPE:
- tracker_field_set_data_type (TRACKER_FIELD (object),
- g_value_get_enum (value));
- break;
- case PROP_FIELD_NAME:
- tracker_field_set_field_name (TRACKER_FIELD (object),
- g_value_get_string (value));
- break;
- case PROP_WEIGHT:
- tracker_field_set_weight (TRACKER_FIELD (object),
- g_value_get_int (value));
- break;
- case PROP_EMBEDDED:
- tracker_field_set_embedded (TRACKER_FIELD (object),
- g_value_get_boolean (value));
- break;
- case PROP_MULTIPLE_VALUES:
- tracker_field_set_multiple_values (TRACKER_FIELD (object),
- g_value_get_boolean (value));
- break;
- case PROP_DELIMITED:
- tracker_field_set_delimited (TRACKER_FIELD (object),
- g_value_get_boolean (value));
- break;
- case PROP_FILTERED:
- tracker_field_set_filtered (TRACKER_FIELD (object),
- g_value_get_boolean (value));
- break;
- case PROP_STORE_METADATA:
- tracker_field_set_store_metadata (TRACKER_FIELD (object),
- g_value_get_boolean (value));
- break;
- case PROP_CHILD_IDS:
- tracker_field_set_child_ids (TRACKER_FIELD (object),
- g_value_get_pointer (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static gboolean
-field_int_validate (TrackerField *field,
- const gchar *property,
- gint value)
-{
-#ifdef G_DISABLE_CHECKS
- GParamSpec *spec;
- GValue value = { 0 };
- gboolean valid;
-
- spec = g_object_class_find_property (G_OBJECT_CLASS (field), property);
- g_return_val_if_fail (spec != NULL, FALSE);
-
- g_value_init (&value, spec->value_type);
- g_value_set_int (&value, verbosity);
- valid = g_param_value_validate (spec, &value);
- g_value_unset (&value);
-
- g_return_val_if_fail (valid != TRUE, FALSE);
-#endif
-
- return TRUE;
-}
-
-/**
- * tracker_field_new:
- *
- * Creates a new #TrackerField instance.
- *
- * Returns: The newly created #TrackerField
- **/
-TrackerField *
-tracker_field_new (void)
-{
- TrackerField *field;
-
- field = g_object_new (TRACKER_TYPE_FIELD, NULL);
-
- return field;
-}
-
-const gchar *
-tracker_field_get_id (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
-
- priv = GET_PRIV (field);
-
- return priv->id;
-}
-
-const gchar *
-tracker_field_get_name (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
-
- priv = GET_PRIV (field);
-
- return priv->name;
-}
-
-TrackerFieldType
-tracker_field_get_data_type (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), TRACKER_FIELD_TYPE_STRING); //FIXME
-
- priv = GET_PRIV (field);
-
- return priv->data_type;
-}
-
-const gchar *
-tracker_field_get_field_name (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
-
- priv = GET_PRIV (field);
-
- return priv->field_name;
-}
-
-gint
-tracker_field_get_weight (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), -1);
-
- priv = GET_PRIV (field);
-
- return priv->weight;
-}
-
-
-gboolean
-tracker_field_get_embedded (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), FALSE);
-
- priv = GET_PRIV (field);
-
- return priv->embedded;
-}
-
-
-gboolean
-tracker_field_get_multiple_values (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), FALSE);
-
- priv = GET_PRIV (field);
-
- return priv->multiple_values;
-}
-
-gboolean
-tracker_field_get_delimited (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), FALSE);
-
- priv = GET_PRIV (field);
-
- return priv->delimited;
-}
-
-gboolean
-tracker_field_get_filtered (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), FALSE);
-
- priv = GET_PRIV (field);
-
- return priv->filtered;
-}
-
-gboolean
-tracker_field_get_store_metadata (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), FALSE);
-
- priv = GET_PRIV (field);
-
- return priv->store_metadata;
-}
-
-
-const GSList *
-tracker_field_get_child_ids (TrackerField *field)
-{
- TrackerFieldPriv *priv;
-
- g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
-
- priv = GET_PRIV (field);
-
- return priv->child_ids;
-}
-
-
-void
-tracker_field_set_id (TrackerField *field,
- const gchar *value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- g_free (priv->id);
-
- if (value) {
- priv->id = g_strdup (value);
- } else {
- priv->id = NULL;
- }
-
- g_object_notify (G_OBJECT (field), "id");
-}
-
-void
-tracker_field_set_name (TrackerField *field,
- const gchar *value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- g_free (priv->name);
-
- if (value) {
- priv->name = g_strdup (value);
- } else {
- priv->name = NULL;
- }
-
- g_object_notify (G_OBJECT (field), "name");
-}
-
-void
-tracker_field_set_data_type (TrackerField *field,
- TrackerFieldType value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- priv->data_type = value;
- g_object_notify (G_OBJECT (field), "data-type");
-}
-
-void
-tracker_field_set_field_name (TrackerField *field,
- const gchar *value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- g_free (priv->field_name);
-
- if (value) {
- priv->field_name = g_strdup (value);
- } else {
- priv->field_name = NULL;
- }
-
- g_object_notify (G_OBJECT (field), "field-name");
-}
-
-void
-tracker_field_set_weight (TrackerField *field,
- gint value)
-{
- TrackerFieldPriv *priv;
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- if (!field_int_validate (field, "weight", value)) {
- return;
- }
-
- priv = GET_PRIV (field);
-
- priv->weight = value;
- g_object_notify (G_OBJECT (field), "weight");
-}
-
-void
-tracker_field_set_embedded (TrackerField *field,
- gboolean value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- priv->embedded = value;
- g_object_notify (G_OBJECT (field), "embedded");
-}
-
-void
-tracker_field_set_multiple_values (TrackerField *field,
- gboolean value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- priv->multiple_values = value;
- g_object_notify (G_OBJECT (field), "multiple-values");
-}
-
-void
-tracker_field_set_delimited (TrackerField *field,
- gboolean value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- priv->delimited = value;
- g_object_notify (G_OBJECT (field), "delimited");
-}
-
-void
-tracker_field_set_filtered (TrackerField *field,
- gboolean value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- priv->filtered = value;
- g_object_notify (G_OBJECT (field), "filtered");
-}
-
-void
-tracker_field_set_store_metadata (TrackerField *field,
- gboolean value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- priv->store_metadata = value;
- g_object_notify (G_OBJECT (field), "store-metadata");
-}
-
-void
-tracker_field_set_child_ids (TrackerField *field,
- const GSList *value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- g_slist_foreach (priv->child_ids, (GFunc) g_free, NULL);
- g_slist_free (priv->child_ids);
-
- if (value) {
- GSList *new_list;
- const GSList *l;
-
- new_list = NULL;
-
- for (l = value; l; l = l->next) {
- new_list = g_slist_prepend (new_list, g_strdup (l->data));
- }
-
- new_list = g_slist_reverse (new_list);
- priv->child_ids = new_list;
- } else {
- priv->child_ids = NULL;
- }
-
- g_object_notify (G_OBJECT (field), "child-ids");
-}
-
-void
-tracker_field_append_child_id (TrackerField *field,
- const gchar *value)
-{
- TrackerFieldPriv *priv;
-
- g_return_if_fail (TRACKER_IS_FIELD (field));
-
- priv = GET_PRIV (field);
-
- if (value) {
- priv->child_ids = g_slist_append (priv->child_ids, g_strdup (value));
- }
-
- g_object_notify (G_OBJECT (field), "child-ids");
-}
diff --git a/src/libtracker-common/tracker-field.h b/src/libtracker-common/tracker-field.h
deleted file mode 100644
index 41be448..0000000
--- a/src/libtracker-common/tracker-field.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
- * Copyright (C) 2008, Nokia (urho konttori nokia com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __LIBTRACKER_COMMON_FIELD_H__
-#define __LIBTRACKER_COMMON_FIELD_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#if !defined (__LIBTRACKER_COMMON_INSIDE__) && !defined (TRACKER_COMPILATION)
-#error "only <libtracker-common/tracker-common.h> must be included directly."
-#endif
-
-#define TRACKER_TYPE_FIELD_TYPE (tracker_field_type_get_type ())
-
-typedef enum {
- TRACKER_FIELD_TYPE_KEYWORD,
- TRACKER_FIELD_TYPE_INDEX,
- TRACKER_FIELD_TYPE_FULLTEXT,
- TRACKER_FIELD_TYPE_STRING,
- TRACKER_FIELD_TYPE_INTEGER,
- TRACKER_FIELD_TYPE_DOUBLE,
- TRACKER_FIELD_TYPE_DATE,
- TRACKER_FIELD_TYPE_BLOB,
- TRACKER_FIELD_TYPE_STRUCT,
- TRACKER_FIELD_TYPE_LINK,
-} TrackerFieldType;
-
-GType tracker_field_type_get_type (void) G_GNUC_CONST;
-const gchar *tracker_field_type_to_string (TrackerFieldType fieldtype);
-
-
-
-#define TRACKER_TYPE_FIELD (tracker_field_get_type ())
-#define TRACKER_TYPE_FIELD_TYPE (tracker_field_type_get_type ())
-#define TRACKER_FIELD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_FIELD, TrackerField))
-#define TRACKER_FIELD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TRACKER_TYPE_FIELD, TrackerFieldClass))
-#define TRACKER_IS_FIELD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_FIELD))
-#define TRACKER_IS_FIELD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TRACKER_TYPE_FIELD))
-#define TRACKER_FIELD_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_FIELD, TrackerFieldClass))
-
-typedef struct _TrackerField TrackerField;
-typedef struct _TrackerFieldClass TrackerFieldClass;
-
-struct _TrackerField {
- GObject parent;
-};
-
-struct _TrackerFieldClass {
- GObjectClass parent_class;
-};
-
-GType tracker_field_get_type (void) G_GNUC_CONST;
-
-TrackerField * tracker_field_new (void);
-
-const gchar * tracker_field_get_id (TrackerField *field);
-const gchar * tracker_field_get_name (TrackerField *field);
-TrackerFieldType tracker_field_get_data_type (TrackerField *field);
-const gchar * tracker_field_get_field_name (TrackerField *field);
-gint tracker_field_get_weight (TrackerField *service);
-gboolean tracker_field_get_embedded (TrackerField *field);
-gboolean tracker_field_get_multiple_values (TrackerField *field);
-gboolean tracker_field_get_delimited (TrackerField *field);
-gboolean tracker_field_get_filtered (TrackerField *field);
-gboolean tracker_field_get_store_metadata (TrackerField *field);
-const GSList * tracker_field_get_child_ids (TrackerField *field);
-
-void tracker_field_set_id (TrackerField *field,
- const gchar *value);
-void tracker_field_set_name (TrackerField *field,
- const gchar *value);
-void tracker_field_set_data_type (TrackerField *field,
- TrackerFieldType value);
-void tracker_field_set_field_name (TrackerField *field,
- const gchar *value);
-void tracker_field_set_weight (TrackerField *field,
- gint value);
-void tracker_field_set_embedded (TrackerField *field,
- gboolean value);
-void tracker_field_set_multiple_values (TrackerField *field,
- gboolean value);
-void tracker_field_set_delimited (TrackerField *field,
- gboolean value);
-void tracker_field_set_filtered (TrackerField *field,
- gboolean value);
-void tracker_field_set_store_metadata (TrackerField *field,
- gboolean value);
-void tracker_field_set_child_ids (TrackerField *field,
- const GSList *value);
-void tracker_field_append_child_id (TrackerField *field,
- const gchar *id);
-
-G_END_DECLS
-
-#endif /* __LIBTRACKER_COMMON_FIELD_H__ */
-
diff --git a/src/libtracker-common/tracker-ontology.c b/src/libtracker-common/tracker-ontology.c
index 56a4105..0d69e26 100644
--- a/src/libtracker-common/tracker-ontology.c
+++ b/src/libtracker-common/tracker-ontology.c
@@ -164,7 +164,7 @@ tracker_ontology_init (void)
* when inserting metadata types in the DB, so the enum class needs to be
* created beforehand.
*/
- field_type_enum_class = g_type_class_ref (TRACKER_TYPE_FIELD_TYPE);
+ field_type_enum_class = g_type_class_ref (TRACKER_TYPE_PROPERTY_TYPE);
initialized = TRUE;
}
@@ -456,11 +456,11 @@ tracker_ontology_get_field_names_registered (const gchar *service_str)
fields = g_hash_table_get_values (field_names);
for (l = fields; l; l = l->next) {
- TrackerField *field;
+ TrackerProperty *field;
const gchar *name;
field = l->data;
- name = tracker_field_get_name (field);
+ name = tracker_property_get_name (field);
if (service_str == NULL ||
(prefix && g_str_has_prefix (name, prefix)) ||
@@ -666,22 +666,22 @@ tracker_ontology_service_get_show_files (const gchar *service_str)
/* Field mechanics */
void
-tracker_ontology_field_add (TrackerField *field)
+tracker_ontology_field_add (TrackerProperty *field)
{
const gchar *name;
- g_return_if_fail (TRACKER_IS_FIELD (field));
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
- name = tracker_field_get_name (field);
+ name = tracker_property_get_name (field);
g_return_if_fail (name != NULL);
g_hash_table_insert (field_names,
- /* g_utf8_collate_key (tracker_field_get_name (field), -1), */
+ /* g_utf8_collate_key (tracker_property_get_name (field), -1), */
g_strdup (name),
g_object_ref (field));
}
-TrackerField *
+TrackerProperty *
tracker_ontology_get_field_by_name (const gchar *name)
{
g_return_val_if_fail (name != NULL, NULL);
@@ -689,10 +689,10 @@ tracker_ontology_get_field_by_name (const gchar *name)
return g_hash_table_lookup (field_names, name);
}
-TrackerField *
+TrackerProperty *
tracker_ontology_get_field_by_id (gint id)
{
- TrackerField *field = NULL;
+ TrackerProperty *field = NULL;
GList *values;
GList *l;
@@ -701,7 +701,7 @@ tracker_ontology_get_field_by_id (gint id)
values = g_hash_table_get_values (field_names);
for (l = values; l && !field; l = l->next) {
- if (atoi (tracker_field_get_id (l->data)) == id) {
+ if (atoi (tracker_property_get_id (l->data)) == id) {
field = l->data;
}
}
@@ -712,17 +712,17 @@ tracker_ontology_get_field_by_id (gint id)
}
gchar *
-tracker_ontology_get_field_name_by_service_name (TrackerField *field,
+tracker_ontology_get_field_name_by_service_name (TrackerProperty *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 (TRACKER_IS_PROPERTY (field), NULL);
g_return_val_if_fail (service_str != NULL, NULL);
- meta_name = tracker_field_get_name (field);
+ meta_name = tracker_property_get_name (field);
key_field = tracker_ontology_service_get_key_metadata (service_str,
meta_name);
@@ -731,8 +731,8 @@ tracker_ontology_get_field_name_by_service_name (TrackerField *field,
}
- /* TODO do it using field_name in TrackerField! */
- field_name = tracker_field_get_field_name (field);
+ /* TODO do it using field_name in TrackerProperty! */
+ field_name = tracker_property_get_field_name (field);
if (field_name) {
return g_strdup (field_name);
} else {
@@ -744,17 +744,17 @@ tracker_ontology_get_field_name_by_service_name (TrackerField *field,
* Field data
*/
gchar *
-tracker_ontology_field_get_display_name (TrackerField *field)
+tracker_ontology_field_get_display_name (TrackerProperty *field)
{
- TrackerFieldType type;
+ TrackerPropertyType type;
- g_return_val_if_fail (TRACKER_IS_FIELD (field), NULL);
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
- type = tracker_field_get_data_type (field);
+ type = tracker_property_get_data_type (field);
- if (type == TRACKER_FIELD_TYPE_INDEX ||
- type == TRACKER_FIELD_TYPE_STRING ||
- type == TRACKER_FIELD_TYPE_DOUBLE) {
+ if (type == TRACKER_PROPERTY_TYPE_INDEX ||
+ type == TRACKER_PROPERTY_TYPE_STRING ||
+ type == TRACKER_PROPERTY_TYPE_DOUBLE) {
return g_strdup ("MetaDataDisplay");
}
@@ -764,14 +764,14 @@ tracker_ontology_field_get_display_name (TrackerField *field)
const gchar *
tracker_ontology_field_get_id (const gchar *name)
{
- TrackerField *field;
+ TrackerProperty *field;
g_return_val_if_fail (name != NULL, NULL);
field = tracker_ontology_get_field_by_name (name);
if (field) {
- return tracker_field_get_id (field);
+ return tracker_property_get_id (field);
}
return NULL;
@@ -781,8 +781,8 @@ gboolean
tracker_ontology_field_is_child_of (const gchar *field_str_child,
const gchar *field_str_parent)
{
- TrackerField *field_child;
- TrackerField *field_parent;
+ TrackerProperty *field_child;
+ TrackerProperty *field_parent;
const GSList *l;
g_return_val_if_fail (field_str_child != NULL, FALSE);
@@ -800,12 +800,12 @@ tracker_ontology_field_is_child_of (const gchar *field_str_child,
return FALSE;
}
- for (l = tracker_field_get_child_ids (field_parent); l; l = l->next) {
+ for (l = tracker_property_get_child_ids (field_parent); l; l = l->next) {
if (!l->data) {
return FALSE;
}
- if (strcmp (tracker_field_get_id (field_child), l->data) == 0) {
+ if (strcmp (tracker_property_get_id (field_child), l->data) == 0) {
return TRUE;
}
}
@@ -816,12 +816,12 @@ tracker_ontology_field_is_child_of (const gchar *field_str_child,
const gchar *
tracker_ontology_get_field_name_by_id (gint id)
{
- TrackerField *field;
+ TrackerProperty *field;
field = tracker_ontology_get_field_by_id (id);
if (field) {
- return tracker_field_get_name (field);
+ return tracker_property_get_name (field);
}
return NULL;
diff --git a/src/libtracker-common/tracker-ontology.h b/src/libtracker-common/tracker-ontology.h
index c53f4a5..17aece6 100644
--- a/src/libtracker-common/tracker-ontology.h
+++ b/src/libtracker-common/tracker-ontology.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
-#include "tracker-field.h"
+#include "tracker-property.h"
#include "tracker-class.h"
G_BEGIN_DECLS
@@ -69,14 +69,14 @@ gboolean tracker_ontology_service_get_show_files (const gchar *service_str);
const gchar * tracker_ontology_get_field_name_by_id (gint id);
/* 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,
+void tracker_ontology_field_add (TrackerProperty *field);
+TrackerProperty * tracker_ontology_get_field_by_name (const gchar *name);
+TrackerProperty * tracker_ontology_get_field_by_id (gint id);
+gchar * tracker_ontology_get_field_name_by_service_name (TrackerProperty *field,
const gchar *service_str);
/* Field data */
-gchar * tracker_ontology_field_get_display_name (TrackerField *field);
+gchar * tracker_ontology_field_get_display_name (TrackerProperty *field);
const gchar * tracker_ontology_field_get_id (const gchar *name);
gboolean tracker_ontology_field_is_child_of (const gchar *child,
const gchar *parent);
diff --git a/src/libtracker-common/tracker-property.c b/src/libtracker-common/tracker-property.c
new file mode 100644
index 0000000..caec7f5
--- /dev/null
+++ b/src/libtracker-common/tracker-property.c
@@ -0,0 +1,753 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * Copyright (C) 2008, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include "tracker-property.h"
+
+#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_PROPERTY, TrackerPropertyPriv))
+
+typedef struct _TrackerPropertyPriv TrackerPropertyPriv;
+
+struct _TrackerPropertyPriv {
+ gchar *id;
+ gchar *name;
+
+ TrackerPropertyType data_type;
+ gchar *field_name;
+ gint weight;
+ gboolean embedded;
+ gboolean multiple_values;
+ gboolean delimited;
+ gboolean filtered;
+ gboolean store_metadata;
+
+ GSList *child_ids;
+};
+
+static void property_finalize (GObject *object);
+static void property_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void property_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+enum {
+ PROP_0,
+ PROP_ID,
+ PROP_NAME,
+ PROP_DATA_TYPE,
+ PROP_FIELD_NAME,
+ PROP_WEIGHT,
+ PROP_EMBEDDED,
+ PROP_MULTIPLE_VALUES,
+ PROP_DELIMITED,
+ PROP_FILTERED,
+ PROP_STORE_METADATA,
+ PROP_CHILD_IDS
+};
+
+GType
+tracker_property_type_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { TRACKER_PROPERTY_TYPE_KEYWORD,
+ "TRACKER_PROPERTY_TYPE_KEYWORD",
+ "keyword" },
+ { TRACKER_PROPERTY_TYPE_INDEX,
+ "TRACKER_PROPERTY_TYPE_INDEX",
+ "index" },
+ { TRACKER_PROPERTY_TYPE_FULLTEXT,
+ "TRACKER_PROPERTY_TYPE_FULLTEXT",
+ "fulltext" },
+ { TRACKER_PROPERTY_TYPE_STRING,
+ "TRACKER_PROPERTY_TYPE_STRING",
+ "string" },
+ { TRACKER_PROPERTY_TYPE_INTEGER,
+ "TRACKER_PROPERTY_TYPE_INTEGER",
+ "integer" },
+ { TRACKER_PROPERTY_TYPE_DOUBLE,
+ "TRACKER_PROPERTY_TYPE_DOUBLE",
+ "double" },
+ { TRACKER_PROPERTY_TYPE_DATE,
+ "TRACKER_PROPERTY_TYPE_DATE",
+ "date" },
+ { TRACKER_PROPERTY_TYPE_BLOB,
+ "TRACKER_PROPERTY_TYPE_BLOB",
+ "blob" },
+ { TRACKER_PROPERTY_TYPE_STRUCT,
+ "TRACKER_PROPERTY_TYPE_STRUCT",
+ "struct" },
+ { TRACKER_PROPERTY_TYPE_LINK,
+ "TRACKER_PROPERTY_TYPE_LINK",
+ "link" },
+ { 0, NULL, NULL }
+ };
+
+ etype = g_enum_register_static ("TrackerPropertyType", values);
+ }
+
+ return etype;
+}
+
+G_DEFINE_TYPE (TrackerProperty, tracker_property, G_TYPE_OBJECT);
+
+const gchar *
+tracker_property_type_to_string (TrackerPropertyType fieldtype)
+{
+ GType type;
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+
+ type = tracker_property_type_get_type ();
+ enum_class = G_ENUM_CLASS (g_type_class_peek (type));
+ enum_value = g_enum_get_value (enum_class, fieldtype);
+
+ if (!enum_value) {
+ return NULL;
+ }
+
+ return enum_value->value_nick;
+}
+
+static void
+tracker_property_class_init (TrackerPropertyClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = property_finalize;
+ object_class->get_property = property_get_property;
+ object_class->set_property = property_set_property;
+
+ g_object_class_install_property (object_class,
+ PROP_ID,
+ g_param_spec_string ("id",
+ "id",
+ "Unique identifier for this field",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "name",
+ "Field name",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_DATA_TYPE,
+ g_param_spec_enum ("data-type",
+ "data-type",
+ "Field data type",
+ tracker_property_type_get_type (),
+ TRACKER_PROPERTY_TYPE_INDEX,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_FIELD_NAME,
+ g_param_spec_string ("field-name",
+ "field-name",
+ "Column in services table with the contents of this metadata",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_WEIGHT,
+ g_param_spec_int ("weight",
+ "weight",
+ "Boost to the score",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_EMBEDDED,
+ g_param_spec_boolean ("embedded",
+ "embedded",
+ "Embedded",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_MULTIPLE_VALUES,
+ g_param_spec_boolean ("multiple-values",
+ "multiple-values",
+ "Multiple values",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_DELIMITED,
+ g_param_spec_boolean ("delimited",
+ "delimited",
+ "Delimited",
+ FALSE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_FILTERED,
+ g_param_spec_boolean ("filtered",
+ "filtered",
+ "Filtered",
+ FALSE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_STORE_METADATA,
+ g_param_spec_boolean ("store-metadata",
+ "store-metadata",
+ "Store metadata",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_CHILD_IDS,
+ g_param_spec_pointer ("child-ids",
+ "child-ids",
+ "Child ids",
+ G_PARAM_READWRITE));
+
+ g_type_class_add_private (object_class, sizeof (TrackerPropertyPriv));
+}
+
+static void
+tracker_property_init (TrackerProperty *field)
+{
+}
+
+static void
+property_finalize (GObject *object)
+{
+ TrackerPropertyPriv *priv;
+
+ priv = GET_PRIV (object);
+
+ g_free (priv->id);
+ g_free (priv->name);
+
+ if (priv->field_name) {
+ g_free (priv->field_name);
+ }
+
+ g_slist_foreach (priv->child_ids, (GFunc) g_free, NULL);
+ g_slist_free (priv->child_ids);
+
+ (G_OBJECT_CLASS (tracker_property_parent_class)->finalize) (object);
+}
+
+static void
+property_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ TrackerPropertyPriv *priv;
+
+ priv = GET_PRIV (object);
+
+ switch (param_id) {
+ case PROP_ID:
+ g_value_set_string (value, priv->id);
+ break;
+ case PROP_NAME:
+ g_value_set_string (value, priv->name);
+ break;
+ case PROP_DATA_TYPE:
+ g_value_set_enum (value, priv->data_type);
+ break;
+ case PROP_FIELD_NAME:
+ g_value_set_string (value, priv->field_name);
+ break;
+ case PROP_WEIGHT:
+ g_value_set_int (value, priv->weight);
+ break;
+ case PROP_EMBEDDED:
+ g_value_set_boolean (value, priv->embedded);
+ break;
+ case PROP_MULTIPLE_VALUES:
+ g_value_set_boolean (value, priv->multiple_values);
+ break;
+ case PROP_DELIMITED:
+ g_value_set_boolean (value, priv->delimited);
+ break;
+ case PROP_FILTERED:
+ g_value_set_boolean (value, priv->filtered);
+ break;
+ case PROP_STORE_METADATA:
+ g_value_set_boolean (value, priv->store_metadata);
+ break;
+ case PROP_CHILD_IDS:
+ g_value_set_pointer (value, priv->child_ids);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
+}
+
+static void
+property_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (param_id) {
+ case PROP_ID:
+ tracker_property_set_id (TRACKER_PROPERTY (object),
+ g_value_get_string (value));
+ break;
+ case PROP_NAME:
+ tracker_property_set_name (TRACKER_PROPERTY (object),
+ g_value_get_string (value));
+ break;
+ case PROP_DATA_TYPE:
+ tracker_property_set_data_type (TRACKER_PROPERTY (object),
+ g_value_get_enum (value));
+ break;
+ case PROP_FIELD_NAME:
+ tracker_property_set_field_name (TRACKER_PROPERTY (object),
+ g_value_get_string (value));
+ break;
+ case PROP_WEIGHT:
+ tracker_property_set_weight (TRACKER_PROPERTY (object),
+ g_value_get_int (value));
+ break;
+ case PROP_EMBEDDED:
+ tracker_property_set_embedded (TRACKER_PROPERTY (object),
+ g_value_get_boolean (value));
+ break;
+ case PROP_MULTIPLE_VALUES:
+ tracker_property_set_multiple_values (TRACKER_PROPERTY (object),
+ g_value_get_boolean (value));
+ break;
+ case PROP_DELIMITED:
+ tracker_property_set_delimited (TRACKER_PROPERTY (object),
+ g_value_get_boolean (value));
+ break;
+ case PROP_FILTERED:
+ tracker_property_set_filtered (TRACKER_PROPERTY (object),
+ g_value_get_boolean (value));
+ break;
+ case PROP_STORE_METADATA:
+ tracker_property_set_store_metadata (TRACKER_PROPERTY (object),
+ g_value_get_boolean (value));
+ break;
+ case PROP_CHILD_IDS:
+ tracker_property_set_child_ids (TRACKER_PROPERTY (object),
+ g_value_get_pointer (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
+}
+
+static gboolean
+field_int_validate (TrackerProperty *field,
+ const gchar *property,
+ gint value)
+{
+#ifdef G_DISABLE_CHECKS
+ GParamSpec *spec;
+ GValue value = { 0 };
+ gboolean valid;
+
+ spec = g_object_class_find_property (G_OBJECT_CLASS (field), property);
+ g_return_val_if_fail (spec != NULL, FALSE);
+
+ g_value_init (&value, spec->value_type);
+ g_value_set_int (&value, verbosity);
+ valid = g_param_value_validate (spec, &value);
+ g_value_unset (&value);
+
+ g_return_val_if_fail (valid != TRUE, FALSE);
+#endif
+
+ return TRUE;
+}
+
+/**
+ * tracker_property_new:
+ *
+ * Creates a new #TrackerProperty instance.
+ *
+ * Returns: The newly created #TrackerProperty
+ **/
+TrackerProperty *
+tracker_property_new (void)
+{
+ TrackerProperty *field;
+
+ field = g_object_new (TRACKER_TYPE_PROPERTY, NULL);
+
+ return field;
+}
+
+const gchar *
+tracker_property_get_id (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
+
+ priv = GET_PRIV (field);
+
+ return priv->id;
+}
+
+const gchar *
+tracker_property_get_name (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
+
+ priv = GET_PRIV (field);
+
+ return priv->name;
+}
+
+TrackerPropertyType
+tracker_property_get_data_type (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), TRACKER_PROPERTY_TYPE_STRING); //FIXME
+
+ priv = GET_PRIV (field);
+
+ return priv->data_type;
+}
+
+const gchar *
+tracker_property_get_field_name (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
+
+ priv = GET_PRIV (field);
+
+ return priv->field_name;
+}
+
+gint
+tracker_property_get_weight (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), -1);
+
+ priv = GET_PRIV (field);
+
+ return priv->weight;
+}
+
+
+gboolean
+tracker_property_get_embedded (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), FALSE);
+
+ priv = GET_PRIV (field);
+
+ return priv->embedded;
+}
+
+
+gboolean
+tracker_property_get_multiple_values (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), FALSE);
+
+ priv = GET_PRIV (field);
+
+ return priv->multiple_values;
+}
+
+gboolean
+tracker_property_get_delimited (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), FALSE);
+
+ priv = GET_PRIV (field);
+
+ return priv->delimited;
+}
+
+gboolean
+tracker_property_get_filtered (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), FALSE);
+
+ priv = GET_PRIV (field);
+
+ return priv->filtered;
+}
+
+gboolean
+tracker_property_get_store_metadata (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), FALSE);
+
+ priv = GET_PRIV (field);
+
+ return priv->store_metadata;
+}
+
+
+const GSList *
+tracker_property_get_child_ids (TrackerProperty *field)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
+
+ priv = GET_PRIV (field);
+
+ return priv->child_ids;
+}
+
+
+void
+tracker_property_set_id (TrackerProperty *field,
+ const gchar *value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ g_free (priv->id);
+
+ if (value) {
+ priv->id = g_strdup (value);
+ } else {
+ priv->id = NULL;
+ }
+
+ g_object_notify (G_OBJECT (field), "id");
+}
+
+void
+tracker_property_set_name (TrackerProperty *field,
+ const gchar *value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ g_free (priv->name);
+
+ if (value) {
+ priv->name = g_strdup (value);
+ } else {
+ priv->name = NULL;
+ }
+
+ g_object_notify (G_OBJECT (field), "name");
+}
+
+void
+tracker_property_set_data_type (TrackerProperty *field,
+ TrackerPropertyType value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ priv->data_type = value;
+ g_object_notify (G_OBJECT (field), "data-type");
+}
+
+void
+tracker_property_set_field_name (TrackerProperty *field,
+ const gchar *value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ g_free (priv->field_name);
+
+ if (value) {
+ priv->field_name = g_strdup (value);
+ } else {
+ priv->field_name = NULL;
+ }
+
+ g_object_notify (G_OBJECT (field), "field-name");
+}
+
+void
+tracker_property_set_weight (TrackerProperty *field,
+ gint value)
+{
+ TrackerPropertyPriv *priv;
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ if (!field_int_validate (field, "weight", value)) {
+ return;
+ }
+
+ priv = GET_PRIV (field);
+
+ priv->weight = value;
+ g_object_notify (G_OBJECT (field), "weight");
+}
+
+void
+tracker_property_set_embedded (TrackerProperty *field,
+ gboolean value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ priv->embedded = value;
+ g_object_notify (G_OBJECT (field), "embedded");
+}
+
+void
+tracker_property_set_multiple_values (TrackerProperty *field,
+ gboolean value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ priv->multiple_values = value;
+ g_object_notify (G_OBJECT (field), "multiple-values");
+}
+
+void
+tracker_property_set_delimited (TrackerProperty *field,
+ gboolean value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ priv->delimited = value;
+ g_object_notify (G_OBJECT (field), "delimited");
+}
+
+void
+tracker_property_set_filtered (TrackerProperty *field,
+ gboolean value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ priv->filtered = value;
+ g_object_notify (G_OBJECT (field), "filtered");
+}
+
+void
+tracker_property_set_store_metadata (TrackerProperty *field,
+ gboolean value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ priv->store_metadata = value;
+ g_object_notify (G_OBJECT (field), "store-metadata");
+}
+
+void
+tracker_property_set_child_ids (TrackerProperty *field,
+ const GSList *value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ g_slist_foreach (priv->child_ids, (GFunc) g_free, NULL);
+ g_slist_free (priv->child_ids);
+
+ if (value) {
+ GSList *new_list;
+ const GSList *l;
+
+ new_list = NULL;
+
+ for (l = value; l; l = l->next) {
+ new_list = g_slist_prepend (new_list, g_strdup (l->data));
+ }
+
+ new_list = g_slist_reverse (new_list);
+ priv->child_ids = new_list;
+ } else {
+ priv->child_ids = NULL;
+ }
+
+ g_object_notify (G_OBJECT (field), "child-ids");
+}
+
+void
+tracker_property_append_child_id (TrackerProperty *field,
+ const gchar *value)
+{
+ TrackerPropertyPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+ priv = GET_PRIV (field);
+
+ if (value) {
+ priv->child_ids = g_slist_append (priv->child_ids, g_strdup (value));
+ }
+
+ g_object_notify (G_OBJECT (field), "child-ids");
+}
diff --git a/src/libtracker-common/tracker-property.h b/src/libtracker-common/tracker-property.h
new file mode 100644
index 0000000..22f5688
--- /dev/null
+++ b/src/libtracker-common/tracker-property.h
@@ -0,0 +1,116 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * Copyright (C) 2008, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __LIBTRACKER_COMMON_PROPERTY_H__
+#define __LIBTRACKER_COMMON_PROPERTY_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#if !defined (__LIBTRACKER_COMMON_INSIDE__) && !defined (TRACKER_COMPILATION)
+#error "only <libtracker-common/tracker-common.h> must be included directly."
+#endif
+
+#define TRACKER_TYPE_PROPERTY_TYPE (tracker_property_type_get_type ())
+
+typedef enum {
+ TRACKER_PROPERTY_TYPE_KEYWORD,
+ TRACKER_PROPERTY_TYPE_INDEX,
+ TRACKER_PROPERTY_TYPE_FULLTEXT,
+ TRACKER_PROPERTY_TYPE_STRING,
+ TRACKER_PROPERTY_TYPE_INTEGER,
+ TRACKER_PROPERTY_TYPE_DOUBLE,
+ TRACKER_PROPERTY_TYPE_DATE,
+ TRACKER_PROPERTY_TYPE_BLOB,
+ TRACKER_PROPERTY_TYPE_STRUCT,
+ TRACKER_PROPERTY_TYPE_LINK,
+} TrackerPropertyType;
+
+GType tracker_property_type_get_type (void) G_GNUC_CONST;
+const gchar *tracker_property_type_to_string (TrackerPropertyType fieldtype);
+
+
+
+#define TRACKER_TYPE_PROPERTY (tracker_property_get_type ())
+#define TRACKER_TYPE_PROPERTY_TYPE (tracker_property_type_get_type ())
+#define TRACKER_PROPERTY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_PROPERTY, TrackerProperty))
+#define TRACKER_PROPERTY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TRACKER_TYPE_PROPERTY, TrackerPropertyClass))
+#define TRACKER_IS_PROPERTY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_PROPERTY))
+#define TRACKER_IS_PROPERTY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TRACKER_TYPE_PROPERTY))
+#define TRACKER_PROPERTY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_PROPERTY, TrackerPropertyClass))
+
+typedef struct _TrackerProperty TrackerProperty;
+typedef struct _TrackerPropertyClass TrackerPropertyClass;
+
+struct _TrackerProperty {
+ GObject parent;
+};
+
+struct _TrackerPropertyClass {
+ GObjectClass parent_class;
+};
+
+GType tracker_property_get_type (void) G_GNUC_CONST;
+
+TrackerProperty * tracker_property_new (void);
+
+const gchar * tracker_property_get_id (TrackerProperty *field);
+const gchar * tracker_property_get_name (TrackerProperty *field);
+TrackerPropertyType tracker_property_get_data_type (TrackerProperty *field);
+const gchar * tracker_property_get_field_name (TrackerProperty *field);
+gint tracker_property_get_weight (TrackerProperty *service);
+gboolean tracker_property_get_embedded (TrackerProperty *field);
+gboolean tracker_property_get_multiple_values (TrackerProperty *field);
+gboolean tracker_property_get_delimited (TrackerProperty *field);
+gboolean tracker_property_get_filtered (TrackerProperty *field);
+gboolean tracker_property_get_store_metadata (TrackerProperty *field);
+const GSList * tracker_property_get_child_ids (TrackerProperty *field);
+
+void tracker_property_set_id (TrackerProperty *field,
+ const gchar *value);
+void tracker_property_set_name (TrackerProperty *field,
+ const gchar *value);
+void tracker_property_set_data_type (TrackerProperty *field,
+ TrackerPropertyType value);
+void tracker_property_set_field_name (TrackerProperty *field,
+ const gchar *value);
+void tracker_property_set_weight (TrackerProperty *field,
+ gint value);
+void tracker_property_set_embedded (TrackerProperty *field,
+ gboolean value);
+void tracker_property_set_multiple_values (TrackerProperty *field,
+ gboolean value);
+void tracker_property_set_delimited (TrackerProperty *field,
+ gboolean value);
+void tracker_property_set_filtered (TrackerProperty *field,
+ gboolean value);
+void tracker_property_set_store_metadata (TrackerProperty *field,
+ gboolean value);
+void tracker_property_set_child_ids (TrackerProperty *field,
+ const GSList *value);
+void tracker_property_append_child_id (TrackerProperty *field,
+ const gchar *id);
+
+G_END_DECLS
+
+#endif /* __LIBTRACKER_COMMON_PROPERTY_H__ */
+
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index ac2ec34..4db9165 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -48,7 +48,7 @@ static void
extended_result_set_to_turtle (TrackerDBResultSet *result_set,
TurtleFile *turtle_file)
{
- TrackerField *field;
+ TrackerProperty *field;
gboolean valid = TRUE;
while (valid) {
@@ -74,7 +74,7 @@ extended_result_set_to_turtle (TrackerDBResultSet *result_set,
}
g_debug ("Inserting in turtle <%s, %s, %s>",
- uri, tracker_field_get_name (field), str);
+ uri, tracker_property_get_name (field), str);
tracker_turtle_add_triple (turtle_file, uri, field, str);
g_free (str);
diff --git a/src/libtracker-data/tracker-data-manager.h b/src/libtracker-data/tracker-data-manager.h
index 76b1f66..0989791 100644
--- a/src/libtracker-data/tracker-data-manager.h
+++ b/src/libtracker-data/tracker-data-manager.h
@@ -27,7 +27,7 @@
#include <glib.h>
#include <libtracker-common/tracker-config.h>
-#include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-property.h>
#include <libtracker-common/tracker-language.h>
#include <libtracker-common/tracker-ontology.h>
diff --git a/src/libtracker-data/tracker-data-metadata.c b/src/libtracker-data/tracker-data-metadata.c
index a3babd2..9ba136e 100644
--- a/src/libtracker-data/tracker-data-metadata.c
+++ b/src/libtracker-data/tracker-data-metadata.c
@@ -56,11 +56,11 @@ remove_metadata_foreach (gpointer key,
gpointer value,
gpointer user_data)
{
- TrackerField *field;
+ TrackerProperty *field;
- field = (TrackerField *) key;
+ field = (TrackerProperty *) key;
- if (tracker_field_get_multiple_values (field)) {
+ if (tracker_property_get_multiple_values (field)) {
GList *list;
list = (GList *) value;
@@ -105,7 +105,7 @@ tracker_data_metadata_insert (TrackerDataMetadata *metadata,
const gchar *field_name,
const gchar *value)
{
- TrackerField *field;
+ TrackerProperty *field;
gchar *old_value;
g_return_if_fail (metadata != NULL);
@@ -114,8 +114,8 @@ tracker_data_metadata_insert (TrackerDataMetadata *metadata,
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);
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+ g_return_if_fail (tracker_property_get_multiple_values (field) == FALSE);
old_value = g_hash_table_lookup (metadata->table, field);
g_free (old_value);
@@ -144,7 +144,7 @@ tracker_data_metadata_insert_values (TrackerDataMetadata *metadata,
const gchar *field_name,
const GList *list)
{
- TrackerField *field;
+ TrackerProperty *field;
GList *old_values, *copy;
g_return_if_fail (metadata != NULL);
@@ -161,8 +161,8 @@ tracker_data_metadata_insert_values (TrackerDataMetadata *metadata,
return;
}
- g_return_if_fail (TRACKER_IS_FIELD (field));
- g_return_if_fail (tracker_field_get_multiple_values (field) == TRUE);
+ g_return_if_fail (TRACKER_IS_PROPERTY (field));
+ g_return_if_fail (tracker_property_get_multiple_values (field) == TRUE);
copy = tracker_glist_copy_with_string_data ((GList *)list);
@@ -193,15 +193,15 @@ G_CONST_RETURN gchar *
tracker_data_metadata_lookup (TrackerDataMetadata *metadata,
const gchar *field_name)
{
- TrackerField *field;
+ TrackerProperty *field;
g_return_val_if_fail (metadata != NULL, NULL);
g_return_val_if_fail (field_name != NULL, NULL);
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);
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
+ g_return_val_if_fail (tracker_property_get_multiple_values (field) == FALSE, NULL);
return g_hash_table_lookup (metadata->table, field);
}
@@ -222,15 +222,15 @@ G_CONST_RETURN GList *
tracker_data_metadata_lookup_values (TrackerDataMetadata *metadata,
const gchar *field_name)
{
- TrackerField *field;
+ TrackerProperty *field;
g_return_val_if_fail (metadata != NULL, NULL);
g_return_val_if_fail (field_name != NULL, NULL);
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);
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (field), NULL);
+ g_return_val_if_fail (tracker_property_get_multiple_values (field) == TRUE, NULL);
return g_hash_table_lookup (metadata->table, field);
}
diff --git a/src/libtracker-data/tracker-data-metadata.h b/src/libtracker-data/tracker-data-metadata.h
index 11439c9..7a89e18 100644
--- a/src/libtracker-data/tracker-data-metadata.h
+++ b/src/libtracker-data/tracker-data-metadata.h
@@ -28,10 +28,10 @@
typedef struct TrackerDataMetadata TrackerDataMetadata;
-typedef void (* TrackerDataMetadataForeach) (TrackerField *field,
+typedef void (* TrackerDataMetadataForeach) (TrackerProperty *field,
gpointer value,
gpointer user_data);
-typedef gboolean (* TrackerDataMetadataRemove) (TrackerField *field,
+typedef gboolean (* TrackerDataMetadataRemove) (TrackerProperty *field,
gpointer value,
gpointer user_data);
diff --git a/src/libtracker-data/tracker-data-query.c b/src/libtracker-data/tracker-data-query.c
index e9107ca..f6bffa0 100644
--- a/src/libtracker-data/tracker-data-query.c
+++ b/src/libtracker-data/tracker-data-query.c
@@ -47,7 +47,7 @@ db_result_set_to_ptr_array (TrackerDBResultSet *result_set,
{
gchar *prop_id_str;
gchar *value;
- TrackerField *field;
+ TrackerProperty *field;
gboolean valid = result_set != NULL;
while (valid) {
@@ -59,7 +59,7 @@ db_result_set_to_ptr_array (TrackerDBResultSet *result_set,
field = tracker_ontology_get_field_by_id (GPOINTER_TO_UINT (prop_id_str));
- item[0] = g_strdup (tracker_field_get_name (field));
+ item[0] = g_strdup (tracker_property_get_name (field));
g_ptr_array_add (*previous, item);
@@ -312,7 +312,7 @@ result_set_to_metadata (TrackerDBResultSet *result_set,
TrackerDataMetadata *metadata,
gboolean embedded)
{
- TrackerField *field;
+ TrackerProperty *field;
gint metadata_id;
gboolean valid = TRUE;
@@ -350,27 +350,27 @@ result_set_to_metadata (TrackerDBResultSet *result_set,
return;
}
- if (tracker_field_get_embedded (field) == embedded) {
- if (tracker_field_get_multiple_values (field)) {
+ if (tracker_property_get_embedded (field) == embedded) {
+ if (tracker_property_get_multiple_values (field)) {
GList *new_values;
const GList *old_values;
new_values = NULL;
old_values = tracker_data_metadata_lookup_values (metadata,
- tracker_field_get_name (field));
+ tracker_property_get_name (field));
if (old_values) {
new_values = g_list_copy ((GList*) old_values);
}
new_values = g_list_prepend (new_values, str);
tracker_data_metadata_insert_values (metadata,
- tracker_field_get_name (field),
+ tracker_property_get_name (field),
new_values);
g_list_free (new_values);
} else {
tracker_data_metadata_insert (metadata,
- tracker_field_get_name (field),
+ tracker_property_get_name (field),
str);
}
}
@@ -496,7 +496,7 @@ tracker_data_query_parsed_metadata (TrackerClass *service,
gchar **
tracker_data_query_metadata_field_values (TrackerClass *service_def,
guint32 service_id,
- TrackerField *field)
+ TrackerProperty *field)
{
TrackerDBInterface *iface;
TrackerDBResultSet *result_set = NULL;
@@ -507,7 +507,7 @@ tracker_data_query_metadata_field_values (TrackerClass *service_def,
iface = tracker_db_manager_get_db_interface_by_type (tracker_class_get_name (service_def),
TRACKER_DB_CONTENT_TYPE_METADATA);
metadata_key = tracker_ontology_service_get_key_metadata (tracker_class_get_name (service_def),
- tracker_field_get_name (field));
+ tracker_property_get_name (field));
if (metadata_key > 0) {
gchar *query;
@@ -525,38 +525,38 @@ tracker_data_query_metadata_field_values (TrackerClass *service_def,
id_str = tracker_guint32_to_string (service_id);
- switch (tracker_field_get_data_type (field)) {
- case TRACKER_FIELD_TYPE_KEYWORD:
+ switch (tracker_property_get_data_type (field)) {
+ case TRACKER_PROPERTY_TYPE_KEYWORD:
result_set = tracker_db_interface_execute_procedure (iface, NULL,
"GetMetadataKeyword",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
break;
- case TRACKER_FIELD_TYPE_INDEX:
- case TRACKER_FIELD_TYPE_STRING:
- case TRACKER_FIELD_TYPE_DOUBLE:
+ case TRACKER_PROPERTY_TYPE_INDEX:
+ case TRACKER_PROPERTY_TYPE_STRING:
+ case TRACKER_PROPERTY_TYPE_DOUBLE:
result_set = tracker_db_interface_execute_procedure (iface, NULL,
"GetMetadata",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
break;
- case TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
+ case TRACKER_PROPERTY_TYPE_INTEGER:
+ case TRACKER_PROPERTY_TYPE_DATE:
result_set = tracker_db_interface_execute_procedure (iface, NULL,
"GetMetadataNumeric",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
is_numeric = TRUE;
break;
- case TRACKER_FIELD_TYPE_FULLTEXT:
+ case TRACKER_PROPERTY_TYPE_FULLTEXT:
tracker_data_query_content (service_def, service_id);
break;
- case TRACKER_FIELD_TYPE_BLOB:
- case TRACKER_FIELD_TYPE_STRUCT:
- case TRACKER_FIELD_TYPE_LINK:
+ case TRACKER_PROPERTY_TYPE_BLOB:
+ case TRACKER_PROPERTY_TYPE_STRUCT:
+ case TRACKER_PROPERTY_TYPE_LINK:
/* not handled */
default:
break;
@@ -586,7 +586,7 @@ tracker_data_query_content (TrackerClass *service,
guint32 service_id)
{
TrackerDBInterface *iface;
- TrackerField *field;
+ TrackerProperty *field;
gchar *service_id_str, *contents = NULL;
TrackerDBResultSet *result_set;
@@ -599,7 +599,7 @@ tracker_data_query_content (TrackerClass *service,
result_set = tracker_db_interface_execute_procedure (iface, NULL,
"GetContents",
service_id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
if (result_set) {
diff --git a/src/libtracker-data/tracker-data-query.h b/src/libtracker-data/tracker-data-query.h
index 3639bd7..0536a22 100644
--- a/src/libtracker-data/tracker-data-query.h
+++ b/src/libtracker-data/tracker-data-query.h
@@ -27,7 +27,7 @@
#include <glib.h>
#include <libtracker-common/tracker-config.h>
-#include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-property.h>
#include <libtracker-common/tracker-language.h>
#include <libtracker-common/tracker-ontology.h>
@@ -52,7 +52,7 @@ gchar * tracker_data_query_unparsed_metadata (TrackerClass
guint32 service_id);
gchar ** tracker_data_query_metadata_field_values (TrackerClass *service_def,
guint32 service_id,
- TrackerField *field_def);
+ TrackerProperty *field_def);
/* Using path */
gboolean tracker_data_query_service_exists (TrackerClass *service,
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index b0572ad..0641462 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -321,7 +321,7 @@ tracker_data_update_delete_all_metadata (TrackerClass *service,
void
tracker_data_update_set_metadata (TrackerClass *service,
guint32 service_id,
- TrackerField *field,
+ TrackerProperty *field,
const gchar *value,
const gchar *parsed_value)
{
@@ -338,53 +338,53 @@ tracker_data_update_set_metadata (TrackerClass *service,
iface = tracker_db_manager_get_db_interface_by_type (tracker_class_get_name (service),
TRACKER_DB_CONTENT_TYPE_METADATA);
- switch (tracker_field_get_data_type (field)) {
- case TRACKER_FIELD_TYPE_KEYWORD:
+ switch (tracker_property_get_data_type (field)) {
+ case TRACKER_PROPERTY_TYPE_KEYWORD:
tracker_db_interface_execute_procedure (iface, NULL,
"SetMetadataKeyword",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
value,
NULL);
break;
- case TRACKER_FIELD_TYPE_INDEX:
- case TRACKER_FIELD_TYPE_STRING:
- case TRACKER_FIELD_TYPE_DOUBLE:
+ case TRACKER_PROPERTY_TYPE_INDEX:
+ case TRACKER_PROPERTY_TYPE_STRING:
+ case TRACKER_PROPERTY_TYPE_DOUBLE:
tracker_db_interface_execute_procedure (iface, NULL,
"SetMetadata",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
parsed_value,
value,
value,
NULL);
break;
- case TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
+ case TRACKER_PROPERTY_TYPE_INTEGER:
+ case TRACKER_PROPERTY_TYPE_DATE:
tracker_db_interface_execute_procedure (iface, NULL,
"SetMetadataNumeric",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
value,
NULL);
break;
- case TRACKER_FIELD_TYPE_FULLTEXT:
+ case TRACKER_PROPERTY_TYPE_FULLTEXT:
tracker_data_update_set_content (service, service_id, value);
break;
- case TRACKER_FIELD_TYPE_BLOB:
- case TRACKER_FIELD_TYPE_STRUCT:
- case TRACKER_FIELD_TYPE_LINK:
+ case TRACKER_PROPERTY_TYPE_BLOB:
+ case TRACKER_PROPERTY_TYPE_STRUCT:
+ case TRACKER_PROPERTY_TYPE_LINK:
/* not handled */
default:
break;
}
metadata_key = tracker_ontology_service_get_key_metadata (tracker_class_get_name (service),
- tracker_field_get_name (field));
+ tracker_property_get_name (field));
if (metadata_key > 0) {
gchar *val;
@@ -396,8 +396,8 @@ tracker_data_update_set_metadata (TrackerClass *service,
val,
service_id);
g_free (val);
- } else if (tracker_field_get_data_type (field) == TRACKER_FIELD_TYPE_DATE &&
- (strcmp (tracker_field_get_name (field), "File:Modified") == 0)) {
+ } else if (tracker_property_get_data_type (field) == TRACKER_PROPERTY_TYPE_DATE &&
+ (strcmp (tracker_property_get_name (field), "File:Modified") == 0)) {
/* Handle mtime */
tracker_db_interface_execute_query (iface, NULL,
"update Services set IndexTime = '%s' where ID = %d",
@@ -406,7 +406,7 @@ tracker_data_update_set_metadata (TrackerClass *service,
}
collate_key = tracker_ontology_service_get_key_collate (tracker_class_get_name (service),
- tracker_field_get_name (field));
+ tracker_property_get_name (field));
if (collate_key > 0) {
gchar *val;
@@ -427,7 +427,7 @@ tracker_data_update_set_metadata (TrackerClass *service,
void
tracker_data_update_delete_metadata (TrackerClass *service,
guint32 service_id,
- TrackerField *field,
+ TrackerProperty *field,
const gchar *value)
{
TrackerDBInterface *iface;
@@ -438,58 +438,58 @@ tracker_data_update_delete_metadata (TrackerClass *service,
iface = tracker_db_manager_get_db_interface_by_type (tracker_class_get_name (service),
TRACKER_DB_CONTENT_TYPE_METADATA);
- switch (tracker_field_get_data_type (field)) {
- case TRACKER_FIELD_TYPE_KEYWORD:
+ switch (tracker_property_get_data_type (field)) {
+ case TRACKER_PROPERTY_TYPE_KEYWORD:
if (!value) {
g_debug ("Trying to remove keyword field with no specific value");
tracker_db_interface_execute_procedure (iface, NULL,
"DeleteMetadataKeyword",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
} else {
tracker_db_interface_execute_procedure (iface, NULL,
"DeleteMetadataKeywordValue",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
value,
NULL);
}
break;
- case TRACKER_FIELD_TYPE_INDEX:
- case TRACKER_FIELD_TYPE_STRING:
- case TRACKER_FIELD_TYPE_DOUBLE:
+ case TRACKER_PROPERTY_TYPE_INDEX:
+ case TRACKER_PROPERTY_TYPE_STRING:
+ case TRACKER_PROPERTY_TYPE_DOUBLE:
tracker_db_interface_execute_procedure (iface, NULL,
"DeleteMetadata",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
break;
- case TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
+ case TRACKER_PROPERTY_TYPE_INTEGER:
+ case TRACKER_PROPERTY_TYPE_DATE:
tracker_db_interface_execute_procedure (iface, NULL,
"DeleteMetadataNumeric",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
break;
- case TRACKER_FIELD_TYPE_FULLTEXT:
+ case TRACKER_PROPERTY_TYPE_FULLTEXT:
tracker_data_update_delete_content (service, service_id);
break;
- case TRACKER_FIELD_TYPE_BLOB:
- case TRACKER_FIELD_TYPE_STRUCT:
- case TRACKER_FIELD_TYPE_LINK:
+ case TRACKER_PROPERTY_TYPE_BLOB:
+ case TRACKER_PROPERTY_TYPE_STRUCT:
+ case TRACKER_PROPERTY_TYPE_LINK:
/* not handled */
default:
break;
}
metadata_key = tracker_ontology_service_get_key_metadata (tracker_class_get_name (service),
- tracker_field_get_name (field));
+ tracker_property_get_name (field));
if (metadata_key > 0) {
tracker_db_interface_execute_query (iface, NULL,
"update Services set KeyMetadata%d = '%s' where id = %d",
@@ -505,7 +505,7 @@ tracker_data_update_set_content (TrackerClass *service,
const gchar *text)
{
TrackerDBInterface *iface;
- TrackerField *field;
+ TrackerProperty *field;
gchar *id_str;
id_str = tracker_guint32_to_string (service_id);
@@ -516,7 +516,7 @@ tracker_data_update_set_content (TrackerClass *service,
tracker_db_interface_execute_procedure (iface, NULL,
"SaveServiceContents",
id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
text,
NULL);
g_free (id_str);
@@ -527,7 +527,7 @@ tracker_data_update_delete_content (TrackerClass *service,
guint32 service_id)
{
TrackerDBInterface *iface;
- TrackerField *field;
+ TrackerProperty *field;
gchar *service_id_str;
service_id_str = tracker_guint32_to_string (service_id);
@@ -539,7 +539,7 @@ tracker_data_update_delete_content (TrackerClass *service,
tracker_db_interface_execute_procedure (iface, NULL,
"DeleteContent",
service_id_str,
- tracker_field_get_id (field),
+ tracker_property_get_id (field),
NULL);
g_free (service_id_str);
@@ -609,7 +609,7 @@ tracker_data_update_delete_service_all (const gchar *rdf_type)
}
static void
-set_metadata (TrackerField *field,
+set_metadata (TrackerProperty *field,
gpointer value,
ForeachInMetadataInfo *info)
{
@@ -628,15 +628,15 @@ set_metadata (TrackerField *field,
info->language,
tracker_config_get_max_word_length (info->config),
tracker_config_get_min_word_length (info->config),
- tracker_field_get_filtered (field),
- tracker_field_get_filtered (field),
- tracker_field_get_delimited (field));
+ tracker_property_get_filtered (field),
+ tracker_property_get_filtered (field),
+ tracker_property_get_delimited (field));
if (!parsed_value) {
return;
}
- score = tracker_field_get_weight (field);
+ score = tracker_property_get_weight (field);
arr = g_strsplit (parsed_value, " ", -1);
service_id = tracker_class_get_id (info->service);
@@ -661,7 +661,7 @@ foreach_in_metadata_set_metadata (gpointer predicate,
gpointer value,
gpointer user_data)
{
- TrackerField *field;
+ TrackerProperty *field;
ForeachInMetadataInfo *info;
gint throttle;
@@ -677,7 +677,7 @@ foreach_in_metadata_set_metadata (gpointer predicate,
tracker_throttle (info->config, throttle * 100);
}
- if (!tracker_field_get_multiple_values (field)) {
+ if (!tracker_property_get_multiple_values (field)) {
set_metadata (field, value, user_data);
} else {
GList *list;
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index fcfef34..ea05cf6 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -62,14 +62,14 @@ void tracker_data_update_delete_service_all (const gchar *rdf_type);
/* Metadata */
void tracker_data_update_set_metadata (TrackerClass *service,
guint32 service_id,
- TrackerField *field,
+ TrackerProperty *field,
const gchar *value,
const gchar *parsed_value);
void tracker_data_update_delete_all_metadata (TrackerClass *service,
guint32 service_id);
void tracker_data_update_delete_metadata (TrackerClass *service,
guint32 service_id,
- TrackerField *field,
+ TrackerProperty *field,
const gchar *value);
/* Contents */
diff --git a/src/libtracker-data/tracker-turtle.c b/src/libtracker-data/tracker-turtle.c
index 3f3228f..fa16a0e 100644
--- a/src/libtracker-data/tracker-turtle.c
+++ b/src/libtracker-data/tracker-turtle.c
@@ -161,7 +161,7 @@ consume_triple_optimizer (void *user_data,
}
static void
-foreach_in_metadata (TrackerField *field,
+foreach_in_metadata (TrackerProperty *field,
gpointer value,
gpointer user_data)
{
@@ -185,7 +185,7 @@ foreach_in_metadata (TrackerField *field,
statement->subject = (void *) raptor_new_uri (about_uri);
statement->subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
- statement->predicate = (void *) raptor_new_uri ((unsigned char *) tracker_field_get_name (field));
+ statement->predicate = (void *) raptor_new_uri ((unsigned char *) tracker_property_get_name (field));
statement->predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
statement->object = (unsigned char *) g_strdup (value);
@@ -234,7 +234,7 @@ tracker_turtle_open (const gchar *turtle_file)
void
tracker_turtle_add_triple (TurtleFile *turtle,
const gchar *uri,
- TrackerField *property,
+ TrackerProperty *property,
const gchar *value)
{
#ifdef HAVE_RAPTOR
diff --git a/src/libtracker-data/tracker-turtle.h b/src/libtracker-data/tracker-turtle.h
index 53c9dbb..e51430a 100644
--- a/src/libtracker-data/tracker-turtle.h
+++ b/src/libtracker-data/tracker-turtle.h
@@ -71,7 +71,7 @@ void tracker_turtle_shutdown (void);
TurtleFile *tracker_turtle_open (const gchar *turtle_file);
void tracker_turtle_add_triple (TurtleFile *turtle,
const gchar *uri,
- TrackerField *property,
+ TrackerProperty *property,
const gchar *value);
void tracker_turtle_close (TurtleFile *turtle);
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index af3091e..c1745f7 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -28,7 +28,7 @@
#include <glib/gstdio.h>
-#include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-property.h>
#include <libtracker-common/tracker-file-utils.h>
#include <libtracker-common/tracker-nfs-lock.h>
#include <libtracker-common/tracker-ontology.h>
@@ -274,7 +274,7 @@ load_metadata_file (TrackerDBInterface *iface,
GError *error = NULL;
gchar *service_file, *str_id;
gchar **groups, **keys;
- TrackerField *def;
+ TrackerProperty *def;
gint id, i, j;
g_message ("Loading metadata file '%s'", filename);
@@ -305,7 +305,7 @@ load_metadata_file (TrackerDBInterface *iface,
NULL);
id = tracker_db_interface_sqlite_get_last_insert_id (TRACKER_DB_INTERFACE_SQLITE (iface));
} else {
- id = atoi (tracker_field_get_id (def));
+ id = atoi (tracker_property_get_id (def));
g_error ("Duplicated metadata description %s", groups[i]);
}
@@ -334,7 +334,7 @@ load_metadata_file (TrackerDBInterface *iface,
} else if (strcasecmp (keys[j], "DataType") == 0) {
GEnumValue *enum_value;
- enum_value = g_enum_get_value_by_nick (g_type_class_peek (TRACKER_TYPE_FIELD_TYPE), new_value);
+ enum_value = g_enum_get_value_by_nick (g_type_class_peek (TRACKER_TYPE_PROPERTY_TYPE), new_value);
if (enum_value) {
tracker_db_interface_execute_query (iface, NULL,
@@ -728,16 +728,16 @@ load_prepared_queries (void)
return TRUE;
}
-static TrackerField *
+static TrackerProperty *
db_row_to_field_def (TrackerDBResultSet *result_set)
{
- TrackerField *field_def;
- TrackerFieldType field_type;
+ TrackerProperty *field_def;
+ TrackerPropertyType field_type;
gchar *id_str, *field_name, *name;
gint weight, id;
gboolean embedded, multiple_values, delimited, filtered, store_metadata;
- field_def = tracker_field_new ();
+ field_def = tracker_property_new ();
tracker_db_result_set_get (result_set,
0, &id,
@@ -754,16 +754,16 @@ db_row_to_field_def (TrackerDBResultSet *result_set)
id_str = tracker_gint_to_string (id);
- tracker_field_set_id (field_def, id_str);
- tracker_field_set_name (field_def, name);
- tracker_field_set_data_type (field_def, field_type);
- tracker_field_set_field_name (field_def, field_name);
- tracker_field_set_weight (field_def, weight);
- tracker_field_set_embedded (field_def, embedded);
- tracker_field_set_multiple_values (field_def, multiple_values);
- tracker_field_set_delimited (field_def, delimited);
- tracker_field_set_filtered (field_def, filtered);
- tracker_field_set_store_metadata (field_def, store_metadata);
+ tracker_property_set_id (field_def, id_str);
+ tracker_property_set_name (field_def, name);
+ tracker_property_set_data_type (field_def, field_type);
+ tracker_property_set_field_name (field_def, field_name);
+ tracker_property_set_weight (field_def, weight);
+ tracker_property_set_embedded (field_def, embedded);
+ tracker_property_set_multiple_values (field_def, multiple_values);
+ tracker_property_set_delimited (field_def, delimited);
+ tracker_property_set_filtered (field_def, filtered);
+ tracker_property_set_store_metadata (field_def, store_metadata);
g_free (id_str);
g_free (field_name);
@@ -1391,7 +1391,7 @@ db_get_static_data (TrackerDBInterface *iface)
while (valid) {
TrackerDBResultSet *result_set2;
- TrackerField *def;
+ TrackerProperty *def;
GSList *child_ids = NULL;
def = db_row_to_field_def (result_set);
@@ -1399,7 +1399,7 @@ db_get_static_data (TrackerDBInterface *iface)
result_set2 = tracker_db_interface_execute_procedure (iface,
NULL,
"GetMetadataAliases",
- tracker_field_get_id (def),
+ tracker_property_get_id (def),
NULL);
if (result_set2) {
@@ -1413,7 +1413,7 @@ db_get_static_data (TrackerDBInterface *iface)
valid = tracker_db_result_set_iter_next (result_set2);
}
- tracker_field_set_child_ids (def, child_ids);
+ tracker_property_set_child_ids (def, child_ids);
g_object_unref (result_set2);
g_slist_foreach (child_ids, (GFunc) g_free, NULL);
diff --git a/src/tracker-fts/tracker-fts.c b/src/tracker-fts/tracker-fts.c
index 4bd2003..d7fe8b5 100644
--- a/src/tracker-fts/tracker-fts.c
+++ b/src/tracker-fts/tracker-fts.c
@@ -317,7 +317,7 @@ db_metadata_get (TrackerDBInterface *iface,
const gchar *id,
const gchar *key)
{
- TrackerField *def;
+ TrackerProperty *def;
const gchar *proc = NULL;
g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
@@ -331,29 +331,29 @@ db_metadata_get (TrackerDBInterface *iface,
return NULL;
}
- switch (tracker_field_get_data_type (def)) {
- case TRACKER_FIELD_TYPE_INDEX:
- case TRACKER_FIELD_TYPE_STRING:
- case TRACKER_FIELD_TYPE_DOUBLE:
+ switch (tracker_property_get_data_type (def)) {
+ case TRACKER_PROPERTY_TYPE_INDEX:
+ case TRACKER_PROPERTY_TYPE_STRING:
+ case TRACKER_PROPERTY_TYPE_DOUBLE:
proc = "GetMetadata";
break;
- case TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
+ case TRACKER_PROPERTY_TYPE_INTEGER:
+ case TRACKER_PROPERTY_TYPE_DATE:
proc = "GetMetadataNumeric";
break;
- case TRACKER_FIELD_TYPE_FULLTEXT:
+ case TRACKER_PROPERTY_TYPE_FULLTEXT:
proc = "GetContents";
break;
- case TRACKER_FIELD_TYPE_KEYWORD:
+ case TRACKER_PROPERTY_TYPE_KEYWORD:
proc = "GetMetadataKeyword";
break;
default:
g_warning ("Metadata could not be retrieved as type:%d is not supported",
- tracker_field_get_data_type (def));
+ tracker_property_get_data_type (def));
return NULL;
}
@@ -361,7 +361,7 @@ db_metadata_get (TrackerDBInterface *iface,
NULL,
proc,
id,
- tracker_field_get_id (def),
+ tracker_property_get_id (def),
NULL);
}
@@ -397,11 +397,11 @@ get_metadata_weight (int id)
{
if (id == 0) return 1;
- TrackerField *field = tracker_ontology_get_field_by_id (id);
+ TrackerProperty *field = tracker_ontology_get_field_by_id (id);
if (!field) return 1;
- return tracker_field_get_weight (field);
+ return tracker_property_get_weight (field);
}
diff --git a/src/tracker-indexer/tracker-indexer.c b/src/tracker-indexer/tracker-indexer.c
index 5c51368..bae5923 100644
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@ -1115,7 +1115,7 @@ add_directory (TrackerIndexer *indexer,
}
static void
-index_metadata_item (TrackerField *field,
+index_metadata_item (TrackerProperty *field,
const gchar *value,
MetadataForeachData *data)
{
@@ -1130,18 +1130,18 @@ index_metadata_item (TrackerField *field,
data->language,
tracker_config_get_max_word_length (data->config),
tracker_config_get_min_word_length (data->config),
- tracker_field_get_filtered (field),
- tracker_field_get_filtered (field),
- tracker_field_get_delimited (field));
+ tracker_property_get_filtered (field),
+ tracker_property_get_filtered (field),
+ tracker_property_get_delimited (field));
if (!parsed_value) {
return;
}
if (data->add) {
- score = tracker_field_get_weight (field);
+ score = tracker_property_get_weight (field);
} else {
- score = -1 * tracker_field_get_weight (field);
+ score = -1 * tracker_property_get_weight (field);
}
arr = g_strsplit (parsed_value, " ", -1);
@@ -1167,7 +1167,7 @@ index_metadata_item (TrackerField *field,
}
static void
-index_metadata_foreach (TrackerField *field,
+index_metadata_foreach (TrackerProperty *field,
gpointer value,
gpointer user_data)
{
@@ -1186,7 +1186,7 @@ index_metadata_foreach (TrackerField *field,
tracker_throttle (data->config, throttle * 100);
}
- if (!tracker_field_get_multiple_values (field)) {
+ if (!tracker_property_get_multiple_values (field)) {
index_metadata_item (field, value, data);
} else {
GList *list;
@@ -1504,20 +1504,20 @@ get_service_for_file (TrackerModuleFile *file,
}
static gboolean
-remove_existing_non_emb_metadata (TrackerField *field,
+remove_existing_non_emb_metadata (TrackerProperty *field,
gpointer value,
gpointer user_data)
{
TrackerDataMetadata *old_metadata = (TrackerDataMetadata *) user_data;
const gchar *name;
- if (tracker_field_get_embedded (field)) {
+ if (tracker_property_get_embedded (field)) {
return FALSE;
}
- name = tracker_field_get_name (field);
+ name = tracker_property_get_name (field);
- if (tracker_field_get_multiple_values (field)) {
+ if (tracker_property_get_multiple_values (field)) {
return (tracker_data_metadata_lookup_values (old_metadata, name) != NULL);
} else {
return (tracker_data_metadata_lookup (old_metadata, name) != NULL);
@@ -1724,13 +1724,13 @@ item_add_or_update (TrackerIndexer *indexer,
static gboolean
-filter_invalid_after_move_properties (TrackerField *field,
+filter_invalid_after_move_properties (TrackerProperty *field,
gpointer value,
gpointer user_data)
{
const gchar *name;
- name = tracker_field_get_name (field);
+ name = tracker_property_get_name (field);
if (g_strcmp0 (name, METADATA_FILE_NAME_DELIMITED) == 0 ||
g_strcmp0 (name, METADATA_FILE_NAME) == 0 ||
@@ -2198,7 +2198,7 @@ handle_metadata_add (TrackerIndexer *indexer,
GError **error)
{
TrackerClass *service;
- TrackerField *field;
+ TrackerProperty *field;
guint service_id, i, j;
gchar **set_values;
gchar *joined, *dirname = NULL, *basename = NULL;
@@ -2231,7 +2231,7 @@ handle_metadata_add (TrackerIndexer *indexer,
len = g_strv_length (values);
- if (!tracker_field_get_multiple_values (field) && len > 1) {
+ if (!tracker_property_get_multiple_values (field) && len > 1) {
g_set_error (error,
g_quark_from_string (TRACKER_INDEXER_ERROR),
TRACKER_INDEXER_ERROR_CODE,
@@ -2262,26 +2262,26 @@ handle_metadata_add (TrackerIndexer *indexer,
old_contents = tracker_data_query_metadata_field_values (service,
service_id,
field);
- if (!tracker_field_get_multiple_values (field) && old_contents) {
+ if (!tracker_property_get_multiple_values (field) && old_contents) {
/* Remove old value from DB and index */
len = g_strv_length (old_contents);
if (old_contents && len > 1) {
g_critical ("Seems to be multiple values in field:'%s' that doesn allow that",
- tracker_field_get_name (field));
+ tracker_property_get_name (field));
} else if (old_contents && len == 1) {
- if (tracker_field_get_filtered (field)) {
+ if (tracker_property_get_filtered (field)) {
unindex_text_with_parsing (indexer,
service_id,
tracker_class_get_id (service),
old_contents[0],
- tracker_field_get_weight (field));
+ tracker_property_get_weight (field));
} else {
unindex_text_no_parsing (indexer,
service_id,
tracker_class_get_id (service),
old_contents[0],
- tracker_field_get_weight (field));
+ tracker_property_get_weight (field));
}
tracker_data_update_delete_metadata (service, service_id, field, old_contents[0]);
}
@@ -2293,10 +2293,10 @@ handle_metadata_add (TrackerIndexer *indexer,
g_debug ("Setting metadata: service_type '%s' id '%d' field '%s' value '%s'",
tracker_class_get_name (service),
service_id,
- tracker_field_get_name (field),
+ tracker_property_get_name (field),
values[i]);
- if (tracker_field_get_multiple_values (field)
+ if (tracker_property_get_multiple_values (field)
&& (tracker_string_in_string_list (values[i], old_contents) > -1) ) {
continue;
}
@@ -2306,18 +2306,18 @@ handle_metadata_add (TrackerIndexer *indexer,
}
joined = g_strjoinv (" ", set_values);
- if (tracker_field_get_filtered (field)) {
+ if (tracker_property_get_filtered (field)) {
index_text_no_parsing (indexer,
service_id,
tracker_class_get_id (service),
joined,
- tracker_field_get_weight (field));
+ tracker_property_get_weight (field));
} else {
index_text_with_parsing (indexer,
service_id,
tracker_class_get_id (service),
joined,
- tracker_field_get_weight (field));
+ tracker_property_get_weight (field));
}
if (old_contents) {
diff --git a/src/tracker-indexer/tracker-module-metadata-private.h b/src/tracker-indexer/tracker-module-metadata-private.h
index 8b4f03b..a03358d 100644
--- a/src/tracker-indexer/tracker-module-metadata-private.h
+++ b/src/tracker-indexer/tracker-module-metadata-private.h
@@ -28,10 +28,10 @@
G_BEGIN_DECLS
-typedef void (* TrackerModuleMetadataForeach) (TrackerField *field,
+typedef void (* TrackerModuleMetadataForeach) (TrackerProperty *field,
gpointer value,
gpointer user_data);
-typedef gboolean (* TrackerModuleMetadataRemove) (TrackerField *field,
+typedef gboolean (* TrackerModuleMetadataRemove) (TrackerProperty *field,
gpointer value,
gpointer user_data);
diff --git a/src/tracker-indexer/tracker-module-metadata-utils.c b/src/tracker-indexer/tracker-module-metadata-utils.c
index 6c6830f..04f500e 100644
--- a/src/tracker-indexer/tracker-module-metadata-utils.c
+++ b/src/tracker-indexer/tracker-module-metadata-utils.c
@@ -303,7 +303,7 @@ extractor_context_kill (ExtractorContext *context)
static void
metadata_utils_add_embedded_data (TrackerModuleMetadata *metadata,
- TrackerField *field,
+ TrackerProperty *field,
const gchar *value)
{
gchar *utf_value;
@@ -317,9 +317,9 @@ metadata_utils_add_embedded_data (TrackerModuleMetadata *metadata,
if (utf_value) {
const gchar *name;
- name = tracker_field_get_name (field);
+ name = tracker_property_get_name (field);
- if (tracker_field_get_data_type (field) == TRACKER_FIELD_TYPE_DATE) {
+ if (tracker_property_get_data_type (field) == TRACKER_PROPERTY_TYPE_DATE) {
gchar *time_str;
/* Dates come in ISO 8601 format, we handle them as time_t */
@@ -340,7 +340,7 @@ metadata_utils_get_embedded_foreach (gpointer key,
gpointer user_data)
{
TrackerModuleMetadata *metadata;
- TrackerField *field;
+ TrackerProperty *field;
gchar *key_str;
gchar *value_str;
@@ -358,7 +358,7 @@ metadata_utils_get_embedded_foreach (gpointer key,
return;
}
- if (tracker_field_get_multiple_values (field)) {
+ if (tracker_property_get_multiple_values (field)) {
GStrv strv;
guint i;
diff --git a/src/tracker-indexer/tracker-module-metadata.c b/src/tracker-indexer/tracker-module-metadata.c
index bd1b6af..e3d6c75 100644
--- a/src/tracker-indexer/tracker-module-metadata.c
+++ b/src/tracker-indexer/tracker-module-metadata.c
@@ -56,10 +56,10 @@ tracker_module_metadata_init (TrackerModuleMetadata *metadata)
}
static void
-free_metadata (TrackerField *field,
+free_metadata (TrackerProperty *field,
gpointer data)
{
- if (tracker_field_get_multiple_values (field)) {
+ if (tracker_property_get_multiple_values (field)) {
GList *list;
list = (GList *) data;
@@ -75,9 +75,9 @@ remove_metadata_foreach (gpointer key,
gpointer value,
gpointer user_data)
{
- TrackerField *field;
+ TrackerProperty *field;
- field = (TrackerField *) key;
+ field = (TrackerProperty *) key;
free_metadata (field, value);
return TRUE;
@@ -104,12 +104,12 @@ tracker_module_metadata_lookup (TrackerModuleMetadata *metadata,
const gchar *field_name,
gboolean *multiple_values)
{
- TrackerField *field;
+ TrackerProperty *field;
field = tracker_ontology_get_field_by_name (field_name);
if (multiple_values) {
- *multiple_values = tracker_field_get_multiple_values (field);
+ *multiple_values = tracker_property_get_multiple_values (field);
}
return g_hash_table_lookup (metadata->table, field);
@@ -126,7 +126,7 @@ void
tracker_module_metadata_clear_field (TrackerModuleMetadata *metadata,
const gchar *field_name)
{
- TrackerField *field;
+ TrackerProperty *field;
gpointer data;
@@ -167,7 +167,7 @@ tracker_module_metadata_add_take_string (TrackerModuleMetadata *metadata,
const gchar *field_name,
gchar *value)
{
- TrackerField *field;
+ TrackerProperty *field;
gpointer data;
g_return_val_if_fail (metadata != NULL, FALSE);
@@ -184,7 +184,7 @@ tracker_module_metadata_add_take_string (TrackerModuleMetadata *metadata,
return FALSE;
}
- if (tracker_field_get_multiple_values (field)) {
+ if (tracker_property_get_multiple_values (field)) {
GList *list;
list = g_hash_table_lookup (metadata->table, field);
@@ -378,14 +378,14 @@ get_hash_table_foreach (gpointer key,
gpointer value,
gpointer user_data)
{
- TrackerField *field;
+ TrackerProperty *field;
GHashTable *table;
- field = TRACKER_FIELD (key);
+ field = TRACKER_PROPERTY (key);
table = user_data;
g_hash_table_insert (table,
- (gpointer) tracker_field_get_name (field),
+ (gpointer) tracker_property_get_name (field),
value);
}
diff --git a/src/tracker-indexer/tracker-removable-device.c b/src/tracker-indexer/tracker-removable-device.c
index 5720434..ad56d5c 100644
--- a/src/tracker-indexer/tracker-removable-device.c
+++ b/src/tracker-indexer/tracker-removable-device.c
@@ -383,17 +383,17 @@ set_metadata (const gchar *key,
/* TODO URI branch: path -> uri */
static void
-foreach_in_metadata_set_metadata (TrackerField *field,
+foreach_in_metadata_set_metadata (TrackerProperty *field,
gpointer value,
gpointer user_data)
{
- if (!tracker_field_get_multiple_values (field)) {
- set_metadata (tracker_field_get_name (field), value, user_data);
+ if (!tracker_property_get_multiple_values (field)) {
+ set_metadata (tracker_property_get_name (field), value, user_data);
} else {
GList *l;
for (l = value; l; l = l->next) {
- set_metadata (tracker_field_get_name (field), l->data, user_data);
+ set_metadata (tracker_property_get_name (field), l->data, user_data);
}
}
diff --git a/tests/libtracker-common/Makefile.am b/tests/libtracker-common/Makefile.am
index a637dfc..0c9830f 100644
--- a/tests/libtracker-common/Makefile.am
+++ b/tests/libtracker-common/Makefile.am
@@ -91,10 +91,10 @@ tracker_file_utils_LDADD = \
# $(PANGO_LIBS) \
# $(GLIB2_LIBS)
#
-# tracker_field_SOURCES = \
+# tracker_property_SOURCES = \
# tracker-field-test.c
#
-# tracker_field_LDADD = \
+# tracker_property_LDADD = \
# $(top_builddir)/src/libtracker-common/libtracker-common.la \
# $(top_builddir)/tests/common/libtracker-testcommon.la \
# $(GMODULE_LIBS) \
diff --git a/tests/libtracker-common/tracker-field-test.c b/tests/libtracker-common/tracker-field-test.c
index 6127d0c..a533e37 100644
--- a/tests/libtracker-common/tracker-field-test.c
+++ b/tests/libtracker-common/tracker-field-test.c
@@ -1,51 +1,51 @@
#include <glib.h>
-#include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-property.h>
#include <tracker-test-helpers.h>
static void
test_type_to_string ()
{
const gchar *result;
- TrackerFieldType type;
+ TrackerPropertyType type;
- type = TRACKER_FIELD_TYPE_KEYWORD;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_KEYWORD;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "keyword"));
- type = TRACKER_FIELD_TYPE_INDEX;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_INDEX;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "index"));
- type = TRACKER_FIELD_TYPE_FULLTEXT;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_FULLTEXT;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "fulltext"));
- type = TRACKER_FIELD_TYPE_STRING;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_STRING;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "string"));
- type = TRACKER_FIELD_TYPE_INTEGER;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_INTEGER;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "integer"));
- type = TRACKER_FIELD_TYPE_DOUBLE;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_DOUBLE;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "double"));
- type = TRACKER_FIELD_TYPE_DATE;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_DATE;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "date"));
- type = TRACKER_FIELD_TYPE_BLOB;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_BLOB;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "blob"));
- type = TRACKER_FIELD_TYPE_STRUCT;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_STRUCT;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "struct"));
- type = TRACKER_FIELD_TYPE_LINK;
- result = tracker_field_type_to_string (type);
+ type = TRACKER_PROPERTY_TYPE_LINK;
+ result = tracker_property_type_to_string (type);
g_assert (tracker_test_helpers_cmpstr_equal (result, "link"));
}
@@ -59,7 +59,7 @@ main (int argc, char **argv) {
g_test_init (&argc, &argv, NULL);
/* Something is not initialized without these lines */
- TrackerField *field = tracker_field_new ();
+ TrackerProperty *field = tracker_property_new ();
g_object_unref (field);
/* Init */
diff --git a/tests/libtracker-common/tracker-ontology-test.c b/tests/libtracker-common/tracker-ontology-test.c
index 92006d5..dea1c15 100644
--- a/tests/libtracker-common/tracker-ontology-test.c
+++ b/tests/libtracker-common/tracker-ontology-test.c
@@ -25,7 +25,7 @@
#include <glib.h>
#include <libtracker-common/tracker-class.h>
-#include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-property.h>
#include <libtracker-common/tracker-ontology.h>
#include <tracker-test-helpers.h>
@@ -82,24 +82,24 @@ array_to_list (char **array)
return list;
}
-static TrackerField *
+static TrackerProperty *
create_field_definition (const gchar *id,
const gchar *name,
- TrackerFieldType data_type,
+ TrackerPropertyType data_type,
const gchar *field_name,
gboolean multiple_values,
GSList *child_ids)
{
- TrackerField *field;
+ TrackerProperty *field;
- field = tracker_field_new ();
+ field = tracker_property_new ();
- tracker_field_set_id (field, id);
- tracker_field_set_name (field, name);
- tracker_field_set_data_type (field, data_type);
- tracker_field_set_field_name (field, field_name);
- tracker_field_set_multiple_values (field, multiple_values);
- tracker_field_set_child_ids (field, child_ids);
+ tracker_property_set_id (field, id);
+ tracker_property_set_name (field, name);
+ tracker_property_set_data_type (field, data_type);
+ tracker_property_set_field_name (field, field_name);
+ tracker_property_set_multiple_values (field, multiple_values);
+ tracker_property_set_child_ids (field, child_ids);
return field;
}
@@ -141,7 +141,7 @@ tracker_services_general_setup (void)
{
TrackerClass *service, *parent_service, *other_service;
TrackerClass *conv_service, *gaim_service, *gossip_service, *new_gaim_service;
- TrackerField *field_title;
+ TrackerProperty *field_title;
GSList *mimes, *mime_prefixes;
gchar *m[] = {"application/rtf", "text/joke", "test/1", NULL};
gchar *mp[] = {"images/", "video/", "other.mimes.", NULL};
@@ -156,7 +156,7 @@ tracker_services_general_setup (void)
field_title = create_field_definition ("0",
"App.Title",
- TRACKER_FIELD_TYPE_INDEX,
+ TRACKER_PROPERTY_TYPE_INDEX,
"Title",
TRUE,
NULL);
@@ -322,7 +322,7 @@ test_has_metadata (void)
static void
test_field_in_ontology (void)
{
- TrackerField *field;
+ TrackerProperty *field;
field = tracker_ontology_get_field_by_name ("App.Title");
g_assert (field);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]