]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dirdlg.cpp
initialize bitmap to avoid assertion
[wxWidgets.git] / src / gtk / dirdlg.cpp
index 7e75f051314503a21af3164ace7cd839f4cef8af..846948571b754752aca96672a2348c1c63224af7 100644 (file)
@@ -72,8 +72,6 @@ static void gtk_dirdialog_response_callback(GtkWidget *w,
                                              gint response,
                                              wxDirDialog *dialog)
 {
                                              gint response,
                                              wxDirDialog *dialog)
 {
-    wxapp_install_idle_handler();
-
     if (response == GTK_RESPONSE_ACCEPT)
         gtk_dirdialog_ok_callback(w, dialog);
     else // GTK_RESPONSE_CANCEL or GTK_RESPONSE_NONE
     if (response == GTK_RESPONSE_ACCEPT)
         gtk_dirdialog_ok_callback(w, dialog);
     else // GTK_RESPONSE_CANCEL or GTK_RESPONSE_NONE
@@ -99,7 +97,8 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
     if (!gtk_check_version(2,4,0))
     {
         m_message = title;
     if (!gtk_check_version(2,4,0))
     {
         m_message = title;
-        m_needParent = false;
+
+        parent = GetParentForModalDialog(parent);
 
         if (!PreCreation(parent, pos, wxDefaultSize) ||
             !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
 
         if (!PreCreation(parent, pos, wxDefaultSize) ||
             !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
@@ -109,20 +108,14 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
             return;
         }
 
             return;
         }
 
-        GtkFileChooserAction gtk_action;
         GtkWindow* gtk_parent = NULL;
         if (parent)
             gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
 
         GtkWindow* gtk_parent = NULL;
         if (parent)
             gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
 
-        if (HasFlag(wxDD_DIR_MUST_EXIST))
-            gtk_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
-        else
-            gtk_action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
-
         m_widget = gtk_file_chooser_dialog_new(
                        wxGTK_CONV(m_message),
                        gtk_parent,
         m_widget = gtk_file_chooser_dialog_new(
                        wxGTK_CONV(m_message),
                        gtk_parent,
-                       gtk_action,
+                       GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                        NULL);
                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                        NULL);
@@ -149,7 +142,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
 
         if ( !defaultPath.empty() )
             gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
 
         if ( !defaultPath.empty() )
             gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
-                    wxConvFileName->cWX2MB(defaultPath) );
+                    defaultPath.fn_str() );
     }
     else
         wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
     }
     else
         wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
@@ -193,7 +186,8 @@ void wxDirDialog::SetPath(const wxString& dir)
     {
         if (wxDirExists(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),
+                                                dir.fn_str());
         }
     }
     else
         }
     }
     else
@@ -205,7 +199,7 @@ wxString wxDirDialog::GetPath() const
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
-        return wxConvFileName->cMB2WX(str);
+        return wxString(str, *wxConvFileName);
     }
 
     return wxGenericDirDialog::GetPath();
     }
 
     return wxGenericDirDialog::GetPath();