[tracker] libtracker-miner: Switch Association property to boolean



commit 0def02c56a3c480bd8a5ab51ea30f014a9106bb0
Author: Adrien Bustany <abustany gnome org>
Date:   Thu Mar 18 16:02:03 2010 -0300

    libtracker-miner: Switch Association property to boolean
    
    The former Association property of TrackerMinerWeb is now called Associated,
    and is of type boolean.

 data/dbus/tracker-miner-web.xml             |    2 +-
 src/libtracker-miner/tracker-miner-0.7.vapi |    5 --
 src/libtracker-miner/tracker-miner-web.c    |   54 ++++++--------------------
 src/libtracker-miner/tracker-miner-web.h    |   22 -----------
 4 files changed, 14 insertions(+), 69 deletions(-)
---
diff --git a/data/dbus/tracker-miner-web.xml b/data/dbus/tracker-miner-web.xml
index 0ab0870..83bd1d4 100644
--- a/data/dbus/tracker-miner-web.xml
+++ b/data/dbus/tracker-miner-web.xml
@@ -99,7 +99,7 @@
         </doc:description>
       </doc:doc>
     </method>
-    <property name="Association" type="u" access="read">
+    <property name="Associated" type="b" access="read">
       <doc:doc>
         <doc:description>
           <doc:para>
diff --git a/src/libtracker-miner/tracker-miner-0.7.vapi b/src/libtracker-miner/tracker-miner-0.7.vapi
index ece6936..a3f765c 100644
--- a/src/libtracker-miner/tracker-miner-0.7.vapi
+++ b/src/libtracker-miner/tracker-miner-0.7.vapi
@@ -91,11 +91,6 @@ namespace Tracker {
 		public string get_password (string service, out string username) throws GLib.Error;
 		public void store_password (string service, string description, string username, string password) throws GLib.Error;
 	}
