diff options
author | Will Thompson <will@willthompson.co.uk> | 2020-08-06 16:38:33 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2020-08-06 16:44:41 +0100 |
commit | 6eb66f457e0b34456e1794112d806b7f4f8a63b5 (patch) | |
tree | 385ad5be3e5fc3b97508cc259d91ea451acb0431 | |
parent | d7907953f4ab8540f2e6681dafcb72f95117ff81 (diff) |
AboutDialog: use :license-type property
Now that Bustle's license is a straightforward LGPL 2.1 or later, we can
use GtkAboutDialog:license-type rather than showing the full license
text in the dialogue.
Unfortunately this property and the corresponding GtkLicenseType enum
has no gtk2hs binding, but that's never stopped us before.
-rw-r--r-- | Bustle/UI/AboutDialog.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Bustle/UI/AboutDialog.hs b/Bustle/UI/AboutDialog.hs index 95f4491..f06c670 100644 --- a/Bustle/UI/AboutDialog.hs +++ b/Bustle/UI/AboutDialog.hs @@ -25,24 +25,23 @@ where import Prelude import Data.Version (showVersion) -import Control.Exception import Control.Monad (when) import Graphics.UI.Gtk +import System.Glib.Properties (objectSetPropertyInt) import Bustle.Translation (__) -import Bustle.Util import Paths_bustle +-- enum GtkLicenseType { GTK_LICENSE_TYPE_LGPL_2_1 } +license_type_lgpl_2_1 :: Int +license_type_lgpl_2_1 = 4 showAboutDialog :: Window -> IO () showAboutDialog window = do dialog <- aboutDialogNew - license <- (Just `fmap` (readFile =<< getDataFileName "LICENSE")) - `catch` (\e -> warn (show (e :: IOException)) >> return Nothing) - dialog `set` [ aboutDialogName := __ "Bustle" , aboutDialogVersion := showVersion version , aboutDialogComments := __ "Someone's favourite D-Bus profiler" @@ -50,11 +49,11 @@ showAboutDialog window = do , aboutDialogAuthors := authors , aboutDialogArtists := artists , aboutDialogCopyright := "© 2008–2017 Will Thompson, Collabora Ltd. and contributors" - , aboutDialogLicense := license , aboutDialogLogoIconName := Just "org.freedesktop.Bustle" , windowModal := True , windowTransientFor := window ] + objectSetPropertyInt "license-type" dialog license_type_lgpl_2_1 dialog `after` response $ \resp -> when (resp == ResponseCancel) (widgetDestroy dialog) |