[glib/wip/gproperty-2: 174/178] gparam: Add setters for static nick and blurb



commit b2128068eecdba9a359d2d498f2249d5c728f5a9
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Apr 24 17:38:00 2013 -0400

    gparam: Add setters for static nick and blurb
    
    We are going to need them for GProperty.

 gobject/gparam.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 gobject/gparam.h |    6 ++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/gobject/gparam.c b/gobject/gparam.c
index 434dd59..7021e90 100644
--- a/gobject/gparam.c
+++ b/gobject/gparam.c
@@ -284,6 +284,56 @@ g_param_spec_ref_sink (GParamSpec *pspec)
 }
 
 /**
+ * g_param_spec_set_static_nick:
+ * @pspec: a valid #GParamSpec
+ * @nick: a static string with a human readable name for the @pspec
+ *
+ * Sets the "nick" of a #GParamSpec, unless one has been already specified.
+ *
+ * The passed string must be static.
+ *
+ * Since: 2.38
+ */
+void
+g_param_spec_set_static_nick (GParamSpec *pspec,
+                              const char *nick)
+{
+  g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+  g_return_if_fail (nick != NULL);
+
+  if (pspec->_nick != NULL)
+    return;
+
+  pspec->_nick = (gchar *) nick;
+  pspec->flags |= G_PARAM_STATIC_NICK;
+}
+
+/**
+ * g_param_spec_set_static_blurb:
+ * @pspec: a valid #GParamSpec
+ * @blurb: a static string with a human readable description for the @pspec
+ *
+ * Sets the "blurb" of a #GParamSpec, unless one has been already specified.
+ *
+ * The passed string must be static.
+ *
+ * Since: 2.38
+ */
+void
+g_param_spec_set_static_blurb (GParamSpec *pspec,
+                               const char *blurb)
+{
+  g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+  g_return_if_fail (blurb != NULL);
+
+  if (pspec->_blurb != NULL)
+    return;
+
+  pspec->_blurb = (gchar *) blurb;
+  pspec->flags |= G_PARAM_STATIC_BLURB;
+}
+
+/**
  * g_param_spec_get_name:
  * @pspec: a valid #GParamSpec
  *
diff --git a/gobject/gparam.h b/gobject/gparam.h
index b35ad51..67e16bb 100644
--- a/gobject/gparam.h
+++ b/gobject/gparam.h
@@ -321,6 +321,12 @@ GLIB_AVAILABLE_IN_ALL
 const gchar *   g_param_spec_get_nick           (GParamSpec    *pspec);
 GLIB_AVAILABLE_IN_ALL
 const gchar *   g_param_spec_get_blurb          (GParamSpec    *pspec);
+GLIB_AVAILABLE_IN_2_38
+void            g_param_spec_set_static_nick    (GParamSpec    *pspec,
+                                                 const char    *nick);
+GLIB_AVAILABLE_IN_2_38
+void            g_param_spec_set_static_blurb   (GParamSpec    *pspec,
+                                                 const char    *blurb);
 GLIB_AVAILABLE_IN_ALL
 void            g_value_set_param               (GValue               *value,
                                                 GParamSpec    *param);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]