GNOME Bugzilla – Bug 346058
gtk_file_chooser_set_current_name does not have expected behaviour
Last modified: 2008-04-02 21:05:12 UTC
Please describe the problem: gtk_file_chooser_set_current_name is supposed to set the default name, but this does not work with GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER. Steps to reproduce: Consider: #include <gtk/gtk.h> int main(int argc, char *argv[]) { gtk_init (&argc, &argv); GtkWidget* foo = gtk_file_chooser_dialog_new( "Foo", NULL, GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(foo), "Default folder"); gtk_widget_show(foo); gtk_main (); return 0; } Actual results: The name entry is empty. Expected results: The name entry should contain "Default folder". Does this happen every time? Yes. Other information:
*** This bug has been marked as a duplicate of 341055 ***
Incorrectly marked as dupe -- sorry. Long day.
We already have a unit test for set_current_name(), but it only does SAVE mode. Can you please patch gtk+/tests/autotestfilechooser.c to do it in CREATE_FOLDER mode as well?
Created attachment 82484 [details] [review] Add test for set_current_name in CREATE_FOLDER mode
Created attachment 82488 [details] [review] Improved test case The preceding test case created a folder called "parangaricutirimicuaro.txt" to be created which caused the SAVE action tests to fail on subsequent runs. This patch fixes that.
Committed your patch in r19967. I think this ticket is safe to close because the bug seem to have vanished. This test code will not reproduce it: import gtk dialog = gtk.FileChooserDialog(action = gtk.FILE_CHOOSER_ACTION_CREATE_FOLDER, buttons = (gtk.STOCK_OPEN, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) dialog.set_current_name('Default folder') dialog.show() gtk.main() The name entry is correctly filled in with 'Default folder'.