After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793097 - Allow binding GdkContentFormatsBuilder
Allow binding GdkContentFormatsBuilder
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2018-02-01 16:53 UTC by Emmanuele Bassi (:ebassi)
Modified: 2018-02-03 15:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow binding GdkContentFormatsBuilder (7.48 KB, patch)
2018-02-01 16:53 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2018-02-01 16:53:49 UTC
GdkContentFormatsBuilder is currently not introspectable, nor usable via bindings. We
could skip it, but it may be worth adding the extra work to make it available to non-C
developers.
Comment 1 Emmanuele Bassi (:ebassi) 2018-02-01 16:53:53 UTC
Created attachment 367763 [details] [review]
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.
Comment 2 Benjamin Otte (Company) 2018-02-03 15:28:17 UTC
Adapted it to what we agreed at the hackfest and pushed to master.