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 346058 - gtk_file_chooser_set_current_name does not have expected behaviour
gtk_file_chooser_set_current_name does not have expected behaviour
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other All
: High normal
: Small fix
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2006-06-27 21:33 UTC by Joe Halliwell
Modified: 2008-04-02 21:05 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Add test for set_current_name in CREATE_FOLDER mode (1.70 KB, patch)
2007-02-13 20:42 UTC, Joe Halliwell
none Details | Review
Improved test case (1.95 KB, patch)
2007-02-13 20:51 UTC, Joe Halliwell
committed Details | Review

Description Joe Halliwell 2006-06-27 21:33:51 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:
Comment 1 Joe Halliwell 2006-06-27 22:58:09 UTC

*** This bug has been marked as a duplicate of 341055 ***
Comment 2 Joe Halliwell 2006-06-28 02:13:44 UTC
Incorrectly marked as dupe -- sorry. Long day.
Comment 3 Federico Mena Quintero 2007-01-25 20:52:58 UTC
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?
Comment 4 Joe Halliwell 2007-02-13 20:42:42 UTC
Created attachment 82484 [details] [review]
Add test for set_current_name in CREATE_FOLDER mode
Comment 5 Joe Halliwell 2007-02-13 20:51:37 UTC
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.
Comment 6 Björn Lindqvist 2008-04-02 21:05:12 UTC
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'.