fix warning on !dbus

This commit is contained in:
Joey Hess 2014-04-02 18:09:27 -04:00
parent b98db5d6f1
commit a772b23c62

View file

@ -10,9 +10,9 @@
module Annex.Notification where module Annex.Notification where
import Common.Annex import Common.Annex
import qualified Annex
import Logs.Transfer import Logs.Transfer
#ifdef WITH_DBUS_NOTIFICATIONS #ifdef WITH_DBUS_NOTIFICATIONS
import qualified Annex
import Types.DesktopNotify import Types.DesktopNotify
import qualified DBus.Notify as Notify import qualified DBus.Notify as Notify
import qualified DBus.Client import qualified DBus.Client
@ -26,8 +26,8 @@ data NotifyWitness = NotifyWitness
- for it. -} - for it. -}
notifyTransfer :: Direction -> Maybe FilePath -> (NotifyWitness -> Annex Bool) -> Annex Bool notifyTransfer :: Direction -> Maybe FilePath -> (NotifyWitness -> Annex Bool) -> Annex Bool
notifyTransfer _ Nothing a = a NotifyWitness notifyTransfer _ Nothing a = a NotifyWitness
notifyTransfer direction (Just f) a = do
#ifdef WITH_DBUS_NOTIFICATIONS #ifdef WITH_DBUS_NOTIFICATIONS
notifyTransfer direction (Just f) a = do
wanted <- Annex.getState Annex.desktopnotify wanted <- Annex.getState Annex.desktopnotify
let action = if direction == Upload then "uploading" else "downloading" let action = if direction == Upload then "uploading" else "downloading"
let basedesc = action ++ " " ++ f let basedesc = action ++ " " ++ f
@ -49,13 +49,13 @@ notifyTransfer direction (Just f) a = do
return ok return ok
else a NotifyWitness else a NotifyWitness
#else #else
a NotifyWitness notifyTransfer _ (Just _) a = do a NotifyWitness
#endif #endif
notifyDrop :: Maybe FilePath -> Bool -> Annex () notifyDrop :: Maybe FilePath -> Bool -> Annex ()
notifyDrop Nothing _ = noop notifyDrop Nothing _ = noop
notifyDrop (Just f) ok = do
#ifdef WITH_DBUS_NOTIFICATIONS #ifdef WITH_DBUS_NOTIFICATIONS
notifyDrop (Just f) ok = do
wanted <- Annex.getState Annex.desktopnotify wanted <- Annex.getState Annex.desktopnotify
when (notifyFinish wanted) $ liftIO $ do when (notifyFinish wanted) $ liftIO $ do
client <- DBus.Client.connectSession client <- DBus.Client.connectSession
@ -64,7 +64,7 @@ notifyDrop (Just f) ok = do
else "failed to drop" ++ f else "failed to drop" ++ f
void $ Notify.notify client (mkNote msg) void $ Notify.notify client (mkNote msg)
#else #else
noop notifyDrop (Just _) _ = noop
#endif #endif
#ifdef WITH_DBUS_NOTIFICATIONS #ifdef WITH_DBUS_NOTIFICATIONS