Select root folder in GtkfileChooser
- From: Pierre Wieser <pwieser trychlos org>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Select root folder in GtkfileChooser
- Date: Fri, 9 Apr 2010 00:41:52 +0200 (CEST)
Hi
In Nautilus-Actions, I need to let my users select folders, including
root folder ('/').
In a GtkFileChooserDialog, there is obviously no way to select the root
folder by clicking on it, because it has no parent.
But when I enter "/" in the location entry, and click on Open button,
I get the message:
"The folder could not be created
Error creating directory: File exists."
Sample code to reproduce this is below:
GtkWidget *dialog;
gchar *path;
dialog = gtk_file_chooser_dialog_new( _( "Select a folder" ),
NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL );
gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), "/" );
if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
path = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
g_debug( "nact_ifolders_tab_on_add_folder_clicked: path=%s", path );
g_free( path );
}
gtk_widget_destroy( dialog );
Is this a bug (and so I should open it Bugzilla) ?
Or is there something missing in my code ?
Thanks in advance for your help.
Regards
Pierre
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]