Commit Graph

14 Commits

Author SHA1 Message Date
Ernestas Kulik
96d0368290 gdk: contentdeserializer: Fix deserializer not returning
file_uri_deserializer does not return on success, only on failure. This
commit fixes clipboard reads never finishing for some types.
2018-07-19 15:55:58 +03:00
Ernestas Kulik
9a0ec5b1e0 gdk: contentdeserializer: Fix stream usage
file_uri_deserializer splices a memory stream, as opposed to
string_deserializer, which uses a converter and filter stream. This
commit fixes erroneous use of GMemoryOutputStream as
GFilterOutputStream.
2018-07-19 15:53:08 +03:00
Emmanuele Bassi
2cbe094b91 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/
2018-02-03 16:24:13 +01:00
Rico Tzschichholz
6aeae2c828 gdk: Drop invalid "transfer" g-i annotations 2018-01-03 08:26:21 +01:00
Matthias Clasen
6374226d6b Add documentation for content (de)serializers 2017-12-26 14:39:49 -05:00
Matthias Clasen
e917949315 Document GdkClipboard::changed 2017-12-26 14:39:49 -05:00
Matthias Clasen
77f0e678ec gdk: Fill in some blanks in the docs
This is just an initial cut; more work is needed.
2017-12-04 15:58:30 -08:00
Benjamin Otte
a34836f35b gdk: Add (de)serializers for GDK_TYPE_TEXTURE
We want to use textures more, so we should be able to use them for
copy/paste and dnd.
2017-12-03 05:46:49 +01:00
Benjamin Otte
6b326b14c0 gdk: Add GDK_TYPE_FILE_LIST with serializers
This is a GSList of GFile and we want it so we can operate with lists of
files and text/uri-list.

I chose GSList over GList because that's what the GtkFileChooser API
uses, too.
2017-12-03 05:46:48 +01:00
Benjamin Otte
928c98a84e gdk: Add serializers and deserializers for GFile
in particular, support:
GFile <=> text/uri-list
GFile  => text/plain
2017-12-03 05:46:48 +01:00
Benjamin Otte
cc07800570 gdk: Allow setting task data on (de)serializers
This mirrors GTask.
2017-12-03 05:46:48 +01:00
Benjamin Otte
3023d254dd clipboard: Make value getters set the passed in value
Don't return a const GValue, that's ugly API. Instead require people to
pass in a preinitialized GValue and set that one.
2017-12-03 05:46:47 +01:00
Benjamin Otte
88684baecf clipboard: Add gdk_clipboard_read_text_async()
Also add deserializers for G_TYPE_STRING.
2017-12-03 05:46:28 +01:00
Benjamin Otte
91910ba013 gdk: Im[plement content deserializing
Add infrastructure to do GInputStream => GType conversions. Use that to
implement gdk_clipboard_read_value() which reads into GValues.
2017-12-03 05:46:27 +01:00