forked from AuroraMiddleware/gtk
xxx: Add a hack to make paintables transform to/from objects
See also: https://gitlab.gnome.org/GNOME/glib/merge_requests/1251
This commit is contained in:
parent
650688c635
commit
c337887e29
@ -136,6 +136,16 @@ static double gdk_paintable_default_get_intrinsic_aspect_ratio (GdkPaintable *pa
|
||||
return (double) width / height;
|
||||
};
|
||||
|
||||
static void
|
||||
g_value_object_transform_value (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
if (src_value->data[0].v_pointer && g_type_is_a (G_OBJECT_TYPE (src_value->data[0].v_pointer), G_VALUE_TYPE (dest_value)))
|
||||
dest_value->data[0].v_pointer = g_object_ref (src_value->data[0].v_pointer);
|
||||
else
|
||||
dest_value->data[0].v_pointer = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_paintable_default_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
@ -146,6 +156,9 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
|
||||
iface->get_intrinsic_height = gdk_paintable_default_get_intrinsic_height;
|
||||
iface->get_intrinsic_aspect_ratio = gdk_paintable_default_get_intrinsic_aspect_ratio;
|
||||
|
||||
g_value_register_transform_func (G_TYPE_OBJECT, GDK_TYPE_PAINTABLE, g_value_object_transform_value);
|
||||
g_value_register_transform_func (GDK_TYPE_PAINTABLE, G_TYPE_OBJECT, g_value_object_transform_value);
|
||||
|
||||
/**
|
||||
* GdkPaintable::invalidate-contents
|
||||
* @paintable: a #GdkPaintable
|
||||
|
Loading…
Reference in New Issue
Block a user