GTK: add about dialog

This commit is contained in:
Julian Ospald 2015-12-24 17:44:55 +01:00
parent b657756e37
commit f64f2a975c
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
3 changed files with 27 additions and 0 deletions

View File

@ -16,6 +16,7 @@ data-files: data/Gtk/builder.xml
data/Gtk/icons/gtk-directory.png data/Gtk/icons/gtk-directory.png
data/Gtk/icons/gtk-file.png data/Gtk/icons/gtk-file.png
data/Gtk/icons/hsfm.png data/Gtk/icons/hsfm.png
LICENSE
library library

View File

@ -110,6 +110,10 @@ setCallbacks mygui myview = do
_ <- menubarEditCut mygui `on` menuItemActivated $ _ <- menubarEditCut mygui `on` menuItemActivated $
liftIO $ withRow mygui myview moveInit liftIO $ withRow mygui myview moveInit
-- menubar-help
_ <- menubarHelpAbout mygui `on` menuItemActivated $
liftIO showAboutDialog
-- righ-click -- righ-click
_ <- treeView mygui `on` buttonPressEvent $ do _ <- treeView mygui `on` buttonPressEvent $ do
eb <- eventButton eb <- eventButton

View File

@ -75,6 +75,28 @@ showCopyModeChooserDialog = do
ResponseUser 2 -> return Replace ResponseUser 2 -> return Replace
-- |Shows the about dialog from the help menu.
showAboutDialog :: IO ()
showAboutDialog = do
ad <- aboutDialogNew
licensestr <- readFile "LICENSE"
hsfmicon <- pixbufNewFromFile "data/Gtk/icons/hsfm.png"
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>"]
, aboutDialogLogo := Just hsfmicon
, aboutDialogWrapLicense := True
]
_ <- dialogRun ad
widgetDestroy ad
-- |Carry out an IO action with a confirmation dialog. -- |Carry out an IO action with a confirmation dialog.
-- If the user presses "No", then do nothing. -- If the user presses "No", then do nothing.
withConfirmationDialog :: String -> IO () -> IO () withConfirmationDialog :: String -> IO () -> IO ()