coin 1.1 → 1.1.1
raw patch · 10 files changed
+129/−80 lines, 10 files
Files
- coin.cabal +3/−1
- src/Coin/Config/Version.hs +34/−0
- src/Coin/UI/Options/OptionsAccount.hs +3/−2
- src/Coin/UI/Options/OptionsTag.hs +3/−2
- src/Coin/UI/Utils/CssUtils.hs +69/−66
- src/Coin/UI/Widgets/Calendar.hs +6/−3
- src/Coin/UI/Widgets/MessageBox.hs +2/−1
- src/Coin/UI/Widgets/MiniCalendar.hs +4/−3
- src/Coin/UI/Widgets/MultiList.hs +3/−1
- src/Coin/UI/Widgets/ResponseButtons.hs +2/−1
coin.cabal view
@@ -1,5 +1,5 @@ name: coin-version: 1.1+version: 1.1.1 Build-Type: Simple cabal-version: >= 1.16 author: Piotr Borek <piotrborek@op.pl>@@ -50,6 +50,7 @@ lens, aeson, bytestring+ pkgconfig-depends: gtk+-3.0 if flag(debug-db) cpp-options: -DDEBUG_DB if os(windows)@@ -92,6 +93,7 @@ Coin.UI.AccountsComboBox Coin.UI.MainMultiList Coin.Config.Dirs+ Coin.Config.Version Coin.DB.Tables Coin.DB.Functions Coin.Utils.ValueParser
+ src/Coin/Config/Version.hs view
@@ -0,0 +1,34 @@+{-+ * Programmer: Piotr Borek+ * E-mail: piotrborek@op.pl+ * Copyright 2016 Piotr Borek+ *+ * Distributed under the terms of the GPL (GNU Public License)+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation; either version 2 of the License, or+ * (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+-}++{-#LANGUAGE ForeignFunctionInterface #-}++module Coin.Config.Version (+ gtkVersionOld+) where++import Data.Word++foreign import ccall "gtk_get_minor_version" gtkGetMinorVersion :: Word32++gtkVersionOld :: Bool+gtkVersionOld = gtkGetMinorVersion < 20
src/Coin/UI/Options/OptionsAccount.hs view
@@ -44,6 +44,7 @@ import Coin.UI.Builder.GtkUIBuilder import Coin.UI.Utils.CssUtils import Coin.UI.MainState+import Coin.Config.Version data OptionsAccountWidget = OptionsAccountWidget { optionsAccountRoot :: Gtk.VBox,@@ -62,11 +63,11 @@ [ "* {" , " transition: 200ms ease-in-out;" , "}"- , "button {"+ , if gtkVersionOld then ".button {" else "button {" , " border-width: 1px;" , " padding: 5px;" , "}"- , "button:hover {"+ , if gtkVersionOld then ".button:hover {" else "button:hover {" , " border-color: rgba(40, 40, 40, 0.5);" , "}" ]
src/Coin/UI/Options/OptionsTag.hs view
@@ -43,6 +43,7 @@ import Coin.UI.Builder.GtkUIBuilder import Coin.UI.Utils.CssUtils import Coin.UI.MainState+import Coin.Config.Version data OptionsTagWidget = OptionsTagWidget { widgetContainer :: Gtk.VBox@@ -60,11 +61,11 @@ [ "* {" , " transition: 200ms ease-in-out;" , "}"- , "button {"+ , if gtkVersionOld then ".button {" else "button {" , " border-width: 1px;" , " padding: 5px;" , "}"- , "button:hover {"+ , if gtkVersionOld then ".button:hover {" else "button:hover {" , " border-color: rgba(40, 40, 40, 0.5);" , "}" ]
src/Coin/UI/Utils/CssUtils.hs view
@@ -37,6 +37,8 @@ import Control.Exception +import Coin.Config.Version+ gtkStyleProviderPriorityTheme :: Int gtkStyleProviderPriorityTheme = 200 @@ -75,69 +77,70 @@ ) cssStyleReset :: String-cssStyleReset = unlines- {- Gtk-3.20 -}- [ "* {"- , " all: unset;"- , "}"- ]- {- Gtk-3.18- [ "* {"- , " color: inherit;"- , " font-size: inherit;"- , " background-color: initial;"- , " font-family: inherit;"- , " font-style: inherit;"- , " font-variant: inherit;"- , " font-weight: inherit;"- , " text-shadow: inherit;"- , " icon-shadow: inherit;"- , " box-shadow: initial;"- , " margin-top: initial;"- , " margin-left: initial;"- , " margin-bottom: initial;"- , " margin-right: initial;"- , " padding-top: initial;"- , " padding-left: initial;"- , " padding-bottom: initial;"- , " padding-right: initial;"- , " border-top-style: initial;"- , " border-top-width: initial;"- , " border-left-style: initial;"- , " border-left-width: initial;"- , " border-bottom-style: initial;"- , " border-bottom-width: initial;"- , " border-right-style: initial;"- , " border-right-width: initial;"- , " border-top-left-radius: initial;"- , " border-top-right-radius: initial;"- , " border-bottom-right-radius: initial;"- , " border-bottom-left-radius: initial;"- , " outline-style: initial;"- , " outline-width: initial;"- , " outline-offset: initial;"- , " background-clip: initial;"- , " background-origin: initial;"- , " background-size: initial;"- , " background-position: initial;"- , " border-top-color: initial;"- , " border-right-color: initial;"- , " border-bottom-color: initial;"- , " border-left-color: initial;"- , " outline-color: initial;"- , " background-repeat: initial;"- , " background-image: initial;"- , " border-image-source: initial;"- , " border-image-repeat: initial;"- , " border-image-slice: initial;"- , " border-image-width: initial;"- , " transition-property: initial;"- , " transition-duration: initial;"- , " transition-timing-function: initial;"- , " transition-delay: initial;"- , " engine: initial;"- , " gtk-key-bindings: initial;"- , " -GtkNotebook-initial-gap: 0;"- , "}"- ]- -}+cssStyleReset = unlines $+ if gtkVersionOld then+ {- Gtk-3.18 -}+ [ "* {"+ , " color: inherit;"+ , " font-size: inherit;"+ , " background-color: initial;"+ , " font-family: inherit;"+ , " font-style: inherit;"+ , " font-variant: inherit;"+ , " font-weight: inherit;"+ , " text-shadow: inherit;"+ , " icon-shadow: inherit;"+ , " box-shadow: initial;"+ , " margin-top: initial;"+ , " margin-left: initial;"+ , " margin-bottom: initial;"+ , " margin-right: initial;"+ , " padding-top: initial;"+ , " padding-left: initial;"+ , " padding-bottom: initial;"+ , " padding-right: initial;"+ , " border-top-style: initial;"+ , " border-top-width: initial;"+ , " border-left-style: initial;"+ , " border-left-width: initial;"+ , " border-bottom-style: initial;"+ , " border-bottom-width: initial;"+ , " border-right-style: initial;"+ , " border-right-width: initial;"+ , " border-top-left-radius: initial;"+ , " border-top-right-radius: initial;"+ , " border-bottom-right-radius: initial;"+ , " border-bottom-left-radius: initial;"+ , " outline-style: initial;"+ , " outline-width: initial;"+ , " outline-offset: initial;"+ , " background-clip: initial;"+ , " background-origin: initial;"+ , " background-size: initial;"+ , " background-position: initial;"+ , " border-top-color: initial;"+ , " border-right-color: initial;"+ , " border-bottom-color: initial;"+ , " border-left-color: initial;"+ , " outline-color: initial;"+ , " background-repeat: initial;"+ , " background-image: initial;"+ , " border-image-source: initial;"+ , " border-image-repeat: initial;"+ , " border-image-slice: initial;"+ , " border-image-width: initial;"+ , " transition-property: initial;"+ , " transition-duration: initial;"+ , " transition-timing-function: initial;"+ , " transition-delay: initial;"+ , " engine: initial;"+ , " gtk-key-bindings: initial;"+ , " -GtkNotebook-initial-gap: 0;"+ , "}"+ ]+ else+ {- Gtk-3.20 -}+ [ "* {"+ , " all: unset;"+ , "}"+ ]
src/Coin/UI/Widgets/Calendar.hs view
@@ -43,6 +43,7 @@ import Coin.UI.Utils.CssUtils import Coin.UI.Utils.Observable import Coin.Locale.Translate+import Coin.Config.Version data CalendarWidget = CalendarWidget { calendarContainer :: Gtk.Box,@@ -90,17 +91,19 @@ , "* {" , " color: " ++ fg ++ ";" , "}"- , "frame {"+ -- frame {+ , if gtkVersionOld then ".frame {" else "frame {" , " background-color: " ++ bg ++ ";" , " border: 1px;" , " border-style: solid;" , " border-radius: 10px;" , " padding: 10px 5px 10px 5px;" , "}"- , "label {"+ -- label {+ , if gtkVersionOld then ".label {" else "label {" , " padding: 2px;" , "}"- , "button {"+ , if gtkVersionOld then ".button {" else "button {" , " transition: 200ms ease-in-out;" , if calendarSize == CalendarSizeNormal then " font-size: 1.1em;" else mempty , " background-color: " ++ bg ++ ";"
src/Coin/UI/Widgets/MessageBox.hs view
@@ -31,13 +31,14 @@ import Coin.Locale.Translate import Coin.UI.Widgets.ResponseButtons import Coin.UI.Utils.CssUtils+import Coin.Config.Version messageBoxNew :: MessageType -> ButtonsType -> String -> (ResponseId -> IO ()) -> IO () messageBoxNew mType bType msg fun = do responseButtons <- responseButtonsNew bType let labelCss =- [ "label {"+ [ if gtkVersionOld then ".label {" else "label {" , " font-size: 1.2em;" , " padding: 5px;" , "}"
src/Coin/UI/Widgets/MiniCalendar.hs view
@@ -42,6 +42,7 @@ import Coin.UI.Utils.Observable import Coin.Utils.ColorUtils import Coin.Locale.Translate+import Coin.Config.Version data MiniCalendarWidget = MiniCalendarWidget { miniCalendarContainer :: Gtk.Box,@@ -76,17 +77,17 @@ , "* {" , " color: " ++ fg ++ ";" , "}"- , "frame {"+ , if gtkVersionOld then ".frame {" else "frame {" , " background-color: " ++ bg ++ ";" , " border: 1px;" , " border-style: solid;" , " border-radius: 10px;" , " padding: 4px 4px 4px 4px;" , "}"- , "label {"+ , if gtkVersionOld then ".label {" else "label {" , " padding: 2px;" , "}"- , "button {"+ , if gtkVersionOld then ".button { " else "button {" , " transition: 200ms ease-in-out;" , " font-size: 1.1em;" , " background-color: " ++ bg ++ ";"
src/Coin/UI/Widgets/MultiList.hs view
@@ -43,6 +43,7 @@ import Coin.UI.Widgets.SimpleListView import Coin.UI.Utils.CssUtils+import Coin.Config.Version data MultiListData = MultiListData { multiListButton :: Gtk.Button,@@ -73,7 +74,8 @@ multiListButtonNew :: MultiListWidget -> String -> IO Int multiListButtonNew multiList text = do let buttonCss =- [ "button {"+ [ -- button {+ if gtkVersionOld then ".button {" else "button {" , " padding: 5px;" , " border-radius: 8px;" , " font-weight: bold;"
src/Coin/UI/Widgets/ResponseButtons.hs view
@@ -32,6 +32,7 @@ import Coin.UI.Builder.GtkUIBuilder import Coin.UI.Utils.CssUtils+import Coin.Config.Version data ResponseButtonsWidget = ResponseButtonsWidget { widgetContainer :: HBox,@@ -103,7 +104,7 @@ myButtonsNew :: ButtonsType -> UIBuilder a myButtonsNew bType = do let buttonCss =- [ "button {"+ [ if gtkVersionOld then ".button {" else "button {" , " padding-left: 15px;" , " padding-right: 15px;" , "}"