#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
//-----------------------------------------------------------------------------
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);
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;
+ gtk_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
else
gtk_action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
{
if (!gtk_check_version(2,4,0))
- wxDialog::OnOK( event );
+ EndDialog(wxID_OK);
else
wxGenericDirDialog::OnOK( event );
}
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