summaryrefslogtreecommitdiff
path: root/Assistant/DaemonStatus.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-09 16:24:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-09 16:24:34 -0400
commit16cefae7f276e12c20e203729aad23cfd90f0ec3 (patch)
tree24291391d3a9affc1f987f7b200c3c8fb0a49961 /Assistant/DaemonStatus.hs
parentded85175455bf355753ea26263898487c2162ab5 (diff)
add an alert while a locally initiated pairing request is in progress
Has a button to cancel the request.
Diffstat (limited to 'Assistant/DaemonStatus.hs')
-rw-r--r--Assistant/DaemonStatus.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs
index b9c7599f9..cbd606680 100644
--- a/Assistant/DaemonStatus.hs
+++ b/Assistant/DaemonStatus.hs
@@ -41,8 +41,8 @@ data DaemonStatus = DaemonStatus
, lastAlertId :: AlertId
-- Ordered list of remotes to talk to.
, knownRemotes :: [Remote]
- -- Pairing requests that are in progress.
- , pairingInProgress :: [PairingInProgress]
+ -- Pairing request that is in progress.
+ , pairingInProgress :: Maybe PairingInProgress
-- Broadcasts notifications about all changes to the DaemonStatus
, changeNotifier :: NotificationBroadcaster
-- Broadcasts notifications when queued or current transfers change.
@@ -66,7 +66,7 @@ newDaemonStatus = DaemonStatus
<*> pure M.empty
<*> pure firstAlertId
<*> pure []
- <*> pure []
+ <*> pure Nothing
<*> newNotificationBroadcaster
<*> newNotificationBroadcaster
<*> newNotificationBroadcaster
@@ -260,3 +260,10 @@ alertWhile' dstatus alert a = do
(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