[tracker/binary-log-2: 2/23] libtracker-common: Added tracker_{class, property}_{get, set}_id



commit a2b482b05a9e00f31c3e103c5f60093dc277850d
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Dec 31 11:45:21 2009 +0100

    libtracker-common: Added tracker_{class,property}_{get,set}_id

 src/libtracker-common/tracker-class.c    |   48 +++++++++++++++++++++++++++++-
 src/libtracker-common/tracker-class.h    |    4 ++
 src/libtracker-common/tracker-property.c |   45 +++++++++++++++++++++++++++-
 src/libtracker-common/tracker-property.h |    3 ++
 4 files changed, 98 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-common/tracker-class.c b/src/libtracker-common/tracker-class.c
index 4c8dd2b..1f81dfe 100644
--- a/src/libtracker-common/tracker-class.c
+++ b/src/libtracker-common/tracker-class.c
@@ -37,6 +37,7 @@ struct _TrackerClassPriv {
 	gchar *uri;
 	gchar *name;
 	gint count;
+	gint id;
 
 	GArray *super_classes;
 };
@@ -55,7 +56,8 @@ enum {
 	PROP_0,
 	PROP_URI,
 	PROP_NAME,
-	PROP_COUNT
+	PROP_COUNT,
+	PROP_ID
 };
 
 G_DEFINE_TYPE (TrackerClass, tracker_class, G_TYPE_OBJECT);
@@ -89,6 +91,15 @@ tracker_class_class_init (TrackerClassClass *klass)
 	                                                   "count",
 	                                                   "Count",
 	                                                   0,
