]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dirdlg.cpp
Added list style to text attributes, independent from paragraph style
[wxWidgets.git] / src / gtk / dirdlg.cpp
index cd9beb423ab366eb3a09225e6dc1728518cc814b..70faf33d0cdf07d284b28612de3c9347668b7a8a 100644 (file)
     #include "wx/filedlg.h"
 #endif
 
-#include <gtk/gtk.h>
 #include "wx/gtk/private.h"
 
 #include <unistd.h> // chdir
 
-
-//-----------------------------------------------------------------------------
-// idle system
-//-----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-
 //-----------------------------------------------------------------------------
 // "clicked" for OK-button
 //-----------------------------------------------------------------------------
@@ -48,13 +40,12 @@ extern void wxapp_install_idle_handler();
 extern "C" {
 static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialog *dialog)
 {
-    gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
-
     // change to the directory where the user went if asked
     if (dialog->HasFlag(wxDD_CHANGE_DIR))
+    {
+        wxGtkString filename(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)));
         chdir(filename);
-
-    g_free(filename);
+    }
 
     wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
     event.SetEventObject(dialog);
@@ -161,14 +152,13 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
                     wxConvFileName->cWX2MB(defaultPath) );
     }
     else
-#endif
         wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
 }
 
 void wxDirDialog::OnFakeOk( wxCommandEvent &event )
 {
     if (!gtk_check_version(2,4,0))
-        wxDialog::OnOK( event );
+        EndDialog(wxID_OK);
     else
         wxGenericDirDialog::OnOK( event );
 }
@@ -203,7 +193,7 @@ void wxDirDialog::SetPath(const wxString& dir)
     {
         if (wxDirExists(dir))
         {
-            gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
+            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
         }
     }
     else
@@ -213,9 +203,12 @@ void wxDirDialog::SetPath(const wxString& dir)
 wxString wxDirDialog::GetPath() const
 {
     if (!gtk_check_version(2,4,0))
-        return wxConvFileName->cMB2WX( gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(m_widget) ) );
-    else
-        return wxGenericDirDialog::GetPath();
+    {
+        wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
+        return wxConvFileName->cMB2WX(str);
+    }
+
+    return wxGenericDirDialog::GetPath();
 }
 
 #endif // wxUSE_DIRDLG