Re: Running GtkFileChooserDialog in a loop



On Fri, 2004-03-05 at 01:21, Federico Mena Quintero wrote:
> Hello,
> 
> Owen pointed out that several applications in the core desktop have
> constructs like this:
> 
> while (TRUE) {
>   response = gtk_dialog_run (my_file_chooser);
> 
>   if (response == GTK_RESPONSE_OK) {
>     filename = gtk_file_chooser_get_filename (my_file_chooser);
>     if (is_folder (filename)) {
>       gtk_file_chooser_set_current_folder (my_file_chooser, filename);
>       continue;
>     } else {
>       do_something_with (filename);
>       break;
>     }
>   } else
>     break;
> }
> 
> This is a workaround for a bug that GtkFileChooser used to have, and
> that was never reported:  it would allow you to dismiss the dialog (say,
> with the Open or OK button) even when a folder was selected, rather than
> a file.
> 
> This is NOT required; the bug is fixed now.  You should never need to
> re-run the file chooser if it returns something bogus; if such a thing
> happens, it is a bug.
> 
> Please see the details here:
> 
>   http://primates.ximian.com/~federico/news-2004-03.html#04
> 
> The file chooser API is designed to be convenient.  If you find that it
> forces you to use it in cumbersome ways, please file a bug.
> 
> This has been a public service announcement.

There is still an issue if you type in the name of an existing folder in
the save filename entry. Then it lets you select a folder when saving.
Is this right, or should we do something else in this case?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a world-famous hunchbacked shaman with nothing left to lose. She's a 
blind insomniac hooker with a flame-thrower. They fight crime! 




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