gtkWindow :: a -- ^ Default value to return if the window is closed using the close button.
          -> React.NetworkDescription (Gtk.Window, React.Event a) -- ^ The window to show. The result 'React.Event' closes the window.
          -> GtkForm a
gtkWindow dft innerNetwork = GtkForm {
    gtkFormRunModal = do
        result <- newIORef dft
        Gtk.initGUI
        network <- React.compile $ do
            (window, theResult) <- innerNetwork
            evImplicitClose <- fmap (fmap (const dft)) (_windowCloseEvent window)
            liftIO $ do
                Gtk.widgetShowAll window
                -- For some reason, the default widget is not taken care of correctly by GTK.
                -- Reset it after the window is shown.
                Gtk.windowGetDefaultWidget window >>= Gtk.windowSetDefault window
            React.reactimate $ fmap (\x -> do
                writeIORef result x
                Gtk.mainQuit) (theResult `React.union` evImplicitClose)
        React.actuate network
        Gtk.mainGUI
        readIORef result
}
gtkWindow :: a -- ^ Default value to return if the window is closed using the close button.
          -> React.NetworkDescription (Gtk.Window, React.Event a) -- ^ The window to show. The result 'React.Event' closes the window.
          -> GtkForm a
gtkWindow dft innerNetwork = GtkForm {
    gtkFormRunModal = do
        result <- newIORef dft
        Gtk.initGUI
        network <- React.compile $ do
            (window, theResult) <- innerNetwork
            evImplicitClose <- fmap (fmap (const dft)) (_windowCloseEvent window)
            liftIO $ do
                Gtk.widgetShowAll window
                -- For some reason, the default widget is not taken care of correctly by GTK.
                -- Reset it after the window is shown.
                Gtk.windowGetDefaultWidget window >>= Gtk.windowSetDefault window
            React.reactimate $ fmap (\x -> do
                writeIORef result x
                Gtk.mainQuit) (theResult `React.union` evImplicitClose)
        React.actuate network
        Gtk.mainGUI
        readIORef result
}
gtkWindow dft innerNetwork = GtkForm {
    gtkFormRunModal = do
        result <- newIORef dft
        Gtk.initGUI
        network <- React.compile $ do
            (window, theResult) <- innerNetwork
            evImplicitClose <- fmap (fmap (const dft)) (_windowCloseEvent window)
            liftIO $ do
                Gtk.widgetShowAll window
                -- For some reason, the default widget is not taken care of correctly by GTK.
                -- Reset it after the window is shown.
                Gtk.windowGetDefaultWidget window >>= Gtk.windowSetDefault window
            React.reactimate $ fmap (\x -> do
                writeIORef result x
                Gtk.mainQuit) (theResult `React.union` evImplicitClose)
        React.actuate network
        Gtk.mainGUI
        readIORef result
}