Running GtkFileChooserDialog in a loop
- From: Federico Mena Quintero <federico ximian com>
- To: GNOME Desktop <desktop-devel-list gnome org>
- Cc: GTK+ development mailing list <gtk-devel-list gnome org>
- Subject: Running GtkFileChooserDialog in a loop
- Date: Thu, 04 Mar 2004 18:21:43 -0600
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.
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]