aboutsummaryrefslogtreecommitdiff
path: root/Assistant/DaemonStatus.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-29 16:34:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-29 16:34:11 -0400
commit0864097c212131b477b41907b3d59dacf6bc4fe9 (patch)
tree8d76fe026442a6745ade9b4b1a5ea0d27b7e0d31 /Assistant/DaemonStatus.hs
parentda4fe399e3817dded3d414c99c9bc6b292661513 (diff)
move alert display functions
Diffstat (limited to 'Assistant/DaemonStatus.hs')
-rw-r--r--Assistant/DaemonStatus.hs46
1 files changed, 0 insertions, 46 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs
index 08cdbaf55..49586754c 100644
--- a/Assistant/DaemonStatus.hs
+++ b/Assistant/DaemonStatus.hs
@@ -223,49 +223,3 @@ notifyTransfer dstatus = sendNotification
notifyAlert :: DaemonStatusHandle -> IO ()
notifyAlert dstatus = sendNotification
=<< alertNotifier <$> atomically (readTMVar dstatus)
-
-{- Returns the alert's identifier, which can be used to remove it. -}
-addAlert :: DaemonStatusHandle -> Alert -> IO AlertId
-addAlert dstatus alert = notifyAlert dstatus `after` modifyDaemonStatus dstatus go
- where
- go s = (s { lastAlertId = i, alertMap = m }, i)
- where
- i = nextAlertId $ lastAlertId s
- m = mergeAlert i alert (alertMap s)
-
-removeAlert :: DaemonStatusHandle -> AlertId -> IO ()
-removeAlert dstatus i = updateAlert dstatus i (const Nothing)
-
-updateAlert :: DaemonStatusHandle -> AlertId -> (Alert -> Maybe Alert) -> IO ()
-updateAlert dstatus i a = updateAlertMap dstatus $ \m -> M.update a i m
-
-updateAlertMap :: DaemonStatusHandle -> (AlertMap -> AlertMap) -> IO ()
-updateAlertMap dstatus a = notifyAlert dstatus `after` modifyDaemonStatus_ dstatus go
- where
- go s = s { alertMap = a (alertMap s) }
-
-{- Displays an alert while performing an activity that returns True on
- - success.
- -
- - The alert is left visible afterwards, as filler.
- - Old filler is pruned, to prevent the map growing too large. -}
-alertWhile :: DaemonStatusHandle -> Alert -> IO Bool -> IO Bool
-alertWhile dstatus alert a = alertWhile' dstatus alert $ do
- r <- a
- return (r, r)
-
-{- Like alertWhile, but allows the activity to return a value too. -}
-alertWhile' :: DaemonStatusHandle -> Alert -> IO (Bool, a) -> IO a
-alertWhile' dstatus alert a = do
- let alert' = alert { alertClass = Activity }
- i <- addAlert dstatus alert'
- (ok, r) <- a
- updateAlertMap dstatus $ mergeAlert i $ makeAlertFiller ok alert'
- return r
-
-{- Displays an alert while performing an activity, then removes it. -}
-alertDuring :: DaemonStatusHandle -> Alert -> IO a -> IO a
-alertDuring dstatus alert a = do
- let alert' = alert { alertClass = Activity }
- i <- addAlert dstatus alert'
- removeAlert dstatus i `after` a