#include <gtk/gtk.h>
#ifdef G_OS_WIN32
#include <Windows.h>
#endif

static void create_win32_native_file_chooser (GtkWidget *widget,
                                              gpointer   user_data);

static void create_win32_native_file_chooser (GtkWidget *widget,
                                              gpointer   user_data)
{
   GtkFileChooserNative *win32_native_file_chooser;
   GtkWidget *window = gtk_widget_get_toplevel (widget) ;

   win32_native_file_chooser = gtk_file_chooser_native_new ("title",
                                                            GTK_WINDOW(window),
                                                            GTK_FILE_CHOOSER_ACTION_SAVE,
                                                            "accept label",
                                                            "cancel label");

  gtk_native_dialog_run (GTK_NATIVE_DIALOG (win32_native_file_chooser));

  gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (win32_native_file_chooser));

  return;
}


int main (int argc, char *argv[])
{
#ifdef G_OS_WIN32
   gchar *msg = g_strdup_printf ("Process ID is %lu\nPress OK to continue", GetCurrentProcessId ());
   MessageBoxA (NULL, msg, "Attach GDB now", 0);
   g_free (msg);
#endif
   gtk_init (&argc, &argv) ;

   GtkWidget *window, *button ;

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   button= gtk_button_new_with_label ("test");

   g_signal_connect (button, "clicked", 
                     G_CALLBACK (create_win32_native_file_chooser), NULL);
   g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

   gtk_container_add (GTK_CONTAINER (window), button) ;
   gtk_widget_show_all (window);

   gtk_main ();

   return 0;
}
