X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a130bb4e758c8423694265ac29554a1901fa3d27..d10e22fe8ad283f37b1809349028ffc282e393ce:/src/gtk/dirdlg.cpp diff --git a/src/gtk/dirdlg.cpp b/src/gtk/dirdlg.cpp index a96299c6f6..70faf33d0c 100644 --- a/src/gtk/dirdlg.cpp +++ b/src/gtk/dirdlg.cpp @@ -29,18 +29,10 @@ #include "wx/filedlg.h" #endif -#include #include "wx/gtk/private.h" #include // 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); @@ -167,7 +158,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title, void wxDirDialog::OnFakeOk( wxCommandEvent &event ) { if (!gtk_check_version(2,4,0)) - wxDialog::OnOK( event ); + EndDialog(wxID_OK); else wxGenericDirDialog::OnOK( event ); } @@ -202,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 @@ -212,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