Re: Select root folder in GtkfileChooser



Hi,
    I got similar issues when running your codes, also i was trying to produce this 'error' by selecting 
'Choose Download Folder:' in Mozilla Firefox's preferences. My system version:

[thinkpad thinkpad gtk+]$ pkg-config --modversion gtk+-2.0 glib-2.0
2.18.9
2.22.5

If you try more than a slash like '//' or '///' it's works, it's perfectly legal for naming '///' as root 
dir. ;p

          Ardhan

--- pwieser trychlos org wrote:

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
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




_____________________________________________________________
Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]