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 615353 - gtk_file_chooser_set_filename() doesn't work with gtk_file_chooser_get_filename() in SELECT_FOLDER mode
gtk_file_chooser_set_filename() doesn't work with gtk_file_chooser_get_filena...
Status: RESOLVED DUPLICATE of bug 643170
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.20.x
Other Linux
: Normal critical
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2010-04-10 13:06 UTC by Ilya Murav'jov
Modified: 2011-10-26 23:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ilya Murav'jov 2010-04-10 13:06:32 UTC
Code in C++/gtkmm but it is the same bad for plain C:

    const char* path = "/var/tmp";
    Gtk::FileChooserButton btn("Select folder", Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);

    assert( btn.set_filename(path) );

    //Gtk::Window win;
    //win.show_all();
    //Gtk::Main::run(win);
    while( Gtk::Main::instance()->events_pending() )
        Gtk::Main::instance()->iteration();
    
    // now btn.get_filename() == "/var", not "/var/tmp"!!!
    // CRASH!!!
    assert( strcmp(btn.get_filename().c_str(), path) == 0 );

This bug was introduced since 2.19; it is all ok for gtk+ <= 2.18.

The bug is not reproduced if I use:
- GTK_FILE_CHOOSER_ACTION_OPEN
- gtk_file_chooser_set_current_folder() instead of gtk_file_chooser_set_filename()

So, should I use gtk_file_chooser_set_current_folder() & gtk_file_chooser_get_filename() pair in SELECT_FOLDER mode (I think this is quite unnatural)? 
Is there is a policy/HIG for that?

For my application, Bombono DVD, this is the blocker because I use GtkFileChooser for temporary and empty folder. So, if the preference was "/home/user/tmp" I suggest now to delete contents of "/home/user" folder (Home Folder).
Comment 1 Ilya Murav'jov 2011-10-26 23:28:50 UTC

*** This bug has been marked as a duplicate of bug 643170 ***