The problem occurs when I create a GtkFileChooserDialog with action
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER and then set the default folder
with gtk_file_chooser_set_filename or gtk_file_chooser_select_filename.
Attempting to click "Ok" gives the message "The folder could not be
created. Error creating directory: File exists". Simply selecting a
different file, then re-selecting the default and clicking "Ok" works
fine. I've attached a sample program that demonstrates the problem. Am
I doing something wrong, or is this a bug? If it's a bug, is there a
known work-around? I've tried various permutations of things and can't
find a way around it.
Fedora 11
gtk 2.16.5-1
#include <gtk/gtk.h>
#include <stdlib.h>
static gpointer
do_dialog(gpointer data)
{
GtkWidget * dialog;
gint response;
gchar * dir;
g_debug("do_dialog ()");
dialog = gtk_file_chooser_dialog_new("Select Folder", NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL);
dir = getenv("HOME");
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), dir);
response = gtk_dialog_run(GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_ACCEPT)
{
gchar *filename;
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
(dialog));
if (filename != NULL)
{
g_debug("Filename is (%s)", filename);
g_free(filename);
}
}
gtk_widget_destroy(dialog);
gtk_main_quit();
return FALSE;
}
int
main (int argc, char *argv[])
{
gtk_init (&argc, &argv);
g_idle_add((GSourceFunc)do_dialog, NULL);
gtk_main ();
return 0;
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list