From 89cd31ce1275bee6c8da8b3d9f4b00155a2e5fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Sun, 25 Aug 2013 19:55:17 -0300 Subject: Added a couple of hooks --- Screen.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Screen.hs') diff --git a/Screen.hs b/Screen.hs index 919585e..c8ef25a 100644 --- a/Screen.hs +++ b/Screen.hs @@ -34,9 +34,11 @@ liftUpdate = lift . lift entryPoint :: Lazymail () entryPoint = do st <- get - maildirs <- liftIO $ getMaildirsRecursively $ basePath st - let mdState = (maildirState st) { detectedMDs = maildirs } cfg <- ask + maildirs <- liftIO $ do + mds <- getMaildirsRecursively $ basePath st + (filterMaildirsHook cfg) mds + let mdState = (maildirState st) { detectedMDs = maildirs } liftIO $ runCurses $ runStateT (runReaderT startCurses cfg) (st { maildirState = mdState }) return () @@ -88,16 +90,18 @@ drawMaildirHelper :: [FilePath] -> LazymailUpdate () drawMaildirHelper [] = resetCurrentRow drawMaildirHelper (md:mds) = do st <- get + cfg <- ask + let ppMd = (maildirDrawHook cfg) (basePath st) md liftUpdate $ moveCursor (curRowAsInteger st) (colPadAsInteger st) if (selectedRow st == currentRow st) then do liftUpdate $ do setColor $ selectionColorID . colorStyle $ st - drawString $ normalizeLen (screenColumns st) md + drawString $ normalizeLen (screenColumns st) ppMd setColor $ baseColorID . colorStyle $ st let maildirState' = (maildirState st) { selectedMD = md } put $ st { maildirState = maildirState' } - else liftUpdate $ drawString $ normalizeLen (screenColumns st) md + else liftUpdate $ drawString $ normalizeLen (screenColumns st) ppMd st <- get let limit = if statusBar st then (screenRows st) - 1 else screenRows st -- cgit v1.2.3