mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-30 11:07:38 +00:00
Add basic parser for GtkBorder properties.
Different units aren't supported, it takes 1 to 4 integers representing pixel distances.
This commit is contained in:
parent
846f67d805
commit
585afafa39
@ -1403,6 +1403,43 @@ css_provider_parse_value (const gchar *value_str,
|
|||||||
else
|
else
|
||||||
parsed = FALSE;
|
parsed = FALSE;
|
||||||
}
|
}
|
||||||
|
else if (type == GTK_TYPE_BORDER)
|
||||||
|
{
|
||||||
|
guint first, second, third, fourth;
|
||||||
|
GtkBorder border;
|
||||||
|
|
||||||
|
/* FIXME: no unit support */
|
||||||
|
if (sscanf (value_str, "%d %d %d %d",
|
||||||
|
&first, &second, &third, &fourth) == 4)
|
||||||
|
{
|
||||||
|
border.top = first;
|
||||||
|
border.right = second;
|
||||||
|
border.bottom = third;
|
||||||
|
border.left = fourth;
|
||||||
|
}
|
||||||
|
else if (sscanf (value_str, "%d %d %d",
|
||||||
|
&first, &second, &third) == 3)
|
||||||
|
{
|
||||||
|
border.top = first;
|
||||||
|
border.left = border.right = second;
|
||||||
|
border.bottom = third;
|
||||||
|
}
|
||||||
|
else if (sscanf (value_str, "%d %d", &first, &second) == 2)
|
||||||
|
{
|
||||||
|
border.top = border.bottom = first;
|
||||||
|
border.left = border.right = second;
|
||||||
|
}
|
||||||
|
else if (sscanf (value_str, "%d", &first) == 1)
|
||||||
|
{
|
||||||
|
border.top = border.bottom = first;
|
||||||
|
border.left = border.right = first;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parsed = FALSE;
|
||||||
|
|
||||||
|
if (parsed)
|
||||||
|
g_value_set_boxed (value, &border);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("Cannot parse string '%s' for type %s", value_str, g_type_name (type));
|
g_warning ("Cannot parse string '%s' for type %s", value_str, g_type_name (type));
|
||||||
|
Loading…
Reference in New Issue
Block a user