projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added include wx/timer.h to non WX_PRECOMP case.
[wxWidgets.git]
/
src
/
gtk
/
dirdlg.cpp
diff --git
a/src/gtk/dirdlg.cpp
b/src/gtk/dirdlg.cpp
index a96299c6f695ff2bea0eade74f93bb5ef17d39bd..16bd7a83fe774e5fd000e237fea070e6cefba66a 100644
(file)
--- a/
src/gtk/dirdlg.cpp
+++ b/
src/gtk/dirdlg.cpp
@@
-29,18
+29,10
@@
#include "wx/filedlg.h"
#endif
#include "wx/filedlg.h"
#endif
-#include <gtk/gtk.h>
#include "wx/gtk/private.h"
#include <unistd.h> // chdir
#include "wx/gtk/private.h"
#include <unistd.h> // chdir
-
-//-----------------------------------------------------------------------------
-// idle system
-//-----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-
//-----------------------------------------------------------------------------
// "clicked" for OK-button
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// "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)
{
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))
// 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);
chdir(filename);
-
- g_free(filename);
+ }
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
event.SetEventObject(dialog);
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
event.SetEventObject(dialog);
@@
-81,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
@@
-108,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,
@@
-124,7
+114,7
@@
wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
if (HasFlag(wxDD_DIR_MUST_EXIST))
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;
else
gtk_action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
@@
-158,7
+148,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);
@@
-167,7
+157,7
@@
wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
{
if (!gtk_check_version(2,4,0))
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
{
if (!gtk_check_version(2,4,0))
-
wxDialog::OnOK( event
);
+
EndDialog(wxID_OK
);
else
wxGenericDirDialog::OnOK( event );
}
else
wxGenericDirDialog::OnOK( event );
}
@@
-202,7
+192,8
@@
void wxDirDialog::SetPath(const wxString& dir)
{
if (wxDirExists(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),
+ dir.fn_str());
}
}
else
}
}
else
@@
-212,9
+203,12
@@
void wxDirDialog::SetPath(const wxString& dir)
wxString wxDirDialog::GetPath() const
{
if (!gtk_check_version(2,4,0))
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 wxString(str, *wxConvFileName);
+ }
+
+ return wxGenericDirDialog::GetPath();
}
#endif // wxUSE_DIRDLG
}
#endif // wxUSE_DIRDLG