GTK sends invalid file filter to the FileChooser portal
I'm trying to add a MIME-based file filter to a file chooser button in GNOME Calendar, but nothing happens when clicking the button. The filter is trivial, and defined via GtkBuilder:
<object class="GtkFileFilter" id="calendar_file_filter">
<mime-types>
<mime-type>text/calendar</mime-type>
</mime-types>
</object>
However, when monitoring D-Bus, this is what is sent to the FileChooser portal:
string "wayland:BhL<&YB<a^q 2a-YeQ+>eRV"go~/?gXp"
string "Open a File"
array [
(...)
dict entry(
string "current_filter"
variant struct {
string "Calendar files"
array [
struct {
uint32 1
string "text/calendar"
}
struct {
uint32 1
string ""
}
]
}
)
]
Interestingly, this seems to be a GtkBuilder bug, since gtk_file_filter_to_gvariant()
seems to output a valid variant, as confirmed by:
const Gtk = imports.gi.Gtk;
let filter = new Gtk.FileFilter();
filter.set_name('Test')
filter.add_mime_type('text/calendar');
let v = filter.to_gvariant();
v.print(true);
// Output: "('Test', [(uint32 1, 'text/calendar')])"
Edited by Georges Basile Stavracas Neto