#include "wx/intl.h"
#include "wx/filename.h"
#include "wx/msgdlg.h"
+#include "wx/log.h"
#include <gtk/gtk.h>
// "clicked" for OK-button
//-----------------------------------------------------------------------------
+extern "C" {
static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
{
int style = dialog->GetStyle();
gchar* text = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
wxString filename(wxGTK_CONV_BACK(text));
+ if ( filename.empty() )
+ {
+ // this is totally lame but better than silent error
+ wxLogWarning(_("This filename can't be used by wxWidgets because it contains invalid UTF-8 characters, please rename the file."));
+ return;
+ }
if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
{
event.SetEventObject(dialog);
dialog->GetEventHandler()->ProcessEvent(event);
}
+}
//-----------------------------------------------------------------------------
// "clicked" for Cancel-button
//-----------------------------------------------------------------------------
+extern "C" {
static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w),
wxFileDialog *dialog)
{
event.SetEventObject(dialog);
dialog->GetEventHandler()->ProcessEvent(event);
}
+}
+extern "C" {
static void gtk_filedialog_response_callback(GtkWidget *w,
int response,
wxFileDialog *dialog)
dialog->m_destroyed_by_delete = true;
}
}
-#endif
+}
+
+#endif // __WXGTK24__
//-----------------------------------------------------------------------------
// wxFileDialog
if (gpaths)
g_slist_free(gpaths);
}
- else
+
+ if ( paths.IsEmpty() )
{
paths.Add(m_fileName);
}