[glib/g-property] gproperty: Wrap nick and blurb setters into one function
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/g-property] gproperty: Wrap nick and blurb setters into one function
- Date: Mon, 6 Jun 2011 15:23:43 +0000 (UTC)
commit 82a881a748eb46e05a04681337c4b8378c8db8b9
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Mon Jun 6 16:22:36 2011 +0100
gproperty: Wrap nick and blurb setters into one function
Let's call it g_property_describe().
gobject/gobject.symbols | 5 +--
gobject/gproperty.c | 57 ++++++++++-------------------------------------
gobject/gproperty.h | 15 +++++------
3 files changed, 21 insertions(+), 56 deletions(-)
---
diff --git a/gobject/gobject.symbols b/gobject/gobject.symbols
index e8c54d7..1a7aad5 100644
--- a/gobject/gobject.symbols
+++ b/gobject/gobject.symbols
@@ -187,8 +187,8 @@ g_param_spec_steal_qdata
g_param_spec_set_qdata
g_param_spec_set_qdata_full
g_param_spec_get_qdata
-g_param_spec_set_static_nick
g_param_spec_set_static_blurb
+g_param_spec_set_static_nick
g_param_value_convert
g_param_value_defaults
g_param_values_cmp
@@ -221,6 +221,7 @@ g_object_property_new
g_pointer_property_new
g_property_canonicalize_name
g_property_collect
+g_property_describe
g_property_get
g_property_get_default
g_property_get_default_value
@@ -244,8 +245,6 @@ g_property_set_lock_functions
g_property_set_prerequisite
g_property_set_range
g_property_set_range_values
-g_property_set_static_blurb
-g_property_set_static_nick
g_property_set_valist
g_property_set_value
g_property_unlock
diff --git a/gobject/gproperty.c b/gobject/gproperty.c
index 2a34b7b..310849d 100644
--- a/gobject/gproperty.c
+++ b/gobject/gproperty.c
@@ -3199,71 +3199,38 @@ g_property_canonicalize_name (const gchar *name)
}
/**
- * g_property_set_static_nick:
+ * g_property_describe:
* @property: a #GProperty
* @nick: a static string with the user-readable name
* of the property
- *
- * Sets the user-readable, and optionally translatable, name
- * of the property.
- *
- * This function cannot be called more than once.
- *
- * Since: 2.32
- */
-void
-g_property_set_static_nick (GProperty *property,
- const gchar *nick)
-{
- GParamSpec *pspec;
-
- g_return_if_fail (G_IS_PROPERTY (property));
- g_return_if_fail (nick != NULL);
-
- pspec = G_PARAM_SPEC (property);
-
- if (pspec->_nick != NULL)
- {
- g_critical (G_STRLOC ": Redefining the nick of a property is not allowed");
- return;
- }
-
- pspec->_nick = (gchar *) nick;
- pspec->flags |= G_PARAM_STATIC_NICK;
-}
-
-/**
- * g_property_set_static_blurb:
- * @property: a #GProperty
* @blurb: a static string with the user-readable description
* of the property
*
- * Sets the user-readable, and optionally translatable, description
- * of the property.
+ * Sets the user-readable, and optionally translatable, name and
+ * description of the property.
*
* This function cannot be called more than once.
*
+ * This function is a convenience wrapper around g_param_spec_set_static_nick()
+ * and g_param_spec_set_static_blurb().
+ *
* Since: 2.32
*/
void
-g_property_set_static_blurb (GProperty *property,
- const gchar *blurb)
+g_property_describe (GProperty *property,
+ const char *nick,
+ const char *blurb)
{
GParamSpec *pspec;
g_return_if_fail (G_IS_PROPERTY (property));
+ g_return_if_fail (nick != NULL);
g_return_if_fail (blurb != NULL);
pspec = G_PARAM_SPEC (property);
- if (pspec->_blurb != NULL)
- {
- g_critical (G_STRLOC ": Redefining the blurb of a property is not allowed");
- return;
- }
-
- pspec->_blurb = (gchar *) blurb;
- pspec->flags |= G_PARAM_STATIC_BLURB;
+ g_param_spec_set_static_nick (pspec, nick);
+ g_param_spec_set_static_blurb (pspec, blurb);
}
/**
diff --git a/gobject/gproperty.h b/gobject/gproperty.h
index 9b4e4ed..668f773 100644
--- a/gobject/gproperty.h
+++ b/gobject/gproperty.h
@@ -76,12 +76,7 @@ typedef enum {
GType g_property_get_type (void) G_GNUC_CONST;
/* general purpose API */
-gchar * g_property_canonicalize_name (const gchar *name);
-
-void g_property_set_static_nick (GProperty *property,
- const gchar *nick);
-void g_property_set_static_blurb (GProperty *property,
- const gchar *blurb);
+gchar * g_property_canonicalize_name (const char *name);
GType g_property_get_value_type (GProperty *property);
@@ -90,6 +85,10 @@ gboolean g_property_is_readable (GProperty *property)
gboolean g_property_is_deprecated (GProperty *property);
gboolean g_property_is_atomic (GProperty *property);
+void g_property_describe (GProperty *property,
+ const char *nick,
+ const char *blurb);
+
void g_property_set_range_values (GProperty *property,
const GValue *min_value,
const GValue *max_value);
@@ -250,8 +249,8 @@ typedef void (* GPropertyDoubleSet) (gpointer gobject,
typedef gdouble (* GPropertyDoubleGet) (gpointer gobject);
typedef void (* GPropertyStringSet) (gpointer gobject,
- const gchar *value);
-typedef const gchar * (* GPropertyStringGet) (gpointer gobject);
+ const char *value);
+typedef const char * (* GPropertyStringGet) (gpointer gobject);
typedef void (* GPropertyBoxedSet) (gpointer gobject,
gpointer value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]