[libpeas] Use GObject API instead of GI API to override properties
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Use GObject API instead of GI API to override properties
- Date: Mon, 7 Mar 2011 17:20:52 +0000 (UTC)
commit 8c819c777682e87381c193c0bbb3e8124d7181ad
Author: Garrett Regier <alias301 gmail com>
Date: Mon Mar 7 08:00:27 2011 -0800
Use GObject API instead of GI API to override properties
libpeas/peas-extension-subclasses.c | 38 ++++++++++++++--------------------
1 files changed, 16 insertions(+), 22 deletions(-)
---
diff --git a/libpeas/peas-extension-subclasses.c b/libpeas/peas-extension-subclasses.c
index 4467a04..99ff22e 100644
--- a/libpeas/peas-extension-subclasses.c
+++ b/libpeas/peas-extension-subclasses.c
@@ -272,38 +272,32 @@ static void
extension_subclass_init (GObjectClass *klass,
GType exten_type)
{
- GIInterfaceInfo *iface_info;
- gint n_props, i;
+ guint n_props, i;
+ gpointer iface_vtable;
+ GParamSpec **properties;
g_debug ("Initializing class '%s'", G_OBJECT_CLASS_NAME (klass));
- klass->set_property = extension_subclass_set_property;
- klass->get_property = extension_subclass_get_property;
-
- iface_info = g_irepository_find_by_gtype (NULL, exten_type);
- g_return_if_fail (iface_info != NULL);
- g_return_if_fail (g_base_info_get_type (iface_info) == GI_INFO_TYPE_INTERFACE);
-
- n_props = g_interface_info_get_n_properties (iface_info);
+ iface_vtable = g_type_default_interface_peek (exten_type);
+ properties = g_object_interface_list_properties (iface_vtable, &n_props);
- for (i = 0; i < n_props; ++i)
+ if (n_props > 0)
{
- GIPropertyInfo *prop_info;
+ klass->set_property = extension_subclass_set_property;
+ klass->get_property = extension_subclass_get_property;
- prop_info = g_interface_info_get_property (iface_info, i);
-
- g_object_class_override_property (klass, i + 1,
- g_base_info_get_name (prop_info));
+ for (i = 0; i < n_props; ++i)
+ {
+ const gchar *property_name = g_param_spec_get_name (properties[i]);
- g_debug ("Overrided '%s:%s' for '%s' proxy",
- g_type_name (exten_type), g_base_info_get_name (prop_info),
- G_OBJECT_CLASS_NAME (klass));
+ g_object_class_override_property (klass, i + 1, property_name);
- g_base_info_unref (prop_info);
+ g_debug ("Overrided '%s:%s' for '%s' proxy",
+ g_type_name (exten_type), property_name,
+ G_OBJECT_CLASS_NAME (klass));
+ }
}
- g_base_info_unref (iface_info);
-
g_debug ("Initialized class '%s'", G_OBJECT_CLASS_NAME (klass));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]