#!/usr/bin/ginsbasic001


//-- load  file and show the window
gins_glade("testfiledialog.glade")
	gins_set("filechooserdialog1" , "visible" , "1" , "<boolean>")
gins_main()


//-- manipulate a widget, e.g. move the window
gins_set("window1" , "10" , "10" , "<uposition>")


//-- get information about a widget
a = gins_get("button1" , "label" , "<str>")
print a


'gtk_createobject("GtkWindow" , "NewWindow", 0 , 0)
'gtk("gtk_widget_show" , ":NewWindow" , 0 ,0,0,0,0)


'gtk_createobject("GtkButtonWithLabel" , "button96", "testbutton" , 0)
'gtk("gtk_box_pack_start" , "hbox1" , ":button96" , "0","0","0",0)
'gtk("gtk_widget_show" , ":button96" , 0 ,0,0,0,0)

//-- mainloop with eventhandling
while 1

  widget , event , pdata = gins_event()

  if widget != Nothing then
    print widget
    print event
    print pdata

    if event = "GDK_DELETE" then
      if widget = "window1" then
        gins_exit()
        end
      end if


    end if

'   if event = "GDK_BUTTON_PRESS" then
    if event = "GDK_BUTTON_RELEASE" then

      if widget = "button1" then

	//gtk_createobject("FileChooserDialog" , "FileDialog1" , ":NewWindow" , "1")

	//gtk("gtk_window_show"  , ":FileDialog1", 0 ,0,0,0,0)
	//gtk("gtk_window_set_modal"  , ":FileDialog1", 0 ,0,0,0,0)


	//	result = gtk("gtk_dialog_run" , ":FileDialog1", 0 ,0,0,0,0)
	//gtk("gtk_window_show"  , "filechooserdialog1", 0 ,0,0,0,0)
	//gins_set("window1" , "visible" , "FALSE" , "<boolean>")
	//gins_set("filechooserdialog1" , "visible" , "TRUE" , "<boolean>")
	gins_set("filechooserdialog1" , "visible" , "1" , "<boolean>")
      end if
    end if
  end if

  gins_usleep(10000)

wend
