improve display of failed transfer alert

This commit is contained in:
Joey Hess 2012-08-27 13:52:48 -04:00
parent 2433f6ca5a
commit 11c1f32c51
2 changed files with 8 additions and 5 deletions

View file

@ -260,10 +260,13 @@ addFileAlert :: FilePath -> Alert
addFileAlert = fileAlert (Tensed "Adding" "Added") addFileAlert = fileAlert (Tensed "Adding" "Added")
{- This is only used as a success alert after a transfer, not during it. -} {- This is only used as a success alert after a transfer, not during it. -}
transferFileAlert :: Direction -> FilePath -> Alert transferFileAlert :: Direction -> Bool -> FilePath -> Alert
transferFileAlert direction transferFileAlert direction True
| direction == Upload = fileAlert "Uploaded" | direction == Upload = fileAlert "Uploaded"
| otherwise = fileAlert "Downloaded" | otherwise = fileAlert "Downloaded"
transferFileAlert direction False
| direction == Upload = fileAlert "Upload failed"
| otherwise = fileAlert "Download failed"
dataCombiner :: ([TenseChunk] -> [TenseChunk] -> [TenseChunk]) -> AlertCombiner dataCombiner :: ([TenseChunk] -> [TenseChunk] -> [TenseChunk]) -> AlertCombiner
dataCombiner combiner new old dataCombiner combiner new old

View file

@ -96,10 +96,10 @@ transferThread dstatus slots t info runner program = case (transferRemote info,
(_, _, _, pid) (_, _, _, pid)
<- createProcess (proc program $ toCommand params) <- createProcess (proc program $ toCommand params)
{ create_group = True } { create_group = True }
status <- waitForProcess pid ok <- (==) ExitSuccess <$> waitForProcess pid
addAlert dstatus $ addAlert dstatus $
makeAlertFiller (status == ExitSuccess) $ makeAlertFiller ok $
transferFileAlert direction file transferFileAlert direction ok file
where where
params = params =
[ Param "transferkey" [ Param "transferkey"