[neon/backports-focal/xdg-desktop-portal/Neon/unstable] /: FileChooser: Add a 'current_filter' return value
Michael Weghorn
null at kde.org
Wed Jan 13 06:32:43 GMT 2021
Git commit 35fca7fae881bdaba1bebccf7775eba84407a488 by Michael Weghorn.
Committed on 23/05/2020 at 12:29.
Pushed by ash into branch 'Neon/unstable'.
FileChooser: Add a 'current_filter' return value
Add a 'current_filter' element for the FileChooser
response which is used to specify which filter
was selected in the file chooser.
This will allow making Gtk's
'gtk_file_chooser_get_filter' work for the
portal native file chooser.
Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/1820
M +18 -0 data/org.freedesktop.impl.portal.FileChooser.xml
M +18 -0 data/org.freedesktop.portal.FileChooser.xml
M +5 -0 src/file-chooser.c
https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/35fca7fae881bdaba1bebccf7775eba84407a488
diff --git a/data/org.freedesktop.impl.portal.FileChooser.xml b/data/org.freedesktop.impl.portal.FileChooser.xml
index 873b2dd..8c684b0 100644
--- a/data/org.freedesktop.impl.portal.FileChooser.xml
+++ b/data/org.freedesktop.impl.portal.FileChooser.xml
@@ -109,6 +109,15 @@
See org.freedesktop.portal.FileChooser.OpenFile() for details.
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>current_filter (sa(us))</term>
+ <listitem>
+ <para>
+ The filter that was selected.
+ See org.freedesktop.portal.FileChooser.OpenFile() for details.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term>writable b</term>
<listitem><para>
@@ -216,6 +225,15 @@
See org.freedesktop.portal.FileChooser.OpenFile() for details.
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>current_filter (sa(us))</term>
+ <listitem>
+ <para>
+ The filter that was selected.
+ See org.freedesktop.portal.FileChooser.OpenFile() for details.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
-->
<method name="SaveFile">
diff --git a/data/org.freedesktop.portal.FileChooser.xml b/data/org.freedesktop.portal.FileChooser.xml
index f0c7408..8582abc 100644
--- a/data/org.freedesktop.portal.FileChooser.xml
+++ b/data/org.freedesktop.portal.FileChooser.xml
@@ -151,6 +151,15 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>current_filter (sa(us))</term>
+ <listitem>
+ <para>
+ The filter that was selected. This may match a filter in the
+ filter list or another filter that was applied unconditionally.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
-->
<method name="OpenFile">
@@ -248,6 +257,15 @@
See org.freedesktop.portal.FileChooser.OpenFile() for details.
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>current_filter (sa(us))</term>
+ <listitem>
+ <para>
+ The filter that was selected.
+ See org.freedesktop.portal.FileChooser.OpenFile() for details.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
-->
<method name="SaveFile">
diff --git a/src/file-chooser.c b/src/file-chooser.c
index 2e83821..166ae9a 100644
--- a/src/file-chooser.c
+++ b/src/file-chooser.c
@@ -79,6 +79,7 @@ send_response_in_thread_func (GTask *task,
const char **uris;
GVariant *choices;
gboolean for_save;
+ GVariant *current_filter;
g_variant_builder_init (&results, G_VARIANT_TYPE_VARDICT);
g_variant_builder_init (&ruris, G_VARIANT_TYPE_STRING_ARRAY);
@@ -100,6 +101,10 @@ send_response_in_thread_func (GTask *task,
if (choices)
g_variant_builder_add (&results, "{sv}", "choices", choices);
+ current_filter = g_variant_lookup_value (options, "current_filter", G_VARIANT_TYPE ("(sa(us))"));
+ if (current_filter)
+ g_variant_builder_add (&results, "{sv}", "current_filter", current_filter);
+
if (g_variant_lookup (options, "uris", "^a&s", &uris))
{
int i;
More information about the Neon-commits
mailing list