+
+static void gtk_filedialog_update_preview_callback(GtkFileChooser *chooser,
+ gpointer user_data)
+{
+#if GTK_CHECK_VERSION(2,4,0)
+ GtkWidget *preview = GTK_WIDGET(user_data);
+
+ gchar *str = gtk_file_chooser_get_preview_filename(chooser);
+ wxGtkString filename(str);
+ if (str) g_free(str);
+
+ if ( !filename )
+ return;
+
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(filename, 128, 128, NULL);
+ gboolean have_preview = pixbuf != NULL;
+
+ gtk_image_set_from_pixbuf(GTK_IMAGE(preview), pixbuf);
+ if ( pixbuf )
+ g_object_unref (pixbuf);
+
+ gtk_file_chooser_set_preview_widget_active(chooser, have_preview);
+#else
+ wxUnusedVar(chooser);
+ wxUnusedVar(user_data);
+#endif // GTK+ 2.4+