blob: 279f6b9d4d2bb7b797e9f59ce16542d8e1a62891 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
{- Copyright 2016 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
module UI (module UI, module Types.UI) where
import Types.UI
import Control.Monad
import UI.Zenity
import UI.Readline
availableUIs :: IO [UI]
availableUIs = filterM isAvailable [readlineUI, zenityUI]
selectUI :: Bool -> IO UI
selectUI needgui
| needgui = do
ok <- isAvailable zenityUI
if ok
then return zenityUI
else error "zenitty is not installed, GUI not available"
| otherwise = do
l <- availableUIs
case l of
(u:_) -> return u
[] -> error "Neither zenity nor the readline UI are available"
|