summaryrefslogtreecommitdiff
path: root/gdk/wayland/gdkprimary-wayland.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2018-02-01 17:43:15 +0100
committerBenjamin Otte <otte@redhat.com>2018-02-03 16:24:13 +0100
commit2cbe094b919442471b54685a0fef0d6f83ce44b3 (patch)
tree187a9b099feed2d2da8bcc14885ab1701fc92a95 /gdk/wayland/gdkprimary-wayland.c
parent4fa4b8525e62c711e6a7c10f25d5015428b2fa27 (diff)
downloadgtk+-2cbe094b919442471b54685a0fef0d6f83ce44b3.tar.gz
Allow binding GdkContentFormatsBuilder
GdkContentFormatsBuilder is currently not introspectable, as it does not have a GType. We can turn it into a boxed type, but we need to implement memory management for it. The current gdk_content_formats_builder_free() function returns a newly constructed value, so we cannot use it as a GBoxedFreeFunc; additionally copying a GdkContentFormatsBuilder contents would make it a bit odd, as you could get multiple identical GdkContentFormats out of the copies. A simple approach is to model the GdkContentFormatsBuilder API to follow the GBytes one: use reference counting for memory management, and have a function to release a reference, return a GdkContentFormats, and reset the GdkContentFormatsBuilder state. For language bindings, we can provide a get_formats() function that returns the GdkContentFormats instance and resets the builder instance, leaving the reference count untouched. For C convenience we can keep gdk_content_formats_builder_free(), and make it a wrapper around gdk_content_formats_builder_get_formats(), with the guarantee that it'll free the builder instance regardless of its current reference count. https://bugzilla.gnome.org/show_bug.cgi?id=793097 https://blogs.gnome.org/otte/2018/02/03/builders/
Diffstat (limited to 'gdk/wayland/gdkprimary-wayland.c')
-rw-r--r--gdk/wayland/gdkprimary-wayland.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdk/wayland/gdkprimary-wayland.c b/gdk/wayland/gdkprimary-wayland.c
index 89f02e65ff..62a6941db2 100644
--- a/gdk/wayland/gdkprimary-wayland.c
+++ b/gdk/wayland/gdkprimary-wayland.c
@@ -58,7 +58,7 @@ gdk_wayland_primary_discard_pending (GdkWaylandPrimary *cb)
{
if (cb->pending_builder)
{
- GdkContentFormats *ignore = gdk_content_formats_builder_free (cb->pending_builder);
+ GdkContentFormats *ignore = gdk_content_formats_builder_free_to_formats (cb->pending_builder);
gdk_content_formats_unref (ignore);
cb->pending_builder = NULL;
}
@@ -178,7 +178,7 @@ primary_selection_selection (void *data,
return;
}
- formats = gdk_content_formats_builder_free (cb->pending_builder);
+ formats = gdk_content_formats_builder_free_to_formats (cb->pending_builder);
cb->pending_builder = NULL;
cb->pending = NULL;