+ bool multiple = (style & wxMULTIPLE) == wxMULTIPLE;
+ GtkFileChooserAction gtk_action;
+ GtkWindow* gtk_parent = NULL;
+ if (parent)
+ gtk_parent = GTK_WINDOW(parent->m_widget);
+
+ gchar* ok_btn_stock;
+ if ((style & wxSAVE) == wxSAVE)
+ {
+ gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
+ ok_btn_stock = GTK_STOCK_SAVE;
+ }
+ else
+ {
+ gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
+ ok_btn_stock = GTK_STOCK_OPEN;
+ }
+ m_widget = gtk_file_chooser_dialog_new(
+ wxGTK_CONV(m_message),
+ gtk_parent,
+ gtk_action,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ ok_btn_stock, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), multiple);
+
+ gtk_signal_connect(GTK_OBJECT(m_widget),
+ "response",
+ GTK_SIGNAL_FUNC(gtk_filedialog_response_callback),
+ (gpointer*)this);
+
+ m_path = m_dir;
+ if (!m_path.empty() && m_path.Last() != wxT('/'))
+ m_path += wxT('/');
+ m_path += m_fileName;
+ SetPath(m_path);
+
+ SetWildcard(wildCard);
+ SetFilterIndex(0);
+}
+
+void wxFileDialog::SetPath(const wxString& path)
+{
+ DoSetPath(path);
+ UpdateDialog();
+}
+
+void wxFileDialog::GetFilenames(wxArrayString& files) const
+{
+ GetPaths(files);
+ for (size_t n = 0; n < files.GetCount(); n++ )
+ {
+ wxString name,ext;
+ wxSplitPath(files[n], NULL, &name, &ext);
+ if (!ext.IsEmpty())
+ {
+ name += wxT(".");
+ name += ext;
+ }
+ files[n] = name;
+ }
+}
+void wxFileDialog::GetPaths(wxArrayString& paths) const
+{
+ paths.Empty();
+ if (GetWindowStyle() & wxMULTIPLE)
+ {
+ GSList *gpathsi =
+ gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(m_widget));
+ GSList *gpaths = gpathsi;
+ while (gpathsi)
+ {
+ wxString file = wxGTK_CONV_BACK((gchar*) gpathsi->data);
+ paths.Add(file);
+ g_free(gpathsi->data);
+ gpathsi = gpathsi->next;
+ }
+ if (gpaths)
+ g_slist_free(gpaths);
+ }
+ else
+ {
+ paths.Add(m_fileName);
+ }
+}