Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
Restored download notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
koral committed May 19, 2014
1 parent 615f63d commit ec526f9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
11 changes: 6 additions & 5 deletions Hbro/Boot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ getUIFile = do
isReadable ? return (Just x) ?? firstReadableOf y



withIPC :: (MonadBaseControl IO m) => CliOptions -> (IPC -> m a) -> m a
withIPC options f = restoreM =<< (liftBaseWith $ \runInIO -> do
ZMQ.withContext $ \c -> do
Expand Down Expand Up @@ -233,17 +232,19 @@ bindNewWebView webView = do
return webView'


bindDownload :: (MonadBase IO m, MonadBaseControl IO m, ConfigReader m m, MonadError HError m) => WebView -> m ()
bindDownload :: (MonadBase IO m, MonadBaseControl IO m, ConfigReader m m, NotificationReader m, MonadError HError m) => WebView -> m ()
bindDownload webView = do
void . liftBaseWith $ \runInIO -> on webView W.downloadRequested $ \d -> do
amount <- W.downloadGetTotalSize d

--notify 5000 $ "Requested download: " ++ filename ++ " (" ++ show size ++ ")"
void . runInIO $ do
uri <- downloadGetUri d
filename <- downloadGetSuggestedFilename d
callback <- readConfig onDownload
logV $ "Requested download <" ++ show uri ++ ">"

logV $ "Requested download <" ++ show uri ++ ">"
notify 5000 $ "Requested download: " ++ filename ++ " (" ++ show amount ++ ")"

callback uri filename amount
return False

Expand Down Expand Up @@ -339,7 +340,7 @@ bindKeys = do
case (Key.lookup allStrokes =<< M.lookup theMode theBindings) of
Just (Key.Leaf callback) -> Key.writeStatus Key.strokes [] >> callback `catchError` \e -> (io $ print e) >> notify 5000 (show e)
Just (Key.Branch _) -> Key.writeStatus Key.strokes allStrokes
_ -> return () --}
_ -> return ()
return ()
_ -> return ()
return False
1 change: 1 addition & 0 deletions Hbro/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import Data.Default
-- import Data.Foldable
-- import Data.Functor
import Data.IORef
import Data.Maybe
import qualified Data.Map as M

import Graphics.UI.Gtk.Gdk.EventM
Expand Down
4 changes: 2 additions & 2 deletions Hbro/Gui.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ init = do
Prompt.init =<< readGUI promptBar
WebView.init w

io $ windowSetDefault mw (Just w)
io . windowSetDefault mw $ Just w

-- Validate/cancel prompt
e <- readGUI (promptBar.(Prompt.entry))
e <- readGUI $ promptBar.(Prompt.entry)
io . void $ on e keyPressEvent (f w)

-- Show window
Expand Down
1 change: 0 additions & 1 deletion Hbro/Prompt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ init promptBar = do

void . onEntryChanged entry' $ \v -> io (readIORef onChanged') >>= \f -> f v
void . onEntryValidated entry' $ \v -> io (readIORef onValidated') >>= \f -> f v
return ()
where
l = _description promptBar
entry' = _entry promptBar
Expand Down
1 change: 0 additions & 1 deletion Hbro/Webkit/WebView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Hbro.Webkit.WebView where
-- {{{ Imports
import Hbro.Error
import Hbro.Network
--import Hbro.Types
import Hbro.Util

import Control.Monad.Base
Expand Down

0 comments on commit ec526f9

Please sign in to comment.