-	[CCode (cprefix = "TRACKER_MINER_WEB_", has_type_id = false, cheader_filename = "libtracker-miner/tracker-miner-web.h")]
-	public enum MinerWebAssociationType {
-		UNASSOCIATED,
-		ASSOCIATED
-	}
 	[CCode (cprefix = "TRACKER_MINER_WEB_ERROR_", cheader_filename = "libtracker-miner/tracker-miner-web.h")]
 	public errordomain MinerWebError {
 		WRONG_CREDENTIALS,
diff --git a/src/libtracker-miner/tracker-miner-web.c b/src/libtracker-miner/tracker-miner-web.c
index 71982cc..ca75a46 100644
--- a/src/libtracker-miner/tracker-miner-web.c
+++ b/src/libtracker-miner/tracker-miner-web.c
@@ -38,12 +38,12 @@
 #define TRACKER_MINER_WEB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_MINER_WEB, TrackerMinerWebPrivate))
 
 struct TrackerMinerWebPrivate {
-	TrackerMinerWebAssociationType association;
+	gboolean associated;
 };
 
 enum {
 	PROP_0,
-	PROP_ASSOCIATION
+	PROP_ASSOCIATED
 };
 
 static void miner_web_set_property (GObject      *object,
@@ -68,13 +68,12 @@ tracker_miner_web_class_init (TrackerMinerWebClass *klass)
 	object_class->constructed  = miner_web_constructed;
 
 	g_object_class_install_property (object_class,
-	                                 PROP_ASSOCIATION,
-	                                 g_param_spec_enum ("association",
-	                                                    "Association",
-	                                                    "Tells if the miner is associated with the remote service",
-	                                                    tracker_miner_web_association_get_type (),
-	                                                    TRACKER_MINER_WEB_UNASSOCIATED,
-	                                                    G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+	                                 PROP_ASSOCIATED,
+	                                 g_param_spec_boolean ("associated",
+	                                                       "Associated",
+	                                                       "Tells if the miner is associated with the remote service",
+	                                                       FALSE,
+	                                                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
 	g_type_class_add_private (object_class, sizeof (TrackerMinerWebPrivate));
 }
@@ -95,9 +94,9 @@ miner_web_set_property (GObject      *object,
 	priv = TRACKER_MINER_WEB_GET_PRIVATE (object);
 
 	switch (param_id) {
-	case PROP_ASSOCIATION:
-		priv->association = g_value_get_enum (value);
-		g_object_notify (object, "association");
+	case PROP_ASSOCIATED:
+		priv->associated = g_value_get_boolean (value);
+		g_object_notify (object, "associated");
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -116,8 +115,8 @@ miner_web_get_property (GObject    *object,
 	priv = TRACKER_MINER_WEB_GET_PRIVATE (object);
 
 	switch (param_id) {
-	case PROP_ASSOCIATION:
-		g_value_set_enum (value, priv->association);
+	case PROP_ASSOCIATED:
+		g_value_set_boolean (value, priv->associated);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -135,33 +134,6 @@ miner_web_constructed (GObject *object)
 }
 
 /**
- * tracker_miner_web_association_get_type:
- *
- * Returns: a #GType enumeration for all association types.
- **/
-GType
-tracker_miner_web_association_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			{ TRACKER_MINER_WEB_UNASSOCIATED,
-			  "TRACKER_MINER_WEB_UNASSOCIATED",
-			  "unassociated" },
-			{ TRACKER_MINER_WEB_ASSOCIATED,
-			  "TRACKER_MINER_WEB_ASSOCIATED",
-			  "associated" },
-			{ 0, NULL, NULL }
-		};
-
-		etype = g_enum_register_static ("TrackerMinerWebAssociation", values);
-	}
-
-	return etype;
-}
-
-/**
  * tracker_miner_web_error_quark:
  *
  * Returns: the #GQuark used to identify miner web errors in GError
diff --git a/src/libtracker-miner/tracker-miner-web.h b/src/libtracker-miner/tracker-miner-web.h
index 8668b86..caa72d2 100644
--- a/src/libtracker-miner/tracker-miner-web.h
+++ b/src/libtracker-miner/tracker-miner-web.h
@@ -29,8 +29,6 @@
 #define TRACKER_IS_MINER_WEB_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c),    TRACKER_TYPE_MINER_WEB))
 #define TRACKER_MINER_WEB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o),  TRACKER_TYPE_MINER_WEB, TrackerMinerWebClass))
 
-#define TRACKER_MINER_WEB_ASSOCIATION_TYPE_DB (tracker_miner_web_association_get_type ())
-
 G_BEGIN_DECLS
 
 typedef struct TrackerMinerWeb TrackerMinerWeb;
@@ -71,25 +69,6 @@ typedef enum {
 #define TRACKER_MINER_WEB_ERROR        tracker_miner_web_error_quark ()
 #define TRACKER_MINER_WEB_ERROR_DOMAIN "TrackerMinerWeb"
 
-/**
- * TrackerMinerWebAssociationType:
- * @TRACKER_MINER_WEB_UNASSOCIATED: The miner is currently
- * not associated with the remote service. This means it needs to
- * authenticate to be able to use any data from a remote service.
- * @TRACKER_MINER_WEB_ASSOCIATED: The miner is currently associated
- * with the remote service. This means that the miner can obtain
- * remote data from the service.
- *
- * Describes if the current state of the miner's ability to retrieve
- * data from the remote service.
- *
- * Since: 0.8
- **/
-typedef enum {
-	TRACKER_MINER_WEB_UNASSOCIATED,
-	TRACKER_MINER_WEB_ASSOCIATED
-} TrackerMinerWebAssociationType;
-
 struct TrackerMinerWeb {
 	TrackerMiner            parent_instance;
 };
@@ -185,7 +164,6 @@ typedef struct {
 } TrackerMinerWebClass;
 
 GType       tracker_miner_web_get_type             (void) G_GNUC_CONST;
-GType       tracker_miner_web_association_get_type (void) G_GNUC_CONST;
 GQuark      tracker_miner_web_error_quark          (void);
 void        tracker_miner_web_authenticate         (TrackerMinerWeb  *miner,
                                                     GError          **error);



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