From 58069545626558e1d2e3f868b486e6dbf3b367d2 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 1 Dec 2008 23:33:47 +0100 Subject: [PATCH] Add katze_object_has_property --- katze/katze-utils.c | 35 +++++++++++++++++++++++++++++------ katze/katze-utils.h | 4 ++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/katze/katze-utils.c b/katze/katze-utils.c index 03788b8a..6753bbcf 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -528,10 +528,33 @@ katze_pixbuf_new_from_buffer (const guchar* buffer, return pixbuf; } +/** + * katze_object_has_property: + * @object: a #GObject + * @property: the name of the property + * + * Determine if @object has a property with the specified name. + * + * Return value: a boolean + * + * Since: 0.1.2 + **/ +gboolean +katze_object_has_property (gpointer object, + const gchar* property) +{ + GObjectClass* class; + + g_return_val_if_fail (G_IS_OBJECT (object), FALSE); + + class = G_OBJECT_GET_CLASS (object); + return g_object_class_find_property (class, property) != NULL; +} + /** * katze_object_get_boolean: * @object: a #GObject - * @property_name: the name of the property to get + * @property: the name of the property to get * * Retrieve the boolean value of the specified property. * @@ -553,7 +576,7 @@ katze_object_get_boolean (gpointer object, /** * katze_object_get_int: * @object: a #GObject - * @property_name: the name of the property to get + * @property: the name of the property to get * * Retrieve the integer value of the specified property. * @@ -575,7 +598,7 @@ katze_object_get_int (gpointer object, /** * katze_object_get_float: * @object: a #GObject - * @property_name: the name of the property to get + * @property: the name of the property to get * * Retrieve the float value of the specified property. * @@ -597,7 +620,7 @@ katze_object_get_float (gpointer object, /** * katze_object_get_enum: * @object: a #GObject - * @property_name: the name of the property to get + * @property: the name of the property to get * * Retrieve the enum value of the specified property. * @@ -619,7 +642,7 @@ katze_object_get_enum (gpointer object, /** * katze_object_get_string: * @object: a #GObject - * @property_name: the name of the property to get + * @property: the name of the property to get * * Retrieve the string value of the specified property. * @@ -641,7 +664,7 @@ katze_object_get_string (gpointer object, /** * katze_object_get_object: * @object: a #GObject - * @property_name: the name of the property to get + * @property: the name of the property to get * * Retrieve the object value of the specified property. * diff --git a/katze/katze-utils.h b/katze/katze-utils.h index 10a23016..d38f8c92 100644 --- a/katze/katze-utils.h +++ b/katze/katze-utils.h @@ -84,6 +84,10 @@ katze_pixbuf_new_from_buffer (const guchar* buffer, const gchar* mime_type, GError** error); +gboolean +katze_object_has_property (gpointer object, + const gchar* property); + gint katze_object_get_boolean (gpointer object, const gchar* property); -- 2.39.5