GTK: use Cabal to construct the about dialog information

This commit is contained in:
Julian Ospald 2015-12-24 18:18:50 +01:00
parent 1ea20efe49
commit bd448644d2
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 39 additions and 11 deletions

View File

@ -7,6 +7,7 @@ license-file: LICENSE
author: Julian Ospald
maintainer: hasufell@hasufell.de
copyright: Copyright: (c) 2015 Julian Ospald
homepage: https://github.com/hasufell/hsfm
category: Desktop
build-type: Simple
cabal-version: >=1.10
@ -61,6 +62,7 @@ executable hsfm-gtk
build-depends: hsfm,
base >= 4.7,
Cabal >= 1.22.0.0,
containers,
data-default,
gtk3 >= 0.14.1,

View File

@ -3,6 +3,10 @@
module GUI.Gtk.Dialogs where
import Control.Applicative
(
(<$>)
)
import Control.Exception
(
try
@ -13,7 +17,28 @@ import Control.Monad
when
, void
)
import Data.Version
(
showVersion
)
import Distribution.Package
(
PackageIdentifier(..)
, PackageName(..)
)
import Distribution.PackageDescription
(
GenericPackageDescription(..)
, PackageDescription(..)
)
import Distribution.PackageDescription.Parse
(
readPackageDescription
)
import Distribution.Verbosity
(
silent
)
import Graphics.UI.Gtk
import GUI.Gtk.Data
import IO.File
@ -78,18 +103,19 @@ showCopyModeChooserDialog = do
-- |Shows the about dialog from the help menu.
showAboutDialog :: IO ()
showAboutDialog = do
ad <- aboutDialogNew
licensestr <- readFile "LICENSE"
ad <- aboutDialogNew
lstr <- readFile "LICENSE"
hsfmicon <- pixbufNewFromFile "data/Gtk/icons/hsfm.png"
pdesc <- packageDescription <$> readPackageDescription silent "hsfm.cabal"
set ad
[ aboutDialogProgramName := "hsfm"
, aboutDialogName := "hsfm"
, aboutDialogVersion := "0.0.0.1"
, aboutDialogCopyright := "Copyright: (c) 2015 Julian Ospald"
, aboutDialogComments := "A file manager written in Haskell"
, aboutDialogLicense := Just licensestr
, aboutDialogWebsite := "https://github.com/hasufell/hsfm"
, aboutDialogAuthors := ["Julian Ospald <hasufell@hasufell.de>"]
[ aboutDialogProgramName := (unPackageName . pkgName . package) pdesc
, aboutDialogName := (unPackageName . pkgName . package) pdesc
, aboutDialogVersion := (showVersion . pkgVersion . package) pdesc
, aboutDialogCopyright := copyright pdesc
, aboutDialogComments := description pdesc
, aboutDialogLicense := Just lstr
, aboutDialogWebsite := homepage pdesc
, aboutDialogAuthors := [author pdesc]
, aboutDialogLogo := Just hsfmicon
, aboutDialogWrapLicense := True
]