[glibmm] Rename ambiguously named overridden property variable and type
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Rename ambiguously named overridden property variable and type
- Date: Mon, 7 Jul 2014 11:35:10 +0000 (UTC)
commit c8e324babd01ae81908aab478fd5fff244507a82
Author: Povilas Kanapickas <povilas radix lt>
Date: Mon Jul 7 13:26:44 2014 +0200
Rename ambiguously named overridden property variable and type
* glib/glibmm/class.[cc|h]:
* glib/glibmm/interface.cc:
* glib/glibmm/property.cc: Rename properties_quark and properties_type to
iface_properties_quark and iface_properties_type.
As custom_[set|get]_property_callback() in property.cc also sets and gets
user-defined properties, this naming choice may be confusing.
These names are intended for use by glibmm only. Renaming is not an
ABI/API break. Bug #731484.
glib/glibmm/class.cc | 17 +++++++++--------
glib/glibmm/class.h | 10 +++++-----
glib/glibmm/interface.cc | 8 ++++----
glib/glibmm/property.cc | 42 ++++++++++++++++++++++++------------------
4 files changed, 42 insertions(+), 35 deletions(-)
---
diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc
index f68138b..6107c5c 100644
--- a/glib/glibmm/class.cc
+++ b/glib/glibmm/class.cc
@@ -150,19 +150,20 @@ GType Class::clone_custom_type(const char* custom_type_name,
}
// Initialize the static quark to store/get custom type properties.
-GQuark Class::properties_quark = g_quark_from_string("gtkmm_CustomObject_properties");
+GQuark Class::iface_properties_quark = g_quark_from_string("gtkmm_CustomObject_iface_properties");
// static
void Class::custom_class_base_finalize_function(void* g_class)
{
const GType gtype = G_TYPE_FROM_CLASS(g_class);
- // Free the data related to the properties for the custom type, if any.
- properties_type* props = static_cast<properties_type*>(g_type_get_qdata(gtype, properties_quark));
+ // Free the data related to the interface properties for the custom type, if any.
+ iface_properties_type* props = static_cast<iface_properties_type*>(
+ g_type_get_qdata(gtype, iface_properties_quark));
if(props)
{
- for(properties_type::size_type i = 0; i < props->size(); i++)
+ for(iface_properties_type::size_type i = 0; i < props->size(); i++)
{
g_value_unset((*props)[i]);
g_free((*props)[i]);
@@ -190,12 +191,12 @@ void Class::custom_class_init_function(void* g_class, void* class_data)
// Override the properties of implemented interfaces, if any.
const GType object_type = G_TYPE_FROM_CLASS(g_class);
- Class::properties_type* props = static_cast<Class::properties_type*>(
- g_type_get_qdata(object_type, Class::properties_quark));
+ Class::iface_properties_type* props = static_cast<Class::iface_properties_type*>(
+ g_type_get_qdata(object_type, Class::iface_properties_quark));
if (!props)
{
- props = new Class::properties_type();
- g_type_set_qdata(object_type, Class::properties_quark, props);
+ props = new Class::iface_properties_type();
+ g_type_set_qdata(object_type, Class::iface_properties_quark, props);
}
guint n_interfaces = 0;
diff --git a/glib/glibmm/class.h b/glib/glibmm/class.h
index 438c3ca..89e9d34 100644
--- a/glib/glibmm/class.h
+++ b/glib/glibmm/class.h
@@ -25,7 +25,7 @@
#include <glib-object.h>
#include <glibmmconfig.h> //Include this here so that the /private/*.h classes have access to
GLIBMM_VFUNCS_ENABLED
-#include <vector> //For properties that custom types might override.
+#include <vector> //For interface properties that custom types might override.
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -101,10 +101,10 @@ private:
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // The type that holds the values of the properties of custom types.
- typedef std::vector<GValue*> properties_type;
- // The quark used for storing/getting the properties of custom types.
- static GQuark properties_quark;
+ // The type that holds the values of the interface properties of custom types.
+ typedef std::vector<GValue*> iface_properties_type;
+ // The quark used for storing/getting the interface properties of custom types.
+ static GQuark iface_properties_quark;
#endif
};
diff --git a/glib/glibmm/interface.cc b/glib/glibmm/interface.cc
index 19554ca..c849565 100644
--- a/glib/glibmm/interface.cc
+++ b/glib/glibmm/interface.cc
@@ -66,13 +66,13 @@ Interface::Interface(const Interface_Class& interface_class)
// Override the properties of the derived interface, if any.
const GType custom_type = G_OBJECT_CLASS_TYPE(instance_class);
- Class::properties_type* props = static_cast<Class::properties_type*>(
- g_type_get_qdata(custom_type, Class::properties_quark));
+ Class::iface_properties_type* props = static_cast<Class::iface_properties_type*>(
+ g_type_get_qdata(custom_type, Class::iface_properties_quark));
if(!props)
{
- props = new Class::properties_type();
- g_type_set_qdata(custom_type, Class::properties_quark, props);
+ props = new Class::iface_properties_type();
+ g_type_set_qdata(custom_type, Class::iface_properties_quark, props);
}
const guint n_existing_props = props->size();
diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc
index 0ae0345..98e6c89 100644
--- a/glib/glibmm/property.cc
+++ b/glib/glibmm/property.cc
@@ -112,21 +112,24 @@ void custom_get_property_callback(GObject* object, unsigned int property_id,
GType custom_type = G_OBJECT_TYPE(object);
- Class::properties_type* props = static_cast<Class::properties_type*>(g_type_get_qdata(custom_type,
Class::properties_quark));
- Class::properties_type::size_type props_size = 0;
+ Class::iface_properties_type* iface_props = static_cast<Class::iface_properties_type*>(
+ g_type_get_qdata(custom_type, Class::iface_properties_quark));
- if(props) props_size = props->size();
+ Class::iface_properties_type::size_type iface_props_size = 0;
- if(property_id <= props_size)
+ if (iface_props)
+ iface_props_size = iface_props->size();
+
+ if (property_id <= iface_props_size)
{
- g_value_copy((*props)[property_id - 1], value);
+ g_value_copy((*iface_props)[property_id - 1], value);
}
else
{
if(Glib::ObjectBase *const wrapper = Glib::ObjectBase::_get_current_wrapper(object))
{
PropertyBase& property =
- property_from_id(*wrapper, property_id - props_size);
+ property_from_id(*wrapper, property_id - iface_props_size);
if((property.object_ == wrapper) && (property.param_spec_ == param_spec))
g_value_copy(property.value_.gobj(), value);
@@ -144,14 +147,17 @@ void custom_set_property_callback(GObject* object, unsigned int property_id,
GType custom_type = G_OBJECT_TYPE(object);
- Class::properties_type* props = static_cast<Class::properties_type*>(g_type_get_qdata(custom_type,
Class::properties_quark));
- Class::properties_type::size_type props_size = 0;
+ Class::iface_properties_type* iface_props = static_cast<Class::iface_properties_type*>(
+ g_type_get_qdata(custom_type, Class::iface_properties_quark));
+
+ Class::iface_properties_type::size_type iface_props_size = 0;
- if(props) props_size = props->size();
+ if (iface_props)
+ iface_props_size = iface_props->size();
- if(property_id <= props_size)
+ if (property_id <= iface_props_size)
{
- g_value_copy(value, (*props)[property_id - 1]);
+ g_value_copy(value, (*iface_props)[property_id - 1]);
g_object_notify(object, g_param_spec_get_name(param_spec));
}
else
@@ -159,7 +165,7 @@ void custom_set_property_callback(GObject* object, unsigned int property_id,
if(Glib::ObjectBase *const wrapper = Glib::ObjectBase::_get_current_wrapper(object))
{
PropertyBase& property =
- property_from_id(*wrapper, property_id - props_size);
+ property_from_id(*wrapper, property_id - iface_props_size);
if((property.object_ == wrapper) && (property.param_spec_ == param_spec))
{
@@ -215,12 +221,14 @@ void PropertyBase::install_property(GParamSpec* param_spec)
// properties.
GType gtype = G_OBJECT_TYPE(object_->gobj());
- Class::properties_type* props = static_cast<Class::properties_type*>(g_type_get_qdata(gtype,
Class::properties_quark));
+ Class::iface_properties_type* iface_props = static_cast<Class::iface_properties_type*>(
+ g_type_get_qdata(gtype, Class::iface_properties_quark));
- Class::properties_type::size_type props_size = 0;
- if(props) props_size = props->size();
+ Class::iface_properties_type::size_type iface_props_size = 0;
+ if (iface_props)
+ iface_props_size = iface_props->size();
- const unsigned int property_id = property_to_id(*object_, *this) + props_size;
+ const unsigned int property_id = property_to_id(*object_, *this) + iface_props_size;
g_object_class_install_property(G_OBJECT_GET_CLASS(object_->gobj()), property_id, param_spec);
@@ -246,5 +254,3 @@ void PropertyBase::notify()
}
} // namespace Glib
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]