[gtk/wip/matthiasc/listview-2: 151/168] xxx: Add a hack to make paintables transform to/from objects
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/listview-2: 151/168] xxx: Add a hack to make paintables transform to/from objects
- Date: Fri, 29 May 2020 20:43:05 +0000 (UTC)
commit 0cca4a8e04c7536a51134ec339abb7048da0c8fc
Author: Benjamin Otte <otte redhat com>
Date: Tue Nov 26 06:09:20 2019 +0100
xxx: Add a hack to make paintables transform to/from objects
See also: https://gitlab.gnome.org/GNOME/glib/merge_requests/1251
gdk/gdkpaintable.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/gdk/gdkpaintable.c b/gdk/gdkpaintable.c
index fc91762784..56b13bcd95 100644
--- a/gdk/gdkpaintable.c
+++ b/gdk/gdkpaintable.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]