show paused remotes in cost order, not at end of repo list

This commit is contained in:
Joey Hess 2013-03-14 13:33:30 -04:00
parent 99dc302d06
commit a336a7fc1b
2 changed files with 10 additions and 10 deletions

View file

@ -43,7 +43,6 @@ modifyDaemonStatus a = do
sendNotification $ changeNotifier s sendNotification $ changeNotifier s
return b return b
{- Returns a function that updates the lists of syncable remotes. -} {- Returns a function that updates the lists of syncable remotes. -}
calcSyncRemotes :: Annex (DaemonStatus -> DaemonStatus) calcSyncRemotes :: Annex (DaemonStatus -> DaemonStatus)
calcSyncRemotes = do calcSyncRemotes = do

View file

@ -27,6 +27,7 @@ import qualified Git
#endif #endif
import qualified Data.Map as M import qualified Data.Map as M
import qualified Data.Set as S
import qualified Data.Text as T import qualified Data.Text as T
{- An intro message, list of repositories, and nudge to make more. -} {- An intro message, list of repositories, and nudge to make more. -}
@ -125,14 +126,18 @@ type RepoList = [(String, String, (UUID, Actions))]
repoList :: RepoSelector -> Handler RepoList repoList :: RepoSelector -> Handler RepoList
repoList reposelector repoList reposelector
| onlyConfigured reposelector = list =<< configured | onlyConfigured reposelector = list =<< configured
| otherwise = list =<< (++) <$> configured <*> rest | otherwise = list =<< (++) <$> configured <*> unconfigured
where where
configured = do configured = do
rs <- filter wantedrepo . syncRemotes syncing <- S.fromList . syncRemotes
<$> liftAssistant getDaemonStatus <$> liftAssistant getDaemonStatus
liftAnnex $ do liftAnnex $ do
rs <- filter wantedrepo <$> Remote.enabledRemoteList
let us = map Remote.uuid rs let us = map Remote.uuid rs
let l = zip us $ map mkSyncingRepoActions us let make r = if r `S.member` syncing
then mkSyncingRepoActions $ Remote.uuid r
else mkNotSyncingRepoActions $ Remote.uuid r
let l = zip us $ map make rs
if includeHere reposelector if includeHere reposelector
then do then do
u <- getUUID u <- getUUID
@ -143,15 +148,11 @@ repoList reposelector
let here = (u, hereactions) let here = (u, hereactions)
return $ here : l return $ here : l
else return l else return l
rest = liftAnnex $ do unconfigured = liftAnnex $ do
m <- readRemoteLog m <- readRemoteLog
unconfigured <- map snd . catMaybes . filter wantedremote map snd . catMaybes . filter wantedremote
. map (findinfo m) . map (findinfo m)
<$> (trustExclude DeadTrusted $ M.keys m) <$> (trustExclude DeadTrusted $ M.keys m)
unsyncable <- map Remote.uuid . filter wantedrepo .
filter (not . remoteAnnexSync . Remote.gitconfig)
<$> Remote.enabledRemoteList
return $ zip unsyncable (map mkNotSyncingRepoActions unsyncable) ++ unconfigured
wantedrepo r wantedrepo r
| Remote.readonly r = False | Remote.readonly r = False
| onlyCloud reposelector = Git.repoIsUrl (Remote.repo r) && not (isXMPPRemote r) | onlyCloud reposelector = Git.repoIsUrl (Remote.repo r) && not (isXMPPRemote r)