X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/91af089567c5e13a408f1c529f6830d12cdc6c4e..ce5d92e15071d65b430f11efa548076beeb9673c:/src/gtk/filedlg.cpp diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 500acf64ef..13c50895d2 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gtk/filedlg.cpp +// Name: src/gtk/filedlg.cpp // Purpose: native implementation of wxFileDialog // Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp // Id: $Id$ @@ -7,20 +7,18 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "filedlggtk.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -// Include setup.h to get wxUSE flags for compilers that do not support precompilation of headers -#include "wx/setup.h" - #if wxUSE_FILEDLG #include "wx/filedlg.h" +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/msgdlg.h" +#endif + #ifdef __WXGTK24__ #include @@ -28,11 +26,9 @@ #include // chdir -#include "wx/intl.h" #include "wx/filename.h" // wxFilename #include "wx/tokenzr.h" // wxStringTokenizer #include "wx/filefn.h" // ::wxGetCwd -#include "wx/msgdlg.h" // wxMessageDialog //----------------------------------------------------------------------------- // idle system @@ -50,6 +46,10 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) int style = dialog->GetStyle(); gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); + // gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation) +#if GTK_CHECK_VERSION(2,7,3) + if(gtk_check_version(2,7,3) != NULL) +#endif if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT)) { if ( g_file_test(filename, G_FILE_TEST_EXISTS) ) @@ -155,9 +155,9 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, GtkFileChooserAction gtk_action; GtkWindow* gtk_parent = NULL; if (parent) - gtk_parent = GTK_WINDOW(parent->m_widget); + gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) ); - gchar* ok_btn_stock; + const gchar* ok_btn_stock; if ( style & wxSAVE ) { gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE; @@ -177,6 +177,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, ok_btn_stock, GTK_RESPONSE_ACCEPT, NULL); + gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT); + if ( style & wxMULTIPLE ) gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), true); @@ -187,8 +189,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, // Currently local-only is kept as the default - true: // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true); - g_signal_connect(G_OBJECT(m_widget), "response", - GTK_SIGNAL_FUNC(gtk_filedialog_response_callback), (gpointer)this); + g_signal_connect (m_widget, "response", + G_CALLBACK (gtk_filedialog_response_callback), this); SetWildcard(wildCard); @@ -200,6 +202,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(defaultFileName)); + +#if GTK_CHECK_VERSION(2,7,3) + if ((style & wxOVERWRITE_PROMPT) && !gtk_check_version(2,7,3)) + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(m_widget), TRUE); +#endif } else {