forked from AuroraMiddleware/gtk
builder: Mirror GdkPixbuf abilities for GdkTexture
In particular, allow specifying a filename for a GDK_TYPE_TEXTURE property. This makes it easy to transition properties from Pixbuf type to Texture type without having to touch resource files.
This commit is contained in:
parent
2d959553e9
commit
b12a53406d
@ -530,6 +530,7 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
|||||||
|
|
||||||
if (G_IS_PARAM_SPEC_OBJECT (prop->pspec) &&
|
if (G_IS_PARAM_SPEC_OBJECT (prop->pspec) &&
|
||||||
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PIXBUF) &&
|
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PIXBUF) &&
|
||||||
|
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_TEXTURE) &&
|
||||||
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != G_TYPE_FILE))
|
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != G_TYPE_FILE))
|
||||||
{
|
{
|
||||||
GObject *object = g_hash_table_lookup (builder->priv->objects,
|
GObject *object = g_hash_table_lookup (builder->priv->objects,
|
||||||
@ -2084,7 +2085,8 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
|||||||
break;
|
break;
|
||||||
case G_TYPE_OBJECT:
|
case G_TYPE_OBJECT:
|
||||||
case G_TYPE_INTERFACE:
|
case G_TYPE_INTERFACE:
|
||||||
if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF))
|
if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF) ||
|
||||||
|
G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||||
{
|
{
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
GError *tmp_error = NULL;
|
GError *tmp_error = NULL;
|
||||||
@ -2136,7 +2138,16 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
|||||||
|
|
||||||
if (pixbuf)
|
if (pixbuf)
|
||||||
{
|
{
|
||||||
g_value_set_object (value, pixbuf);
|
if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||||
|
{
|
||||||
|
GdkTexture *texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||||
|
g_value_set_object (value, texture);
|
||||||
|
g_object_unref (texture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_value_set_object (value, pixbuf);
|
||||||
|
}
|
||||||
g_object_unref (G_OBJECT (pixbuf));
|
g_object_unref (G_OBJECT (pixbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user