#!/usr/bin/python

from gi.repository import GLib, Gtk

dlg = None

def show_child(data):
  global dlg
  dlg = Gtk.Window()
  dlg.set_title("TestChild")
  dlg.set_default_size(200, 200)
  dlg.set_transient_for(win)
  dlg.show()
  return False

def destroy_child(data):
  dlg.destroy()

def show_filedlg(data):
  global dlg
  dlg = Gtk.FileChooserDialog("TestChooser", win, Gtk.FileChooserAction.SELECT_FOLDER, None)
  dlg.show()
  return False

win = Gtk.Window()
win.set_title("TestParent")
win.set_default_size(400, 400)
win.show()

GLib.timeout_add_seconds(10, show_child, None)
GLib.timeout_add_seconds(20, destroy_child, None)
GLib.timeout_add_seconds(30, show_filedlg, None)
GLib.timeout_add_seconds(40, destroy_child, None)
GLib.timeout_add_seconds(50, Gtk.main_quit, None)

Gtk.main()
