Skip to content

An example without App.Simple? #96

@kindaro

Description

@kindaro

There are many great examples, but all of them use App.Simple. I would like to use some other architecture for my application. A simple example of opening a window with some buttons would go a long way. So far I have this:

module Main where

import qualified Control.Concurrent.Async as Async
import qualified Data.GI.Base as Base
import qualified GI.Gtk as Gtk
import GI.Gtk.Declarative

main ∷ IO ( )
main = do
  _ ← Gtk.init Nothing
  main ← Async.async Gtk.main
  win ← Base.new Gtk.Window [#title Base.:= ""]
  #showAll win
  -- Insert code here.
  Gtk.mainQuit
  Async.wait main

It works so far, but it took me something like 2 hours to get there! And it does not really use any features of gi-gtk-declarative because I could not figure out how to open a window yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions