After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701271 - GtkFileChooserButton doesn't report a correct current folder
GtkFileChooserButton doesn't report a correct current folder
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2013-05-30 13:10 UTC by Lionel Landwerlin
Modified: 2013-05-30 15:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Lionel Landwerlin 2013-05-30 13:10:22 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();
Comment 1 Lionel Landwerlin 2013-05-30 13:13:09 UTC
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
Comment 2 Federico Mena Quintero 2013-05-30 15:22:14 UTC
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.