]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/filedlg.cpp
Moved all the coordinate system calculation to wxDCBase
[wxWidgets.git] / src / gtk / filedlg.cpp
index 6bc006ce84d8fae73c8e07c3e8a0bca8f75685b4..1e6fef80a32a72aca51d86e2b5b2edbff31a412e 100644 (file)
 #include "wx/tokenzr.h" // wxStringTokenizer
 #include "wx/filefn.h" // ::wxGetCwd
 
-//-----------------------------------------------------------------------------
-// idle system
-//-----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-
 //-----------------------------------------------------------------------------
 // "clicked" for OK-button
 //-----------------------------------------------------------------------------
@@ -97,8 +91,6 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
                                              gint response,
                                              wxFileDialog *dialog)
 {
-    wxapp_install_idle_handler();
-
     if (response == GTK_RESPONSE_ACCEPT)
         gtk_filedialog_ok_callback(w, dialog);
     else    // GTK_RESPONSE_CANCEL or GTK_RESPONSE_NONE
@@ -160,7 +152,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         return;
     }
 
-    m_needParent = false;
+    parent = GetParentForModalDialog(parent);
 
     if (!PreCreation(parent, pos, wxDefaultSize) ||
         !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
@@ -230,19 +222,18 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         fn.Assign(defaultFileName);
     else if ( !defaultFileName.empty() )
         fn.Assign(defaultDir, defaultFileName);
+    else
+        fn.AssignDir(defaultDir);
 
     // set the initial file name and/or directory
-    wxString fname = fn.GetFullName();
-    if ( fname.empty() )
+    const wxString dir = fn.GetPath();
+    if ( !dir.empty() )
     {
-        wxString dir = fn.GetPath();
-        if ( !dir.empty() )
-        {
-            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
-                                                dir.fn_str());
-        }
+        gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
+                                            dir.fn_str());
     }
 
+    const wxString fname = fn.GetFullName();
     if ( style & wxFD_SAVE )
     {
         if ( !fname.empty() )