mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
builder: Parse PangoAttrList values
Allow specifying PangoAttrList properties in the serialized format supported by pango_attr_list_to_string(). Test included.
This commit is contained in:
parent
dfbaeefc64
commit
9682085e09
@ -2325,6 +2325,23 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
{
|
||||
g_value_take_boxed (value, g_bytes_new (string, strlen (string)));
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, PANGO_TYPE_ATTR_LIST))
|
||||
{
|
||||
PangoAttrList *attrs;
|
||||
|
||||
attrs = pango_attr_list_from_string (string);
|
||||
if (attrs)
|
||||
g_value_take_boxed (value, attrs);
|
||||
else
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Could not parse PangoAttrList '%s'",
|
||||
string);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (error,
|
||||
|
1
testsuite/gtk/ui/label6.expected
Normal file
1
testsuite/gtk/ui/label6.expected
Normal file
@ -0,0 +1 @@
|
||||
SUCCESS
|
25
testsuite/gtk/ui/label6.ui
Normal file
25
testsuite/gtk/ui/label6.ui
Normal file
@ -0,0 +1,25 @@
|
||||
<!-- test all valid label attributes -->
|
||||
<interface>
|
||||
<object class="GtkLabel">
|
||||
<property name="attributes">
|
||||
5 10 language de
|
||||
0 -1 style italic
|
||||
0 -1 weight bold
|
||||
0 -1 variant normal
|
||||
0 -1 stretch ultra-expanded
|
||||
0 -1 underline double
|
||||
0 -1 strikethrough true
|
||||
0 -1 gravity north
|
||||
0 -1 gravity-hint line
|
||||
0 -1 family "sans"
|
||||
0 -1 size 10
|
||||
0 -1 absolute-size 10
|
||||
0 -1 font-desc "Cantarell 11"
|
||||
0 -1 foreground yellow
|
||||
0 -1 background red
|
||||
0 -1 underline-color green
|
||||
0 -1 strikethrough-color purple
|
||||
0 -1 scale 1.5
|
||||
</property>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue
Block a user