summaryrefslogtreecommitdiff
path: root/Command/Get.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-22 10:42:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-22 14:12:19 -0400
commit35419994e9418444dc82e5c90c579203cc4c3616 (patch)
tree0d4374fbc7f233cfa409e9e142b36f00d12f71f4 /Command/Get.hs
parentf2a5858f85f1d6e999d707f4b48cd2ea643197bc (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.hs20
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