- int style = dialog->GetStyle();
- gchar* text = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
- wxString filename(wxGTK_CONV_BACK(text));
-
- if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
- {
- if (wxFileExists(filename))
- {
- wxString msg;
- msg.Printf(
- _("File '%s' already exists, do you really want to overwrite it?"),
- filename.c_str());
-
- wxMessageDialog dlg(dialog, msg, _("Confirm"),
- wxYES_NO | wxICON_QUESTION);
- if (dlg.ShowModal() != wxID_YES)
- return;
- }
- }
- else if ((style & wxOPEN) && ( style & wxFILE_MUST_EXIST))
- {
- if (!wxFileExists( filename ))
- {
- wxMessageDialog dlg(dialog,
- _("Please choose an existing file."),
- _("Error"), wxOK | wxICON_ERROR);
- dlg.ShowModal();
-
- return;
- }
- }
-
- // change to the directory where the user went if asked
- if (style & wxCHANGE_DIR)
- {
- wxString cwd;
- wxSplitPath(filename, &cwd, NULL, NULL);
-
- if (cwd != wxGetCwd())
- {
- wxSetWorkingDirectory(cwd);
- }
- }
-
- dialog->SetPath(filename);
- dialog->UpdateFromDialog();
-
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
- event.SetEventObject(dialog);
- dialog->GetEventHandler()->ProcessEvent(event);
+ wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name );