diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-22 10:42:38 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-22 14:12:19 -0400 |
commit | 35419994e9418444dc82e5c90c579203cc4c3616 (patch) | |
tree | 0d4374fbc7f233cfa409e9e142b36f00d12f71f4 /Command/Get.hs | |
parent | f2a5858f85f1d6e999d707f4b48cd2ea643197bc (diff) |
add desktop notifications
Motivation: Hook scripts for nautilus or other file managers
need to provide the user with feedback that a file is being downloaded.
This commit was sponsored by THM Schoemaker.
Diffstat (limited to 'Command/Get.hs')
-rw-r--r-- | Command/Get.hs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Command/Get.hs b/Command/Get.hs index f436b15b5..bef466724 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -11,7 +11,7 @@ import Common.Annex import Command import qualified Remote import Annex.Content -import Logs.Transfer +import Annex.Transfer import Config.NumCopies import Annex.Wanted import qualified Command.Move @@ -69,15 +69,15 @@ getKeyFile' key afile dest = dispatch showNote "not available" showlocs return False - dispatch remotes = trycopy remotes remotes - trycopy full [] = do + dispatch remotes = notifyTransfer Download afile $ trycopy remotes remotes + trycopy full [] _ = do Remote.showTriedRemotes full showlocs return False - trycopy full (r:rs) = + trycopy full (r:rs) witness = ifM (probablyPresent r) - ( docopy r (trycopy full rs) - , trycopy full rs + ( docopy r witness <||> trycopy full rs witness + , trycopy full rs witness ) showlocs = Remote.showLocations key [] "No other repository is known to contain the file." @@ -87,8 +87,6 @@ getKeyFile' key afile dest = dispatch | Remote.hasKeyCheap r = either (const False) id <$> Remote.hasKey r key | otherwise = return True - docopy r continue = do - ok <- download (Remote.uuid r) key afile noRetry $ \p -> do - showAction $ "from " ++ Remote.name r - Remote.retrieveKeyFile r key afile dest p - if ok then return ok else continue + docopy r = download (Remote.uuid r) key afile noRetry $ \p -> do + showAction $ "from " ++ Remote.name r + Remote.retrieveKeyFile r key afile dest p |