seahorse r2769 - in trunk: . libseahorse



Author: nnielsen
Date: Sat Feb  7 03:44:45 2009
New Revision: 2769
URL: http://svn.gnome.org/viewvc/seahorse?rev=2769&view=rev

Log:
Fix problem constructing SeahorseUnknownSource due to read-only property.

Modified:
   trunk/ChangeLog
   trunk/libseahorse/seahorse-unknown-source.c

Modified: trunk/libseahorse/seahorse-unknown-source.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.c	(original)
+++ trunk/libseahorse/seahorse-unknown-source.c	Sat Feb  7 03:44:45 2009
@@ -33,7 +33,8 @@
 enum {
     PROP_0,
     PROP_SOURCE_TAG,
-    PROP_SOURCE_LOCATION
+    PROP_SOURCE_LOCATION,
+    PROP_CONSTRUCT_TAG,
 };
 
 static void seahorse_source_iface (SeahorseSourceIface *iface);
@@ -68,7 +69,7 @@
     SeahorseUnknownSource *usrc = SEAHORSE_UNKNOWN_SOURCE (object);
     
     switch (prop_id) {
-    case PROP_SOURCE_TAG:
+    case PROP_CONSTRUCT_TAG:
         usrc->ktype = g_value_get_uint (value);
         break;
     }
@@ -84,6 +85,9 @@
     case PROP_SOURCE_TAG:
         g_value_set_uint (value, usrc->ktype);
         break;
+    case PROP_CONSTRUCT_TAG:
+        g_value_set_uint (value, usrc->ktype);
+        break;
     case PROP_SOURCE_LOCATION:
         g_value_set_enum (value, SEAHORSE_LOCATION_MISSING);
         break;
@@ -108,6 +112,15 @@
     
 	g_object_class_override_property (gobject_class, PROP_SOURCE_TAG, "source-tag");
 	g_object_class_override_property (gobject_class, PROP_SOURCE_LOCATION, "source-location");
+	
+	/* 
+	 * This is a writable construct only property that lets us construct this  
+	 * class with different 'source-tag' property. The 'source-tag' property
+	 * is read-only, and so we can't use it directly.
+	 */
+	g_object_class_install_property (gobject_class, PROP_CONSTRUCT_TAG, 
+	         g_param_spec_uint ("construct-tag", "Construct Tag", "Set source-tag during construction of object",
+	                            0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
     
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_UNKNOWN_SOURCE, "source", NULL);
 }
@@ -125,7 +138,7 @@
 SeahorseUnknownSource*
 seahorse_unknown_source_new (GQuark ktype)
 {
-   return g_object_new (SEAHORSE_TYPE_UNKNOWN_SOURCE, "source-tag", ktype, NULL);
+   return g_object_new (SEAHORSE_TYPE_UNKNOWN_SOURCE, "construct-tag", ktype, NULL);
 }
 
 SeahorseObject*                     



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