GNOME Bugzilla – Bug 615353
gtk_file_chooser_set_filename() doesn't work with gtk_file_chooser_get_filename() in SELECT_FOLDER mode
Last modified: 2011-10-26 23:28:50 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).
*** This bug has been marked as a duplicate of bug 643170 ***