awesome alert combining

Now an alert tracks files that have recently been added. As a large file
is added, it will have its own alert, that then combines with the tracker
when dones.

Also used for combining sanity checker alerts, as it could possibly want to
display a lot.
This commit is contained in:
Joey Hess 2012-08-02 09:03:04 -04:00
parent 3695cab949
commit 191ee3b697
2 changed files with 72 additions and 16 deletions

View file

@ -10,6 +10,7 @@ module Assistant.Threads.Committer where
import Assistant.Common
import Assistant.Changes
import Assistant.Commits
import Assistant.Alert
import Assistant.ThreadedMonad
import Assistant.Threads.Watcher
import Assistant.TransferQueue
@ -143,15 +144,16 @@ handleAdds st changechan transferqueue dstatus cs = returnWhen (null pendingadds
add :: Change -> IO (Maybe Change)
add change@(PendingAddChange { keySource = ks }) =
liftM maybeMaybe $ catchMaybeIO $
sanitycheck ks $ runThreadState st $ do
showStart "add" $ keyFilename ks
key <- Command.Add.ingest ks
handle (finishedChange change) (keyFilename ks) key
alertWhile' dstatus (addFileAlert $ keyFilename ks) $
liftM maybeMaybe $ catchMaybeIO $
sanitycheck ks $ runThreadState st $ do
showStart "add" $ keyFilename ks
key <- Command.Add.ingest ks
handle (finishedChange change) (keyFilename ks) key
add _ = return Nothing
maybeMaybe (Just j@(Just _)) = j
maybeMaybe _ = Nothing
maybeMaybe (Just j@(Just _)) = (True, j)
maybeMaybe _ = (False, Nothing)
handle _ _ Nothing = do
showEndFail