]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/filedlg.cpp
check default library directories in WX_PATH_FIND_LIBRARIES; do *not* add default...
[wxWidgets.git] / src / gtk / filedlg.cpp
index 71d76a691559ad6d21e0faafdcbbedd131d76180..420c2e32c07999a76dcda8b20f2f3f81d7b83d5a 100644 (file)
@@ -39,7 +39,6 @@
 //-----------------------------------------------------------------------------
 
 extern void wxapp_install_idle_handler();
 //-----------------------------------------------------------------------------
 
 extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
 
 //-----------------------------------------------------------------------------
 // "clicked" for OK-button
 
 //-----------------------------------------------------------------------------
 // "clicked" for OK-button
@@ -51,6 +50,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));
 
     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) )
     if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
     {
         if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
@@ -156,7 +159,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         GtkFileChooserAction gtk_action;
         GtkWindow* gtk_parent = NULL;
         if (parent)
         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;
         if ( style & wxSAVE )
 
         gchar* ok_btn_stock;
         if ( style & wxSAVE )
@@ -195,19 +198,24 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
         if ( style & wxSAVE )
         {
 
         if ( style & wxSAVE )
         {
-            if ( !defaultDir.IsEmpty() )
+            if ( !defaultDir.empty() )
                 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
                 wxConvFileName->cWX2MB(defaultDir));
 
             gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
                 wxConvFileName->cWX2MB(defaultFileName));
                 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
                 wxConvFileName->cWX2MB(defaultDir));
 
             gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
                 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
         {
-            if ( !defaultFileName.IsEmpty() )
+            if ( !defaultFileName.empty() )
             {
                 wxString dir;
             {
                 wxString dir;
-                if ( defaultDir.IsEmpty() )
+                if ( defaultDir.empty() )
                     dir = ::wxGetCwd();
                 else
                     dir = defaultDir;
                     dir = ::wxGetCwd();
                 else
                     dir = defaultDir;
@@ -216,7 +224,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                     GTK_FILE_CHOOSER(m_widget),
                     wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
             }
                     GTK_FILE_CHOOSER(m_widget),
                     wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
             }
-            else if ( !defaultDir.IsEmpty() )
+            else if ( !defaultDir.empty() )
                 gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
                     wxConvFileName->cWX2MB(defaultDir) );
         }
                 gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
                     wxConvFileName->cWX2MB(defaultDir) );
         }
@@ -267,6 +275,14 @@ bool wxFileDialog::Show( bool show )
         return wxGenericFileDialog::Show( show );
 }
 
         return wxGenericFileDialog::Show( show );
 }
 
+void wxFileDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags )
+{
+    if (!m_wxwindow)
+        return;
+    else
+        wxGenericFileDialog::DoSetSize( x, y, width, height, sizeFlags );
+}
+
 wxString wxFileDialog::GetPath() const
 {
 #ifdef __WXGTK24__
 wxString wxFileDialog::GetPath() const
 {
 #ifdef __WXGTK24__
@@ -354,7 +370,7 @@ void wxFileDialog::SetDirectory(const wxString& dir)
 #ifdef __WXGTK24__
     if (!gtk_check_version(2,4,0))
     {
 #ifdef __WXGTK24__
     if (!gtk_check_version(2,4,0))
     {
-        if (wxPathExists(dir))
+        if (wxDirExists(dir))
         {
             gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
         }
         {
             gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
         }