mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 03:02:10 +01:00
gparam: Introduce nick and blurb setters
Instead of having them on GProperty, let's add the static nick and blurb setters where they belong, i.e. GParamSpec.
This commit is contained in:
parent
4a20aa31b1
commit
51db2249d1
@ -222,6 +222,8 @@ g_param_spec_steal_qdata
|
|||||||
g_param_spec_set_qdata
|
g_param_spec_set_qdata
|
||||||
g_param_spec_set_qdata_full
|
g_param_spec_set_qdata_full
|
||||||
g_param_spec_get_qdata
|
g_param_spec_get_qdata
|
||||||
|
g_param_spec_set_static_nick
|
||||||
|
g_param_spec_set_static_blurb
|
||||||
g_param_value_convert
|
g_param_value_convert
|
||||||
g_param_value_defaults
|
g_param_value_defaults
|
||||||
g_param_values_cmp
|
g_param_values_cmp
|
||||||
|
@ -336,6 +336,70 @@ g_param_spec_get_blurb (GParamSpec *pspec)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_param_spec_set_static_nick:
|
||||||
|
* @pspec: a #GParamSpec
|
||||||
|
* @nick: the user-readable, and possibly translatable, name of the
|
||||||
|
* #GParamSpec
|
||||||
|
*
|
||||||
|
* Sets a static string as the name of the #GParamSpec, for introspection
|
||||||
|
* purposes. The @nick string should be static and exist for the duration
|
||||||
|
* of the process.
|
||||||
|
*
|
||||||
|
* This function can only be called once, or if no nick was passed to
|
||||||
|
* g_param_spec_internal().
|
||||||
|
*
|
||||||
|
* Since: 2.30
|
||||||
|
*/
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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_param_spec_set_static_blurb:
|
||||||
|
* @pspec: a #GParamSpec
|
||||||
|
* @blurb: the user-readable, and possibly translatable, description of the
|
||||||
|
* #GParamSpec
|
||||||
|
*
|
||||||
|
* Sets a static string as the description of the #GParamSpec, for
|
||||||
|
* introspection purposes. The @blurb string should be static and exist for
|
||||||
|
* the duration of the process.
|
||||||
|
*
|
||||||
|
* This function can only be called once, or if no blurb was passed to
|
||||||
|
* g_param_spec_internal().
|
||||||
|
*
|
||||||
|
* Since: 2.30
|
||||||
|
*/
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
g_critical (G_STRLOC ": Redefining the blurb of a property is not allowed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pspec->_blurb = (gchar *) blurb;
|
||||||
|
pspec->flags |= G_PARAM_STATIC_BLURB;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
canonicalize_key (gchar *key)
|
canonicalize_key (gchar *key)
|
||||||
{
|
{
|
||||||
|
@ -304,12 +304,17 @@ gint g_param_values_cmp (GParamSpec *pspec,
|
|||||||
const gchar * g_param_spec_get_name (GParamSpec *pspec);
|
const gchar * g_param_spec_get_name (GParamSpec *pspec);
|
||||||
const gchar * g_param_spec_get_nick (GParamSpec *pspec);
|
const gchar * g_param_spec_get_nick (GParamSpec *pspec);
|
||||||
const gchar * g_param_spec_get_blurb (GParamSpec *pspec);
|
const gchar * g_param_spec_get_blurb (GParamSpec *pspec);
|
||||||
|
|
||||||
|
void g_param_spec_set_static_nick (GParamSpec *pspec,
|
||||||
|
const char *nick);
|
||||||
|
void g_param_spec_set_static_blurb (GParamSpec *pspec,
|
||||||
|
const char *blurb);
|
||||||
|
|
||||||
void g_value_set_param (GValue *value,
|
void g_value_set_param (GValue *value,
|
||||||
GParamSpec *param);
|
GParamSpec *param);
|
||||||
GParamSpec* g_value_get_param (const GValue *value);
|
GParamSpec* g_value_get_param (const GValue *value);
|
||||||
GParamSpec* g_value_dup_param (const GValue *value);
|
GParamSpec* g_value_dup_param (const GValue *value);
|
||||||
|
|
||||||
|
|
||||||
void g_value_take_param (GValue *value,
|
void g_value_take_param (GValue *value,
|
||||||
GParamSpec *param);
|
GParamSpec *param);
|
||||||
GLIB_DEPRECATED_FOR(g_value_take_param)
|
GLIB_DEPRECATED_FOR(g_value_take_param)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user