johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
6.37k stars 292 forks source link

"Open file" dialog closes by itself after a few seconds #1007

Closed Oberonc closed 1 year ago

Oberonc commented 1 year ago

I've cloned the GTK4 branch and tested it a bit. When I try to open a book by clicking the "Open.." in the menu to to open the "Open file" dialog, said dialog closes by itself after 10 seconds (doesn't matter if I interacted with it or not)

johnfactotum commented 1 year ago

Yeah, I think it's probably a GJS bug. It can be reproduced with the following script:

#!/usr/bin/gjs
imports.gi.versions.Gtk = '4.0'
const { Gtk } = imports.gi

const app = new Gtk.Application({ application_id: 'org.gtk.Example' })
app.connect('activate', () => {
    const win = new Gtk.ApplicationWindow({ application: app })
    win.present()
    const dialog = new Gtk.FileChooserNative({ transient_for: win })
    dialog.show()
})
app.run([])

It doesn't seem to happen with Gtk.FileDialog, though. And since Gtk.FileChooserNative is deprecated, anyway, it should probably just switch to Gtk.FileDialog (which would require GTK 4.10).