Commit Graph

19 Commits

Author SHA1 Message Date
Matthias Clasen
69fb3648b2 Tweak the file transfer portal _again_
This is a neverending story. I was seeing problems in tests where
the nested mainloop was picking up unrelated timeouts.

Break down and make this async. This changes the ordering in which
the (de)serializers are registered. If this is causing issues, we
can introduce priorities or something else.
2020-01-17 23:46:37 -05:00
Matthias Clasen
8137dea8c1 Add (de)serializers for GdkRGBA
This is a format that we use in various
color picker widgets, so support it in GDK.
2020-01-08 18:48:19 -05:00
Matthias Clasen
21708e4352 contentserializer: Fix an annotation 2020-01-01 12:51:19 -05:00
Chun-wei Fan
3d8d4921af gdk: Build portal bits on *nix only
The newly-added portal items are supported on *nix only, so only build
them on *nix.
2019-12-17 00:52:18 +08:00
Matthias Clasen
a20c8af678 clipboard: file transfer portal support
Implement file-list <-> application/vnd.flatpak.file-list
serialization by talking to the file transfer portal.

See https://github.com/flatpak/xdg-desktop-portal/pull/222
2019-12-12 14:25:33 -05:00
Руслан Ижбулатов
6e085b3bf1 Pass the correct data to gdk_content_register_serializer()
The argument is eventually passed to g_conv(), so it should
be the charset, not the mime/type. Without this change the
contentype converter will fail to convert UTF-8 strings to, say,
CP-1251 later on.
2018-06-16 18:23:56 +00: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
Matthias Clasen
407d3db2b6 Plug a memory leak
gdk_pixbuf_format_get_name returns newly allocated
strings.
2018-01-04 22:54:29 -05:00
Rico Tzschichholz
6aeae2c828 gdk: Drop invalid "transfer" g-i annotations 2018-01-03 08:26:21 +01:00
Matthias Clasen
6c33e37db2 Remove a duplicate doc comment
g-ir-scanner complains about this.
2017-12-26 19:19:12 -05: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
Emmanuele Bassi
51db8f8f53 Ensure that the path is always set
We are using `path` unconditionally, but it can be conditionally filled.
To avoid inconsistent internal state, and a compiler warning, let's
assert that the variable is always set.
2017-12-05 11:07:46 +00: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
25c3895836 clipboard: Add serialization
This completes the local clipboard code.
2017-12-03 05:46:47 +01:00