Re: Running GtkFileChooserDialog in a loop



On Fri, 2004-03-05 at 02:37, Alexander Larsson wrote:

> 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?

It is semi-wrong only :)

Right now we make the following tests before emitting ::response when
you click on a non-cancellation button:

1. If we are in SAVE or CREATE_FOLDER actions, we do a
gtk_file_system_make_path().  This should tell us if the combined path
(e.g. current_folder + typed_name) is a valid path name.

2. Otherwise, we test whether the selection in the list is empty.

3. Otherwise, we check that the selection consists of files-only or
folders-only, for OPEN and SELECT_FOLDER actions, respectively [*].

However, the only real guarantee we can make is that
get_filename/get_uri/ get_filenames/get_uris will not return an empty
selection.  Between the time the tests above are made and the time you
call these functions, your program could be scheduled out and the files
could change underneath.  E.g. a file could be unlinked and a folder
with the same name could be created in its place.

So, for ACTION_SAVE, I guess we could indeed check whether the typed
filename is not a known folder from the list.  This would still not
guarantee that your program will succeed if it tries to open the file
for writing.

[*] Multiple selection mode is not allowed in the Save-type actions.

  Federico




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