- gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
- GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this );
-
- // strange way to internationalize
- gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConv_current->cWX2MB(_("Cancel")) );
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
- GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this );
+ if ( style & wxFD_SAVE )
+ {
+ if ( !defaultDir.empty() )
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
+ wxConvFileName->cWX2MB(defaultDir));
+
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
+ wxGTK_CONV(defaultFileName));
+
+#if GTK_CHECK_VERSION(2,7,3)
+ if ((style & wxFD_OVERWRITE_PROMPT) && !gtk_check_version(2,7,3))
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(m_widget), TRUE);
+#endif
+ }
+ else // wxFD_OPEN
+ {
+ if ( !defaultFileName.empty() )
+ {
+ wxString dir;
+ if ( defaultDir.empty() )
+ dir = ::wxGetCwd();
+ else
+ dir = defaultDir;
+
+ gtk_file_chooser_set_filename(
+ GTK_FILE_CHOOSER(m_widget),
+ wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
+ }
+ else if ( !defaultDir.empty() )
+ {
+ gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
+ wxConvFileName->cWX2MB(defaultDir) );
+ }
+ }
+
+#if GTK_CHECK_VERSION(2,4,0)
+ if ( style & wxFD_PREVIEW )
+ {
+ GtkWidget *previewImage = gtk_image_new();
+
+ gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(m_widget),
+ previewImage);
+ g_signal_connect(m_widget, "update-preview",
+ G_CALLBACK(gtk_filedialog_update_preview_callback),
+ previewImage);
+ }
+#endif // GTK+ 2.4+