Commit 19716df2 authored by Thomas Haller's avatar Thomas Haller

shared: add nm_g_object_class_find_property_from_gtype() util

And relax the type for nm_auto_unref_gtypeclass macro. Like
g_type_class_unref() itself, you usually don't use it with a GTypeClass
base class, but some subtype like GObjectClass.
parent ac5350fe
......@@ -56,10 +56,10 @@ _nm_auto_unset_gvalue_impl (GValue *v)
#define nm_auto_unset_gvalue nm_auto(_nm_auto_unset_gvalue_impl)
static inline void
_nm_auto_unref_gtypeclass (GTypeClass **v)
_nm_auto_unref_gtypeclass (gpointer v)
{
if (v && *v)
g_type_class_unref (*v);
if (v && *((gpointer *) v))
g_type_class_unref (*((gpointer *) v));
}
#define nm_auto_unref_gtypeclass nm_auto(_nm_auto_unref_gtypeclass)
......
......@@ -528,6 +528,16 @@ nm_g_object_set_property (GObject *object,
return TRUE;
}
GParamSpec *
nm_g_object_class_find_property_from_gtype (GType gtype,
const char *property_name)
{
nm_auto_unref_gtypeclass GObjectClass *gclass = NULL;
gclass = g_type_class_ref (gtype);
return g_object_class_find_property (gclass, property_name);
}
/*****************************************************************************/
static void
......
......@@ -246,6 +246,9 @@ gboolean nm_g_object_set_property (GObject *object,
const GValue *value,
GError **error);
GParamSpec *nm_g_object_class_find_property_from_gtype (GType gtype,
const char *property_name);
/*****************************************************************************/
typedef enum {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment