mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 04:22:29 +00:00
remove member "null_ok" and use GParamSpecString's "ensure_non_null"
2007-10-31 Michael Natterer <mitch@gimp.org> * app/core/gimpparamspecs.[ch] (GimpParamSpecString): remove member "null_ok" and use GParamSpecString's "ensure_non_null" instead. svn path=/trunk/; revision=24022
This commit is contained in:
parent
7d43b91250
commit
d15f7ffe9c
|
@ -1,3 +1,9 @@
|
||||||
|
2007-10-31 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpparamspecs.[ch] (GimpParamSpecString): remove
|
||||||
|
member "null_ok" and use GParamSpecString's "ensure_non_null"
|
||||||
|
instead.
|
||||||
|
|
||||||
2007-10-31 Tor Lillqvist <tml@novell.com>
|
2007-10-31 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* README.win32: Remove. This kind of information belongs in the
|
* README.win32: Remove. This kind of information belongs in the
|
||||||
|
|
|
@ -312,6 +312,8 @@ static void gimp_param_string_init (GParamSpec *pspec);
|
||||||
static gboolean gimp_param_string_validate (GParamSpec *pspec,
|
static gboolean gimp_param_string_validate (GParamSpec *pspec,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
|
static GParamSpecClass * gimp_param_string_parent_class = NULL;
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gimp_param_string_get_type (void)
|
gimp_param_string_get_type (void)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +342,8 @@ gimp_param_string_get_type (void)
|
||||||
static void
|
static void
|
||||||
gimp_param_string_class_init (GParamSpecClass *klass)
|
gimp_param_string_class_init (GParamSpecClass *klass)
|
||||||
{
|
{
|
||||||
|
gimp_param_string_parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
klass->value_type = G_TYPE_STRING;
|
klass->value_type = G_TYPE_STRING;
|
||||||
klass->value_validate = gimp_param_string_validate;
|
klass->value_validate = gimp_param_string_validate;
|
||||||
}
|
}
|
||||||
|
@ -349,8 +353,9 @@ gimp_param_string_init (GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GimpParamSpecString *sspec = GIMP_PARAM_SPEC_STRING (pspec);
|
GimpParamSpecString *sspec = GIMP_PARAM_SPEC_STRING (pspec);
|
||||||
|
|
||||||
|
G_PARAM_SPEC_STRING (pspec)->ensure_non_null = TRUE;
|
||||||
|
|
||||||
sspec->allow_non_utf8 = FALSE;
|
sspec->allow_non_utf8 = FALSE;
|
||||||
sspec->null_ok = FALSE;
|
|
||||||
sspec->non_empty = FALSE;
|
sspec->non_empty = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,9 +366,8 @@ gimp_param_string_validate (GParamSpec *pspec,
|
||||||
GimpParamSpecString *sspec = GIMP_PARAM_SPEC_STRING (pspec);
|
GimpParamSpecString *sspec = GIMP_PARAM_SPEC_STRING (pspec);
|
||||||
gchar *string = value->data[0].v_pointer;
|
gchar *string = value->data[0].v_pointer;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
if (gimp_param_string_parent_class->value_validate (pspec, value))
|
||||||
#warning FIXME: use GParamSpecString::ensure_non_null and chain up once we depend on glib 2.12.12 or newer
|
return TRUE;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (string)
|
if (string)
|
||||||
{
|
{
|
||||||
|
@ -397,12 +401,6 @@ gimp_param_string_validate (GParamSpec *pspec,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (! sspec->null_ok)
|
|
||||||
{
|
|
||||||
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
|
|
||||||
value->data[0].v_pointer = g_strdup ("");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (sspec->non_empty)
|
else if (sspec->non_empty)
|
||||||
{
|
{
|
||||||
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
|
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
|
||||||
|
@ -435,8 +433,9 @@ gimp_param_spec_string (const gchar *name,
|
||||||
g_free (G_PARAM_SPEC_STRING (sspec)->default_value);
|
g_free (G_PARAM_SPEC_STRING (sspec)->default_value);
|
||||||
G_PARAM_SPEC_STRING (sspec)->default_value = g_strdup (default_value);
|
G_PARAM_SPEC_STRING (sspec)->default_value = g_strdup (default_value);
|
||||||
|
|
||||||
|
G_PARAM_SPEC_STRING (sspec)->ensure_non_null = null_ok ? FALSE : TRUE;
|
||||||
|
|
||||||
sspec->allow_non_utf8 = allow_non_utf8 ? TRUE : FALSE;
|
sspec->allow_non_utf8 = allow_non_utf8 ? TRUE : FALSE;
|
||||||
sspec->null_ok = null_ok ? TRUE : FALSE;
|
|
||||||
sspec->non_empty = non_empty ? TRUE : FALSE;
|
sspec->non_empty = non_empty ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,6 @@ struct _GimpParamSpecString
|
||||||
GParamSpecString parent_instance;
|
GParamSpecString parent_instance;
|
||||||
|
|
||||||
guint allow_non_utf8 : 1;
|
guint allow_non_utf8 : 1;
|
||||||
guint null_ok : 1;
|
|
||||||
guint non_empty : 1;
|
guint non_empty : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue