''
'' file chooser example
''
' by TJF (2011-2014)
' Details: http://developer.gnome.org/gtk/


#INCLUDE ONCE "Gir/Gtk-3.0.bi"
'#INCLUDE ONCE "Gir/Gtk-2.0.bi"

gtk_init(@__FB_ARGC__, @__FB_ARGV__)

VAR dialog = gtk_file_chooser_dialog_new( _
  "Choose File", _
  NULL, _
  GTK_FILE_CHOOSER_ACTION_OPEN, _
  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _
  GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, _
  NULL )

IF gtk_dialog_run( GTK_DIALOG( dialog ) ) = GTK_RESPONSE_ACCEPT THEN
  VAR filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) )
  PRINT "File name: """ & *filename & """"
  g_free( filename )
END IF

gtk_widget_destroy( GTK_WIDGET(dialog) )