+	                                                   G_MAXINT,
+	                                                   0,
+	                                                   G_PARAM_READWRITE));
+	g_object_class_install_property (object_class,
+	                                 PROP_ID,
+	                                 g_param_spec_int ("id",
+	                                                   "id",
+	                                                   "Id",
+	                                                   0,
 	                                                   INT_MAX,
 	                                                   0,
 	                                                   G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -103,6 +114,7 @@ tracker_class_init (TrackerClass *service)
 
 	priv = GET_PRIV (service);
 
+	priv->id = -1;
 	priv->super_classes = g_array_new (TRUE, TRUE, sizeof (TrackerClass *));
 }
 
@@ -141,6 +153,9 @@ class_get_property (GObject    *object,
 	case PROP_COUNT:
 		g_value_set_int (value, priv->count);
 		break;
+	case PROP_ID:
+		g_value_set_int (value, priv->id);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 		break;
@@ -162,6 +177,10 @@ class_set_property (GObject      *object,
 		tracker_class_set_count (TRACKER_CLASS (object),
 		                         g_value_get_int (value));
 		break;
+	case PROP_ID:
+		tracker_class_set_id (TRACKER_CLASS (object),
+		                      g_value_get_int (value));
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 		break;
@@ -214,6 +233,18 @@ tracker_class_get_count (TrackerClass *service)
 	return priv->count;
 }
 
+gint
+tracker_class_get_id (TrackerClass *service)
+{
+	TrackerClassPriv *priv;
+
+	g_return_val_if_fail (TRACKER_IS_CLASS (service), 0);
+
+	priv = GET_PRIV (service);
+
+	return priv->id;
+}
+
 TrackerClass **
 tracker_class_get_super_classes (TrackerClass *service)
 {
@@ -282,6 +313,21 @@ tracker_class_set_count (TrackerClass *service,
 	priv->count = value;
 }
 
+
+void
+tracker_class_set_id (TrackerClass *service,
+                      gint          value)
+{
+	TrackerClassPriv *priv;
+
+	g_return_if_fail (TRACKER_IS_CLASS (service));
+
+	priv = GET_PRIV (service);
+
+	priv->id = value;
+}
+
+
 void
 tracker_class_set_super_classes (TrackerClass  *service,
                                  TrackerClass **value)
diff --git a/src/libtracker-common/tracker-class.h b/src/libtracker-common/tracker-class.h
index 44c2015..ceca625 100644
--- a/src/libtracker-common/tracker-class.h
+++ b/src/libtracker-common/tracker-class.h
@@ -52,6 +52,8 @@ TrackerClass *  tracker_class_new               (void);
 const gchar *   tracker_class_get_uri           (TrackerClass  *service);
 const gchar *   tracker_class_get_name          (TrackerClass  *service);
 gint            tracker_class_get_count         (TrackerClass  *service);
+gint            tracker_class_get_id            (TrackerClass  *service);
+
 TrackerClass  **tracker_class_get_super_classes (TrackerClass  *service);
 void            tracker_class_set_uri           (TrackerClass  *service,
                                                  const gchar   *value);
@@ -61,6 +63,8 @@ void            tracker_class_set_super_classes (TrackerClass  *self,
                                                  TrackerClass **super_classes);
 void            tracker_class_add_super_class   (TrackerClass  *self,
                                                  TrackerClass  *value);
+void            tracker_class_set_id            (TrackerClass  *service,
+                                                 gint           id);
 
 G_END_DECLS
 
diff --git a/src/libtracker-common/tracker-property.c b/src/libtracker-common/tracker-property.c
index a53fa27..5f1ca2b 100644
--- a/src/libtracker-common/tracker-property.c
+++ b/src/libtracker-common/tracker-property.c
@@ -47,6 +47,7 @@ struct _TrackerPropertyPriv {
 	TrackerClass   *domain;
 	TrackerClass   *range;
 	gint           weight;
+	gint           id;
 	gboolean       indexed;
 	gboolean       fulltext_indexed;
 	gboolean       embedded;
@@ -82,7 +83,8 @@ enum {
 	PROP_MULTIPLE_VALUES,
 	PROP_FILTERED,
 	PROP_TRANSIENT,
-	PROP_IS_INVERSE_FUNCTIONAL_PROPERTY
+	PROP_IS_INVERSE_FUNCTIONAL_PROPERTY,
+	PROP_ID
 };
 
 GType
@@ -200,6 +202,15 @@ tracker_property_class_init (TrackerPropertyClass *klass)
 	                                                   1,
 	                                                   G_PARAM_READWRITE));
 	g_object_class_install_property (object_class,
+	                                 PROP_ID,
+	                                 g_param_spec_int ("id",
+	                                                   "id",
+	                                                   "Id",
+	                                                   0,
+	                                                   G_MAXINT,
+	                                                   1,
+	                                                   G_PARAM_READWRITE));
+	g_object_class_install_property (object_class,
 	                                 PROP_INDEXED,
 	                                 g_param_spec_boolean ("indexed",
 	                                                       "indexed",
@@ -260,6 +271,7 @@ tracker_property_init (TrackerProperty *field)
 
 	priv = GET_PRIV (field);
 
+	priv->id = -1;
 	priv->weight = 1;
 	priv->embedded = TRUE;
 	priv->filtered = TRUE;
@@ -320,6 +332,9 @@ property_get_property (GObject    *object,
 	case PROP_WEIGHT:
 		g_value_set_int (value, priv->weight);
 		break;
+	case PROP_ID:
+		g_value_set_int (value, priv->id);
+		break;
 	case PROP_INDEXED:
 		g_value_set_boolean (value, priv->indexed);
 		break;
@@ -374,6 +389,10 @@ property_set_property (GObject      *object,
 		tracker_property_set_weight (TRACKER_PROPERTY (object),
 		                             g_value_get_int (value));
 		break;
+	case PROP_ID:
+		tracker_property_set_id (TRACKER_PROPERTY (object),
+		                         g_value_get_int (value));
+		break;
 	case PROP_INDEXED:
 		tracker_property_set_indexed (TRACKER_PROPERTY (object),
 		                              g_value_get_boolean (value));
@@ -534,6 +553,17 @@ tracker_property_get_weight (TrackerProperty *field)
 	return priv->weight;
 }
 
+gint
+tracker_property_get_id (TrackerProperty *field)
+{
+	TrackerPropertyPriv *priv;
+
+	g_return_val_if_fail (TRACKER_IS_PROPERTY (field), -1);
+
+	priv = GET_PRIV (field);
+
+	return priv->id;
+}
 
 gboolean
 tracker_property_get_indexed (TrackerProperty *field)
@@ -772,6 +802,19 @@ tracker_property_set_weight (TrackerProperty *field,
 	g_object_notify (G_OBJECT (field), "weight");
 }
 
+
+void
+tracker_property_set_id (TrackerProperty *field,
+                         gint             value)
+{
+	TrackerPropertyPriv *priv;
+	g_return_if_fail (TRACKER_IS_PROPERTY (field));
+
+	priv = GET_PRIV (field);
+
+	priv->id = value;
+}
+
 void
 tracker_property_set_indexed (TrackerProperty *field,
                               gboolean         value)
diff --git a/src/libtracker-common/tracker-property.h b/src/libtracker-common/tracker-property.h
index 6512c42..1ec000d 100644
--- a/src/libtracker-common/tracker-property.h
+++ b/src/libtracker-common/tracker-property.h
@@ -79,6 +79,7 @@ TrackerPropertyType tracker_property_get_data_type        (TrackerProperty
 TrackerClass *      tracker_property_get_domain           (TrackerProperty      *property);
 TrackerClass *      tracker_property_get_range            (TrackerProperty      *property);
 gint                tracker_property_get_weight           (TrackerProperty      *property);
+gint                tracker_property_get_id               (TrackerProperty      *property);
 gboolean            tracker_property_get_indexed          (TrackerProperty      *property);
 gboolean            tracker_property_get_fulltext_indexed (TrackerProperty      *property);
 gboolean            tracker_property_get_embedded         (TrackerProperty      *property);
@@ -98,6 +99,8 @@ void                tracker_property_set_range            (TrackerProperty
                                                            TrackerClass         *range);
 void                tracker_property_set_weight           (TrackerProperty      *property,
                                                            gint                  value);
+void                tracker_property_set_id               (TrackerProperty      *property,
+                                                           gint                  value);
 void                tracker_property_set_indexed          (TrackerProperty      *property,
                                                            gboolean              value);
 void                tracker_property_set_fulltext_indexed (TrackerProperty      *property,



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