"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gladeui/glade-property-def.c" between
glade-3.38.0.tar.xz and glade-3.38.1.tar.xz

About: Glade is a User Interface Designer for the GTK+ toolkit and the Gnome desktop environment.

glade-property-def.c  (glade-3.38.0.tar.xz):glade-property-def.c  (glade-3.38.1.tar.xz)
skipping to change at line 503 skipping to change at line 503
} }
/** /**
* glade_property_def_make_string_from_gvalue: * glade_property_def_make_string_from_gvalue:
* @property_def: A #GladePropertyDef * @property_def: A #GladePropertyDef
* @value: A #GValue * @value: A #GValue
* *
* Returns: A newly allocated string representation of @value * Returns: A newly allocated string representation of @value
*/ */
gchar * gchar *
glade_property_def_make_string_from_gvalue (GladePropertyDef * glade_property_def_make_string_from_gvalue (GladePropertyDef *property_def,
property_def, const GValue *value)
const GValue * value)
{ {
gchar *string = NULL, **strv; gchar *string = NULL;
GObject *object;
GdkColor *color;
GdkRGBA *rgba;
GList *objects;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GLADE_PROPERTY_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec)) if (GLADE_PROPERTY_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec))
{ {
G_GNUC_END_IGNORE_DEPRECATIONS; G_GNUC_END_IGNORE_DEPRECATIONS;
GValueArray *value_array = g_value_get_boxed (value); GValueArray *value_array = g_value_get_boxed (value);
if (value_array && value_array->n_values && if (value_array && value_array->n_values &&
G_VALUE_HOLDS (&value_array->values[0], G_TYPE_STRING)) G_VALUE_HOLDS (&value_array->values[0], G_TYPE_STRING))
{ {
skipping to change at line 551 skipping to change at line 546
else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec))
{ {
guint flags = g_value_get_flags (value); guint flags = g_value_get_flags (value);
string = glade_property_def_make_string_from_flags string = glade_property_def_make_string_from_flags
(property_def, flags, FALSE); (property_def, flags, FALSE);
} }
else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec)) else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec))
{ {
if (property_def->pspec->value_type == GDK_TYPE_COLOR) if (property_def->pspec->value_type == GDK_TYPE_COLOR)
{ {
color = g_value_get_boxed (value); GdkColor *color = g_value_get_boxed (value);
if (color) if (color)
string = g_strdup_printf ("#%04x%04x%04x", string = g_strdup_printf ("#%04x%04x%04x",
color->red, color->green, color->blue); color->red, color->green, color->blue);
} }
else if (property_def->pspec->value_type == GDK_TYPE_RGBA) else if (property_def->pspec->value_type == GDK_TYPE_RGBA)
{ {
rgba = g_value_get_boxed (value); GdkRGBA *rgba = g_value_get_boxed (value);
if (rgba) if (rgba)
string = gdk_rgba_to_string (rgba); string = gdk_rgba_to_string (rgba);
} }
else if (property_def->pspec->value_type == PANGO_TYPE_COLOR)
{
PangoColor *color = g_value_get_boxed (value);
if (color)
string = pango_color_to_string (color);
}
else if (property_def->pspec->value_type == G_TYPE_STRV) else if (property_def->pspec->value_type == G_TYPE_STRV)
{ {
strv = g_value_get_boxed (value); gchar **strv = g_value_get_boxed (value);
if (strv) if (strv)
string = g_strjoinv ("\n", strv); string = g_strjoinv ("\n", strv);
} }
} }
else if (G_IS_PARAM_SPEC_INT (property_def->pspec)) else if (G_IS_PARAM_SPEC_INT (property_def->pspec))
string = g_strdup_printf ("%d", g_value_get_int (value)); string = g_strdup_printf ("%d", g_value_get_int (value));
else if (G_IS_PARAM_SPEC_UINT (property_def->pspec)) else if (G_IS_PARAM_SPEC_UINT (property_def->pspec))
string = g_strdup_printf ("%u", g_value_get_uint (value)); string = g_strdup_printf ("%u", g_value_get_uint (value));
else if (G_IS_PARAM_SPEC_LONG (property_def->pspec)) else if (G_IS_PARAM_SPEC_LONG (property_def->pspec))
string = g_strdup_printf ("%ld", g_value_get_long (value)); string = g_strdup_printf ("%ld", g_value_get_long (value));
skipping to change at line 614 skipping to change at line 615
GLADE_TAG_TRUE : GLADE_TAG_FALSE); GLADE_TAG_TRUE : GLADE_TAG_FALSE);
else if (G_IS_PARAM_SPEC_VARIANT (property_def->pspec)) else if (G_IS_PARAM_SPEC_VARIANT (property_def->pspec))
{ {
GVariant *variant; GVariant *variant;
if ((variant = g_value_get_variant (value))) if ((variant = g_value_get_variant (value)))
string = g_variant_print (variant, TRUE); string = g_variant_print (variant, TRUE);
} }
else if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec)) else if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec))
{ {
object = g_value_get_object (value); GObject *object = g_value_get_object (value);
string = string =
glade_property_def_make_string_from_object (property_def, object); glade_property_def_make_string_from_object (property_def, object);
} }
else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_def->pspec)) else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_def->pspec))
{ {
objects = g_value_get_boxed (value); GList *objects = g_value_get_boxed (value);
string = string =
glade_property_def_make_string_from_objects (property_def, glade_property_def_make_string_from_objects (property_def,
objects); objects);
} }
else else
g_critical ("Unsupported pspec type %s (value -> string)", g_critical ("Unsupported pspec type %s (value -> string)",
g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec))); g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec)));
return string; return string;
} }
skipping to change at line 840 skipping to change at line 841
* glade_property_def_make_gvalue_from_string: * glade_property_def_make_gvalue_from_string:
* @property_def: A #GladePropertyDef * @property_def: A #GladePropertyDef
* @string: a string representation of this property * @string: a string representation of this property
* @project: the #GladeProject that the property should be resolved for * @project: the #GladeProject that the property should be resolved for
* *
* Returns: A #GValue created based on the @property_def * Returns: A #GValue created based on the @property_def
* and @string criteria. * and @string criteria.
*/ */
GValue * GValue *
glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def, glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def,
const gchar *string, const gchar *string,
GladeProject *project) GladeProject *project)
{ {
GValue *value = g_new0 (GValue, 1); GValue *value = g_new0 (GValue, 1);
gchar **strv; gchar **strv;
GdkColor color = { 0, };
GdkRGBA rgba = { 0, };
g_value_init (value, property_def->pspec->value_type); g_value_init (value, property_def->pspec->value_type);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GLADE_PROPERTY_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec)) if (GLADE_PROPERTY_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec))
{ {
G_GNUC_END_IGNORE_DEPRECATIONS; G_GNUC_END_IGNORE_DEPRECATIONS;
GValueArray *value_array; GValueArray *value_array;
GValue str_value = { 0, }; GValue str_value = { 0, };
gint i; gint i;
skipping to change at line 893 skipping to change at line 892
else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec))
{ {
guint flags = glade_property_def_make_flags_from_string guint flags = glade_property_def_make_flags_from_string
(property_def->pspec->value_type, string); (property_def->pspec->value_type, string);
g_value_set_flags (value, flags); g_value_set_flags (value, flags);
} }
else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec)) else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec))
{ {
if (property_def->pspec->value_type == GDK_TYPE_COLOR) if (property_def->pspec->value_type == GDK_TYPE_COLOR)
{ {
GdkColor color;
if (gdk_color_parse (string, &color)) if (gdk_color_parse (string, &color))
g_value_set_boxed (value, &color); g_value_set_boxed (value, &color);
else else
g_warning ("could not parse colour name `%s'", string); g_warning ("could not parse colour name `%s'", string);
} }
else if (property_def->pspec->value_type == GDK_TYPE_RGBA) else if (property_def->pspec->value_type == GDK_TYPE_RGBA)
{ {
GdkRGBA rgba;
if (gdk_rgba_parse (&rgba, string)) if (gdk_rgba_parse (&rgba, string))
g_value_set_boxed (value, &rgba); g_value_set_boxed (value, &rgba);
else else
g_warning ("could not parse rgba colour name `%s'", string); g_warning ("could not parse rgba colour name `%s'", string);
} }
else if (property_def->pspec->value_type == PANGO_TYPE_COLOR)
{
PangoColor color;
if (pango_color_parse (&color, string))
g_value_set_boxed (value, &color);
else
g_warning ("could not parse pango color name `%s'", string);
}
else if (property_def->pspec->value_type == G_TYPE_STRV) else if (property_def->pspec->value_type == G_TYPE_STRV)
{ {
strv = g_strsplit (string, "\n", 0); strv = g_strsplit (string, "\n", 0);
g_value_take_boxed (value, strv); g_value_take_boxed (value, strv);
} }
} }
else if (G_IS_PARAM_SPEC_VARIANT (property_def->pspec)) else if (G_IS_PARAM_SPEC_VARIANT (property_def->pspec))
g_value_take_variant (value, g_variant_parse (NULL, string, NULL, NULL, NULL )); g_value_take_variant (value, g_variant_parse (NULL, string, NULL, NULL, NULL ));
else if (G_IS_PARAM_SPEC_INT (property_def->pspec)) else if (G_IS_PARAM_SPEC_INT (property_def->pspec))
g_value_set_int (value, g_ascii_strtoll (string, NULL, 10)); g_value_set_int (value, g_ascii_strtoll (string, NULL, 10));
 End of changes. 13 change blocks. 
17 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)