diff options
Diffstat (limited to 'UI.hs')
-rw-r--r-- | UI.hs | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -10,5 +10,18 @@ import Control.Monad import UI.Zenity import UI.Readline -availableUI :: IO [UI] -availableUI = filterM isAvailable [zenityUI, readlineUI] +availableUIs :: IO [UI] +availableUIs = filterM isAvailable [zenityUI, readlineUI] + +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" |