Howto: Write confirmation for "FileChooserButton"


What I'm trying to do:
I have a filechooser button to select a directory. This directory is where some files will be exported to.

I want to write a confirmation dialog if the directory is not empty  (It is possible that exporting will overwrite some files).
When it is not empty I want to display a confirmation dialog, and if the user presses "No, I don't want to overwrite, I want to select another directory" I want the file chooser dialog to popup again and let the user choose again.

What I have now is a signal listener for "selection changed" signal on the button. I can show a dialog message here but I'm having 2 problems

A) I cant (or better don't know how to) set as parent/transient window the file chooser dialog, which is ugly.
B) I can't "reactivate" the button so the file chooser dialog popups again (or does not get destroyed). Which is not user friendly

For normal file cases I could listen to the confirm-overwrite signal (and return FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN or FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME when appropriate) but according to the docs this wont work for SELECT_DIRECTORY.

One method would be to pass a filechooserdialog myself to the button widget, but this doesn't seem right
I would expect this to be a common problem with a common (built in) solution?

Please tell me if this is indeed what I have to do, or what is the right thing to do in this situation.

Note that I'm using c# so I'm limited to the gtk2+ API (not that 3.0 seems to have more options for this case)


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