[glibmm] Extra Defs Tool: Only generate properties that the GType owns.



commit 91080938656bc7c3af0c47946ed99370a4ae3dca
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Fri May 6 11:32:26 2011 -0400

    Extra Defs Tool: Only generate properties that the GType owns.
    
    	* tools/extra_defs_gen/generate_extra_defs.cc: Modify the extra defs
    	generation tool to generate properties that the given GType owns.
    	g_object_interface_list_properties() includes all properties, even the
    	properties of possible base classes, but those properties should be
    	generated for the base classes and not for a derived GType.

 ChangeLog                                   |   10 ++++++++++
 tools/extra_defs_gen/generate_extra_defs.cc |    6 +++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ee7fbcf..ccefe3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-05-05  José Alburquerque  <jaalburqu svn gnome org>
+
+	Extra Defs Tool: Only generate properties that the GType owns.
+
+	* tools/extra_defs_gen/generate_extra_defs.cc: Modify the extra defs
+	generation tool to generate properties that the given GType owns.
+	g_object_interface_list_properties() includes all properties, even the
+	properties of possible base classes, but those properties should be
+	generated for the base classes and not for a derived GType.
+
 2011-05-03  Fan, Chun-wei  <fanc999 ahoo com tw>
 
 	Update the VS 2008 project files.
diff --git a/tools/extra_defs_gen/generate_extra_defs.cc b/tools/extra_defs_gen/generate_extra_defs.cc
index d00fbfb..b558ee1 100644
--- a/tools/extra_defs_gen/generate_extra_defs.cc
+++ b/tools/extra_defs_gen/generate_extra_defs.cc
@@ -64,7 +64,11 @@ std::string get_properties(GType gtype)
   for(guint i = 0; i < iCount; i++)
   {
     GParamSpec* pParamSpec = ppParamSpec[i];
-    if(pParamSpec)
+    // Generate the property if the specified gtype actually owns the property.
+    // (Generally all properties, including any base classes' properties are
+    // retrieved by g_object_interface_list_properties() for a given gtype.
+    // The base classes' properties should not be generated).
+    if(pParamSpec && pParamSpec->owner_type == gtype)
     {
       //Name and type:
       const std::string strName = g_param_spec_get_name(pParamSpec);



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