-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathError.hs
More file actions
41 lines (38 loc) · 1.4 KB
/
Error.hs
File metadata and controls
41 lines (38 loc) · 1.4 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
-----------------------------------------------------------------------------
--
-- Module : VCSGui.Common.Error
-- Copyright : 2011 Stephan Fortelny, Harald Jagenteufel
-- License : GPL
--
-- Maintainer : stephanfortelny at gmail.com, h.jagenteufel at gmail.com
-- Stability :
-- Portability :
--
-- | Functions to handle errors are found in this module.
--
-----------------------------------------------------------------------------
module VCSGui.Common.Error (
showErrorGUI
) where
import Data.Text (Text)
import GI.Gtk.Objects.Dialog (constructDialogUseHeaderBar, dialogRun)
import GI.Gtk.Objects.Widget (widgetDestroy)
import Data.GI.Base.GObject (new')
import GI.Gtk.Objects.MessageDialog
(constructMessageDialogMessageType, constructMessageDialogButtons,
setMessageDialogText, MessageDialog(..))
import GI.Gtk.Enums (ButtonsType(..), MessageType(..))
-- | Displays a simple window displaying given 'String' as an error message.
showErrorGUI :: Text -- ^ Message to display.
-> IO ()
showErrorGUI msg = do
dialog <- new' MessageDialog [
constructDialogUseHeaderBar 0,
constructMessageDialogMessageType MessageTypeError,
constructMessageDialogButtons ButtonsTypeOk]
setMessageDialogText dialog msg
_ <- dialogRun dialog
widgetDestroy dialog
return ()