- if (g_isIdle) wxapp_install_idle_handler();
-
- int style = dialog->GetStyle();
-
- GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
- char *filename = gtk_file_selection_get_filename(filedlg);
-
- 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);
-
- if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
- return;
- }
- }
- else if ( (style & wxOPEN) && ( style & wxFILE_MUST_EXIST) )
- {
- if ( !wxFileExists( filename ) )
- {
- wxMessageBox(_("Please choose an existing file."), _("Error"), wxOK);
-
- return;
- }
- }
-
- // change to the directory where the user went if asked
- if ( style & wxCHANGE_DIR )
- {
- wxString cwd;
- wxSplitPath(filename, &cwd, NULL, NULL);
-
- if ( cwd != wxGetWorkingDirectory() )
- {
- wxSetWorkingDirectory(cwd);
- }
- }
-
- dialog->SetPath( filename );
-
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
- event.SetEventObject( dialog );
- dialog->GetEventHandler()->ProcessEvent( event );