summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2010-10-08 16:09:10 +0100
committerMatthias Clasen <mclasen@redhat.com>2010-11-12 09:01:48 -0500
commit6766c727bb2f0f99a8e5a62a8d71d0b243479b56 (patch)
treeef0fb58968a483f9fa3bdb2b1c172f1aa73f7231
parent6791551c896d3cd10a3b2746383cf0627b6250e2 (diff)
gobject: Improve install_properties()
Cache the parent type outside of the loop, and fix a typo in the documentation. (cherry picked from commit 44a8ff2f8f607f725c478793b876742b09f350ef)
-rw-r--r--gobject/gobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 8fe12d0fb..22095c28c 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -469,7 +469,7 @@ g_object_class_install_property (GObjectClass *class,
* be used to store a #GParamSpec.
*
* This function should be used if you plan to use a static array of
- * #GParamSpec<!-- -->s and g_object_notify_pspec(). For instance, this
+ * #GParamSpec<!-- -->s and g_object_notify_by_pspec(). For instance, this
* class initialization:
*
* |[
@@ -524,7 +524,7 @@ g_object_class_install_properties (GObjectClass *oclass,
guint n_pspecs,
GParamSpec **pspecs)
{
- GType oclass_type;
+ GType oclass_type, parent_type;
gint i;
g_return_if_fail (G_IS_OBJECT_CLASS (oclass));
@@ -536,6 +536,7 @@ g_object_class_install_properties (GObjectClass *oclass,
G_OBJECT_CLASS_NAME (oclass));
oclass_type = G_OBJECT_CLASS_TYPE (oclass);
+ parent_type = g_type_parent (oclass_type);
/* we skip the first element of the array as it would have a 0 prop_id */
for (i = 1; i < n_pspecs; i++)
@@ -563,7 +564,7 @@ g_object_class_install_properties (GObjectClass *oclass,
/* for property overrides of construct properties, we have to get rid
* of the overidden inherited construct property
*/
- pspec = g_param_spec_pool_lookup (pspec_pool, pspec->name, g_type_parent (G_OBJECT_CLASS_TYPE (oclass)), TRUE);
+ pspec = g_param_spec_pool_lookup (pspec_pool, pspec->name, parent_type, TRUE);
if (pspec && pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))
oclass->construct_properties = g_slist_remove (oclass->construct_properties, pspec);
}