X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/035b704a464852c4d6ce297f20a90551c08d3a4c..c6cdf16c933251be1670f611ba28e48885610b23:/src/gtk1/filedlg.cpp diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 8f7b97ed89..b4d0ed1592 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -25,8 +25,11 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), gpointer data ) { wxFileDialog *dialog = (wxFileDialog*)data; wxCommandEvent event(wxEVT_NULL); + int style; - if(dialog->GetStyle()&(wxSAVE|wxOVERWRITE_PROMPT)) + style=dialog->GetStyle(); + + if((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) { if(wxMessageBox("File exists. Overwrite?","Confirm",wxYES_NO)!=wxYES) return; @@ -51,7 +54,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, { m_needParent = FALSE; - PreCreation( parent, -1, pos, wxDefaultSize, style, "filedialog" ); + PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); m_message = message; m_path = ""; m_fileName = defaultFileName; @@ -62,10 +65,14 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, m_widget = gtk_file_selection_new( "File selection" ); + int x = (gdk_screen_width () - 400) / 2; + int y = (gdk_screen_height () - 400) / 2; + gtk_widget_set_uposition( m_widget, x, y ); + GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); m_path.Append(m_dir); - if(m_path.Last()!='/') m_path.Append('/'); + if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); m_path.Append(m_fileName); if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);