manatee-ircclient 0.0.7 → 0.0.8
raw patch · 2 files changed
+26/−21 lines, 2 filesdep ~manatee-core
Dependency ranges changed: manatee-core
Files
Manatee/Extension/IrcClient/IrcView.hs view
@@ -32,6 +32,7 @@ import Graphics.UI.Gtk.SourceView import Language.Translate.Google import Manatee.Core.DBus+import Manatee.Core.PageFrame import Manatee.Core.PageView import Manatee.Core.Types import Manatee.Extension.IrcClient.DBus@@ -48,7 +49,6 @@ import Manatee.Toolkit.Gtk.Concurrent import Manatee.Toolkit.Gtk.Gtk import Manatee.Toolkit.Gtk.Multiline-import Manatee.Toolkit.Gtk.ScrolledWindow import Network.FastIRC.Messages import Paths_manatee_ircclient import System.FilePath@@ -61,7 +61,7 @@ data IrcView = IrcView {ircViewPlugId :: TVar PagePlugId- ,ircViewScrolledWindow :: ScrolledWindow+ ,ircViewFrame :: PageFrame ,ircViewView :: SourceView ,ircViewBuffer :: IrcBuffer ,ircViewBroadcastChannel :: ViewChannel IrcBufferSignal@@ -79,11 +79,12 @@ instance PageView IrcView where pageViewBuffer = PageBufferWrap . ircViewBuffer pageViewPlugId = ircViewPlugId+ pageViewBox = pageFrameBox . ircViewFrame+ pageViewScrolledWindow = ircViewScrolledWindow pageViewFocus = widgetGrabFocus . ircViewView pageViewCut = ircViewCut pageViewCopy = ircViewCopy pageViewPaste = ircViewPaste- pageViewScrolledWindow = ircViewScrolledWindow pageViewHandleKeyAction = ircViewHandleKeyAction pageViewScrollToTop = ircViewScrollToTop pageViewScrollToBottom = ircViewScrollToBottom@@ -97,18 +98,18 @@ pId <- newTVarIO plugId -- Create UI frame.- scrolledWindow <- scrolledWindowNew_+ pFrame <- pageFrameNewWithModeName (pageModeName $ ircBufferMode sb) -- Create source view. ircView <- sourceViewNewWithBuffer (ircBufferBuffer sb)- scrolledWindow `containerAdd` ircView+ pageFrameAddChild pFrame ircView forM_ [StateNormal, StateActive, StatePrelight, StateSelected, StateInsensitive] $ \state -> widgetModifyBg ircView state (nickColorToColor backgroundColor) -- Broadcast channel. channel <- createViewChannel (ircBufferBroadcastChannel sb) ircView - let sv = IrcView pId scrolledWindow ircView sb channel+ let sv = IrcView pId pFrame ircView sb channel -- Customize setup. sourceViewSetHighlightCurrentLine ircView True -- highlight current line.@@ -157,7 +158,7 @@ SwitchTranslateLanguage -> do -- Update language status lang <- readTVarIO $ ircBufferTranslateLanguage $ ircViewBuffer view- pageViewUpdateInfoStatus view "Translate" ("Translate to (" ++ show lang ++ ")")+ pageFrameUpdateStatusbar (ircViewFrame view) "Translate" ("Translate to (" ++ show lang ++ ")") BufferChanged -> do -- Scroll screen if prompt mark at left of insert mark. -- Otherwise don't screen, because user screen download to read old messages.@@ -245,7 +246,7 @@ if isBlankString text -- Avoid send blank string, server will ignore blank message.- then pageViewUpdateOutputStatus view "Ignored blank ..." Nothing+ then pageFrameShowOutputbar (ircViewFrame view) "Ignored blank ..." Nothing -- Otherwise send message to server. else ircViewSend view (UTF8.fromString $ encodeMorse text) @@ -266,25 +267,25 @@ if isBlankByteString text -- Avoid send blank string, server will ignore blank message.- then pageViewUpdateOutputStatus view "Ignored blank ..." Nothing+ then pageFrameShowOutputbar (ircViewFrame view) "Ignored blank ..." Nothing -- Otherwise send message to server. else if isTranslate -- Try get translation. then forkGuiIO_ (do- pageViewUpdateOutputStatus view "Translation ..." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Translation ..." Nothing lang <- readTVarIO $ ircBufferTranslateLanguage buffer translate text Nothing lang) $ \result -> case result of -- Send original message if translate failed. Left _ -> do- pageViewUpdateOutputStatus view "Get translation failed, send original message." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Get translation failed, send original message." Nothing ircViewSend view text -- Otherwise send translation. Right translation -> do- pageViewUpdateOutputStatus view "Translation ... completed." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Translation ... completed." Nothing ircViewSend view translation -- Send original message. else ircViewSend view text@@ -297,7 +298,7 @@ ircViewWrapDeleteAction :: IrcView -> IO Bool -> IO () ircViewWrapDeleteAction view action = unlessM action $ - pageViewUpdateOutputStatus view "Can't delete uneditable area." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Can't delete uneditable area." Nothing -- | Delete lines. ircViewDelLines :: IrcView -> IO ()@@ -409,8 +410,8 @@ ircViewToggleSelectionMark :: IrcView -> IO () ircViewToggleSelectionMark view = ifM (textViewToggleSelectionMark $ ircViewView view)- (pageViewUpdateInfoStatus view "Selection" "Selection (Active)")- (pageViewUpdateInfoStatus view "Selection" "Selection (Inactive)")+ (pageFrameUpdateStatusbar (ircViewFrame view) "Selection" "Selection (Active)")+ (pageFrameUpdateStatusbar (ircViewFrame view) "Selection" "Selection (Inactive)") -- | Exchange selection mark. ircViewExchangeSelectionMark :: IrcView -> IO ()@@ -493,7 +494,7 @@ textBufferGetTagByteStringWithIter buffer iter messageTag >?>= \ text -> forkGuiIO_ (do- pageViewUpdateOutputStatus view "Fetch translation ..." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Fetch translation ..." Nothing -- Translate reverse. :) lang <- readTVarIO language let customize = ircBufferCustomize ircBuffer@@ -505,9 +506,9 @@ $ \result -> case result of Left _ -> - pageViewUpdateOutputStatus view "Fetch translation ... failed." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Fetch translation ... failed." Nothing Right translation -> do- pageViewUpdateOutputStatus view "Fetch translation ... completed." Nothing+ pageFrameShowOutputbar (ircViewFrame view) "Fetch translation ... completed." Nothing -- Get rectangle around cursor. point <- ircViewGetTooltipPoint view -- Show translation with tooltip.@@ -553,7 +554,7 @@ ircViewReadText view text = execute "festival" ("echo " ++ show text ++ " | %s --tts") True >?>= \ failedReason ->- pageViewUpdateOutputStatus view failedReason Nothing+ pageFrameShowOutputbar (ircViewFrame view) failedReason Nothing -- | Get tooltip coordinate. ircViewGetTooltipPoint :: IrcView -> IO Point@@ -563,6 +564,10 @@ (wx, wy) <- textViewBufferToWindowCoords textView TextWindowWidget (x, y) return (wx + width, wy + height) +-- | Scrolled window.+ircViewScrolledWindow :: IrcView -> ScrolledWindow +ircViewScrolledWindow =+ pageFrameScrolledWindow . ircViewFrame -- | Keymap. ircViewKeymap :: Map Text (IrcView -> IO ())
manatee-ircclient.cabal view
@@ -1,5 +1,5 @@ name: manatee-ircclient-version: 0.0.7+version: 0.0.8 Cabal-Version: >= 1.6 license: GPL-3 license-file: LICENSE@@ -53,7 +53,7 @@ location: http://patch-tag.com/r/AndyStewart/manatee-ircclient Library- build-depends: base >= 4 && < 5, manatee-core >= 0.0.7, dbus-client >= 0.3 && < 0.4, stm >= 2.1.2.0,+ build-depends: base >= 4 && < 5, manatee-core >= 0.0.8, dbus-client >= 0.3 && < 0.4, stm >= 2.1.2.0, containers >= 0.3.0.0, gtk-serialized-event >= 0.12.0, gtk >= 0.12.0, text >= 0.7.1.0, bytestring >= 0.9.1.5, dbus-core, template-haskell, gtksourceview2 >= 0.12.0, unix >= 2.4.0.0,