GNOME Bugzilla – Bug 701271
GtkFileChooserButton doesn't report a correct current folder
Last modified: 2013-05-30 15:22:14 UTC
When switching the selection on the GtkFileChooserButton using the combobox, a wrong a current directory is reported by gtk_file_chooser_get_current_folder_file(). Also, no current-folder-changed signal is emitted. Here a quick example in JS, just play a bit opening the dialog, closing it etc... : ------------------------------------------------------------------- const Lang = imports.lang; const Mainloop = imports.mainloop; const Gtk = imports.gi.Gtk; Gtk.init(null, null); let mwindow = new Gtk.Window({ opacity: 0.5 }); mwindow.connect('delete-event', Lang.bind(this, function() { Gtk.main_quit(); })); let chooser = new Gtk.FileChooserButton({ action: Gtk.FileChooserAction.SELECT_FOLDER, }); mwindow.add(chooser); Mainloop.timeout_add_seconds(1, Lang.bind(this, function() { let f = chooser.get_current_folder_file() if (f) log(f.get_path()); else log('no selected folder'); return true; })); mwindow.show_all(); Gtk.main();
I found an issue in rhythmbox about this ( https://bugzilla.gnome.org/show_bug.cgi?id=701194 ) , and I'm now trying to fix on on file-roller
Please see the documentation for this: https://developer.gnome.org/gtk3/stable/GtkFileChooser.html#gtk-file-chooser-get-current-folder I.e. get_current_folder() means "give me the current folder, where the current selection lives". get_file() means "give me the current selection", which is what you want.