[wxGTK] wxFileDialog: Use native overwrite confirmation if possible

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35050 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mart Raudsepp
2005-08-01 16:39:57 +00:00
parent 6807396fdf
commit b5ab6d19d3
2 changed files with 18 additions and 0 deletions

View File

@@ -50,6 +50,10 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
int style = dialog->GetStyle(); int style = dialog->GetStyle();
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); 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 ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
{ {
if ( g_file_test(filename, G_FILE_TEST_EXISTS) ) if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
@@ -200,6 +204,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
wxConvFileName->cWX2MB(defaultFileName)); wxConvFileName->cWX2MB(defaultFileName));
#if GTK_CHECK_VERSION(2,7,3)
if (!gtk_check_version(2,7,3))
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(m_widget), TRUE);
#endif
} }
else else
{ {

View File

@@ -50,6 +50,10 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
int style = dialog->GetStyle(); int style = dialog->GetStyle();
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); 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 ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
{ {
if ( g_file_test(filename, G_FILE_TEST_EXISTS) ) if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
@@ -200,6 +204,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
wxConvFileName->cWX2MB(defaultFileName)); wxConvFileName->cWX2MB(defaultFileName));
#if GTK_CHECK_VERSION(2,7,3)
if (!gtk_check_version(2,7,3))
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(m_widget), TRUE);
#endif
} }
else else
{ {