packages feed

goatee-gtk 0.3.0 → 0.3.1

raw patch · 15 files changed

+87/−25 lines, 15 filesdep +glibdep ~cairodep ~filepathdep ~gtk

Dependencies added: glib

Dependency ranges changed: cairo, filepath, gtk

Files

goatee-gtk.cabal view
@@ -1,5 +1,5 @@ name: goatee-gtk-version: 0.3.0+version: 0.3.1 synopsis: A monadic take on a 2,500-year-old board game - GTK+ UI. category: Game license: AGPL-3@@ -29,11 +29,12 @@ library     build-depends:         base >= 4 && < 5,-        cairo >= 0.12 && < 0.13,+        cairo >= 0.13 && < 0.14,         containers >= 0.4 && < 0.6,         directory >= 1.1 && < 1.3,-        filepath >= 1.3 && < 1.4,-        gtk >= 0.12 && < 0.13,+        filepath >= 1.3 && < 1.5,+        glib >= 0.13 && < 0.14,+        gtk >= 0.13 && < 0.14,         goatee >= 0.3 && < 0.4,         mtl >= 2.1 && < 2.3,         parsec >= 3.1 && < 3.2@@ -74,7 +75,7 @@ executable goatee-gtk     build-depends:         base >= 4 && < 5,-        gtk >= 0.12 && < 0.13,+        gtk >= 0.13 && < 0.14,         goatee-gtk     ghc-options: -W -fwarn-incomplete-patterns -fwarn-unused-do-bind     hs-source-dirs: src-exe
src/Game/Goatee/Ui/Gtk.hs view
@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | The main module for the GTK+ UI, used by clients of the UI.  Also -- implements the UI controller. module Game.Goatee.Ui.Gtk (@@ -24,7 +26,9 @@   startFile,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>), Applicative)+#endif import Control.Concurrent.MVar (MVar, newMVar, takeMVar, readMVar, putMVar, modifyMVar, modifyMVar_) import Control.Exception (IOException, catch, finally) import Control.Monad (forM_, join, liftM, unless, void, when)@@ -78,6 +82,7 @@   ) import qualified Paths_goatee_gtk as Paths import System.Directory (doesFileExist)+import System.Glib (glibToString) import System.IO (hPutStrLn, stderr)  {-# ANN module "HLint: ignore Reduce duplication" #-}@@ -381,8 +386,8 @@     dialog <- fileChooserDialogNew (Just "Open a file")                                    Nothing                                    FileChooserActionOpen-                                   [(stockCancel, ResponseCancel),-                                    (stockOpen, ResponseOk)]+                                   [(glibToString stockCancel, ResponseCancel),+                                    (glibToString stockOpen, ResponseOk)]     mapM_ (fileChooserAddFilter dialog) =<< fileFiltersForSgf     response <- dialogRun dialog     widgetHide dialog@@ -434,8 +439,8 @@     dialog <- fileChooserDialogNew (Just "Save file as")                                    Nothing                                    FileChooserActionSave-                                   [(stockCancel, ResponseCancel),-                                    (stockSave, ResponseOk)]+                                   [(glibToString stockCancel, ResponseCancel),+                                    (glibToString stockSave, ResponseOk)]     mapM_ (fileChooserAddFilter dialog) =<< fileFiltersForSgf     response <- dialogRun dialog     finally
src/Game/Goatee/Ui/Gtk/Actions.hs view
@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | GTK+ 'Action' definitions. module Game.Goatee.Ui.Gtk.Actions (   Actions,@@ -46,7 +48,9 @@   myHelpAboutAction,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad (forM, unless, void, when) import qualified Data.Foldable as F import Data.IORef (IORef, newIORef, readIORef, writeIORef)@@ -90,6 +94,7 @@   widgetDestroy, widgetShowAll,   windowSetTitle,   )+import System.Glib (stringToGlib)  data Actions ui = Actions   { myUi :: ui@@ -314,8 +319,8 @@   toolActionList <- fmap catMaybes $ forM toolTypes $ \toolType -> do     AnyTool tool <- findTool ui toolType     return $ Just RadioActionEntry-      { radioActionName = show toolType-      , radioActionLabel = toolLabel tool+      { radioActionName = stringToGlib $ show toolType+      , radioActionLabel = stringToGlib $ toolLabel tool       , radioActionStockId = Nothing       , radioActionAccelerator = Nothing       , radioActionTooltip = Nothing
src/Game/Goatee/Ui/Gtk/Common.hs view
@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | Common dependencies among all GTK+ UI code.  Contains class definitions and -- some common data declarations. module Game.Goatee.Ui.Gtk.Common (@@ -56,7 +58,9 @@   toggle,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>), (<*>), pure)+#endif import Data.IORef (IORef, modifyIORef, newIORef, readIORef, writeIORef) import qualified Data.Set as Set import Data.Set (Set)
src/Game/Goatee/Ui/Gtk/GamePropertiesPanel.hs view
@@ -1,6 +1,6 @@ -- This file is part of Goatee. ----- Copyright 2014 Bryan Gardiner+-- Copyright 2014-2015 Bryan Gardiner -- -- Goatee is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published by@@ -179,7 +179,7 @@   mainTimeSpin <- goateeSpinButtonNewWithRange 0 3155692600 {- 100 years -} 1   let mainTimeSpinWidget = goateeSpinButtonWidget mainTimeSpin   spinButtonSetDigits mainTimeSpinWidget 1-  mainTimeLabel <- labelNew Nothing+  mainTimeLabel <- labelNew (Nothing :: Maybe String)   boxPackStart mainTimeBox mainTimeSpinWidget PackGrow 0   boxPackStart mainTimeBox mainTimeLabel PackNatural 0   addWidget "Time" mainTimeBox
src/Game/Goatee/Ui/Gtk/Goban.hs view
@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | A widget that renders an interactive Go board. module Game.Goatee.Ui.Gtk.Goban (   Goban,@@ -23,7 +25,9 @@   myWidget,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad ((<=<), liftM, unless, void, when) import qualified Data.Foldable as F import Data.IORef (IORef, newIORef, readIORef, writeIORef)@@ -95,6 +99,7 @@   widgetAddEvents, widgetGetDrawWindow, widgetGetSize, widgetGrabFocus, widgetQueueDraw,   widgetSetCanFocus,   )+import System.Glib (glibToString)  {-# ANN module "HLint: ignore Use camelCase" #-} @@ -257,7 +262,7 @@     return True    on drawingArea keyPressEvent $ do-    key <- eventKeyName+    key <- glibToString <$> eventKeyName     mods <- eventModifier     let km = (key, mods)     let maybeAction = Map.lookup key keyNavActions
src/Game/Goatee/Ui/Gtk/InfoLine.hs view
@@ -1,6 +1,6 @@ -- This file is part of Goatee. ----- Copyright 2014 Bryan Gardiner+-- Copyright 2014-2015 Bryan Gardiner -- -- Goatee is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published by@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | A text widget that displays information about the game, including some -- overall information, as well as the current board position. module Game.Goatee.Ui.Gtk.InfoLine (@@ -24,7 +26,9 @@   myWidget,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Data.Maybe (fromMaybe) import Game.Goatee.Lib.Board import Game.Goatee.Lib.Monad@@ -47,7 +51,7 @@  create :: UiCtrl go ui => ui -> IO (InfoLine ui) create ui = do-  label <- labelNew Nothing+  label <- labelNew (Nothing :: Maybe String)   state <- viewStateNew    let me = InfoLine { myUi = ui
src/Game/Goatee/Ui/Gtk/MainWindow.hs view
@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | Implementation of the main window that contains the game board. module Game.Goatee.Ui.Gtk.MainWindow (   MainWindow,@@ -24,7 +26,9 @@   myWindow,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad (forM, forM_, join, liftM) import Control.Monad.Trans (liftIO) import qualified Data.Foldable as F@@ -68,6 +72,7 @@   widgetDestroy, widgetGrabFocus, widgetShowAll,   windowNew, windowSetDefaultSize, windowSetTitle,   )+import System.Glib (glibToString)  data MainWindow ui = MainWindow   { myUi :: ui@@ -255,7 +260,7 @@   initialize me    on window keyPressEvent $ do-    key <- eventKeyName+    key <- glibToString <$> eventKeyName     mods <- eventModifier     let km = (key, mods)     case km of
src/Game/Goatee/Ui/Gtk/NodePropertiesPanel.hs view
@@ -1,6 +1,6 @@ -- This file is part of Goatee. ----- Copyright 2014 Bryan Gardiner+-- Copyright 2014-2015 Bryan Gardiner -- -- Goatee is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published by@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | A list widget that displays the current node's properties for viewing and editing. module Game.Goatee.Ui.Gtk.NodePropertiesPanel (   NodePropertiesPanel,@@ -24,7 +26,9 @@   ) where  import Control.Arrow ((+++))+#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>), (<*), (*>))+#endif import Control.Monad (forM_, unless, when) import qualified Data.Foldable as Foldable import Data.IORef (IORef, newIORef, readIORef, writeIORef)@@ -70,6 +74,7 @@   widgetDestroy, widgetSetSensitive, widgetShowAll,   windowSetDefaultSize, windowSetTitle,   )+import System.Glib (glibToString) import Text.ParserCombinators.Parsec (eof, parse, spaces)  data NodePropertiesPanel ui = NodePropertiesPanel@@ -129,7 +134,7 @@                                }    on addButton buttonActivated $ do-    maybeProperty <- runPropertyEditDialog "Add property" stockAdd Nothing+    maybeProperty <- runPropertyEditDialog "Add property" (glibToString stockAdd) Nothing     Foldable.forM_ maybeProperty $ doUiGo ui . putProperty    on editButton buttonActivated $ do@@ -138,7 +143,8 @@       [] -> return ()       row:_ -> do         oldProperty <- (!! row) <$> readIORef modelProperties-        maybeNewProperty <- runPropertyEditDialog "Edit property" stockEdit $ Just oldProperty+        maybeNewProperty <- runPropertyEditDialog "Edit property" (glibToString stockEdit) $+                            Just oldProperty         case maybeNewProperty of           Nothing -> return ()           Just newProperty -> doUiGo ui $ do@@ -202,7 +208,7 @@   boxPackStart upper textScroll PackGrow 0   textBuffer <- textViewGetBuffer textView -  errorLabel <- labelNew Nothing+  errorLabel <- labelNew (Nothing :: Maybe String)   boxPackStart upper errorLabel PackNatural 0    dialogAddButton dialog stockCancel ResponseCancel
src/Game/Goatee/Ui/Gtk/PlayPanel.hs view
@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ module Game.Goatee.Ui.Gtk.PlayPanel (   PlayPanel,   create,@@ -22,7 +24,9 @@   myWidget,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad (forM, void, when) import Data.Foldable (forM_, mapM_) import Data.IORef (IORef, newIORef, readIORef, writeIORef)
src/Game/Goatee/Ui/Gtk/Tool/AssignStone.hs view
@@ -15,9 +15,13 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ module Game.Goatee.Ui.Gtk.Tool.AssignStone (AssignStoneTool, create) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad (forM_, when) import Game.Goatee.Lib.Board import qualified Game.Goatee.Lib.Monad as Monad
src/Game/Goatee/Ui/Gtk/Tool/Play.hs view
@@ -1,6 +1,6 @@ -- This file is part of Goatee. ----- Copyright 2014 Bryan Gardiner+-- Copyright 2014-2015 Bryan Gardiner -- -- Goatee is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published by@@ -15,9 +15,13 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ module Game.Goatee.Ui.Gtk.Tool.Play (PlayTool, create) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad (when) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.Maybe (fromJust, isJust)
src/Game/Goatee/Ui/Gtk/Tool/Visibility.hs view
@@ -15,9 +15,16 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ module Game.Goatee.Ui.Gtk.Tool.Visibility (VisibilityTool, create) where -import Control.Applicative ((<$>), (<|>))+import Control.Applicative (+#if !MIN_VERSION_base(4,8,0)+  (<$>),+#endif+  (<|>),+  ) import Control.Monad (void, when) import Data.Foldable (forM_) import Data.List (intercalate)
src/Game/Goatee/Ui/Gtk/Utils.hs view
@@ -1,6 +1,6 @@ -- This file is part of Goatee. ----- Copyright 2014 Bryan Gardiner+-- Copyright 2014-2015 Bryan Gardiner -- -- Goatee is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published by@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | General GTK utilities that don't exist in the Gtk2Hs. module Game.Goatee.Ui.Gtk.Utils (   onEntryChange,@@ -22,7 +24,9 @@   textViewConfigure   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>))+#endif import Control.Monad (void, when) import qualified Game.Goatee.Common.Bigfloat as BF import Game.Goatee.Ui.Gtk.Latch
src/Game/Goatee/Ui/Gtk/Widget.hs view
@@ -1,6 +1,6 @@ -- This file is part of Goatee. ----- Copyright 2014 Bryan Gardiner+-- Copyright 2014-2015 Bryan Gardiner -- -- Goatee is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published by@@ -15,6 +15,8 @@ -- You should have received a copy of the GNU Affero General Public License -- along with Goatee.  If not, see <http://www.gnu.org/licenses/>. +{-# LANGUAGE CPP #-}+ -- | Provides wrappers around regular GTK+ widgets, adding support for assigning -- to widget values without firing signal handlers. module Game.Goatee.Ui.Gtk.Widget (@@ -26,7 +28,9 @@   goateeSpinButtonSetValue, goateeSpinButtonOnSpinned,   ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>), (<*>))+#endif import Control.Monad (void) import qualified Game.Goatee.Common.Bigfloat as BF import Game.Goatee.Ui.Gtk.Latch