And finally this may look more like what you may desire:
    
    
    import gintro/[gtk, gobject, gio]
    
    type
      Header = ref object of Headerbar
        text: string
      
      MainWindow = ref object of gtk.ApplicationWindow
        header: Header
        pb: ProgressBar
    
    proc appActivate(app: Application) =
      let window = newApplicationWindow(MainWindow, app)
      window.borderWidth = 10
      window.header = newHeaderbar(Header)
      window.header.setShowCloseButton
      window.header.setTitle("MainWindow")
      window.header.setSubTitle("Subtitle")
      window.pb = newProgressBar()
      window.add(window.pb)
      window.pb.setFraction(0.25)
      window.defaultSize = (400, 400)
      window.setTitlebar(window.header)
      window.showAll()
    
    proc main =
      let app = newApplication("org.gtk.example")
      connect(app, "activate", appActivate)
      discard run(app)
    
    main()
    
    
    Run

Please note that you should add destructors for the subclassed widgets if you 
intent to compile with ARC, see the gintro README.

Reply via email to