diff --git a/hsfm.cabal b/hsfm.cabal index 79def1f..862e05a 100644 --- a/hsfm.cabal +++ b/hsfm.cabal @@ -16,6 +16,7 @@ data-files: data/Gtk/builder.xml data/Gtk/icons/gtk-directory.png data/Gtk/icons/gtk-file.png data/Gtk/icons/hsfm.png + LICENSE library diff --git a/src/GUI/Gtk/Callbacks.hs b/src/GUI/Gtk/Callbacks.hs index 148e0e2..ef13ae3 100644 --- a/src/GUI/Gtk/Callbacks.hs +++ b/src/GUI/Gtk/Callbacks.hs @@ -110,6 +110,10 @@ setCallbacks mygui myview = do _ <- menubarEditCut mygui `on` menuItemActivated $ liftIO $ withRow mygui myview moveInit + -- menubar-help + _ <- menubarHelpAbout mygui `on` menuItemActivated $ + liftIO showAboutDialog + -- righ-click _ <- treeView mygui `on` buttonPressEvent $ do eb <- eventButton diff --git a/src/GUI/Gtk/Dialogs.hs b/src/GUI/Gtk/Dialogs.hs index 04c2493..4fc838d 100644 --- a/src/GUI/Gtk/Dialogs.hs +++ b/src/GUI/Gtk/Dialogs.hs @@ -75,6 +75,28 @@ showCopyModeChooserDialog = do 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 "] + , aboutDialogLogo := Just hsfmicon + , aboutDialogWrapLicense := True + ] + _ <- dialogRun ad + widgetDestroy ad + + -- |Carry out an IO action with a confirmation dialog. -- If the user presses "No", then do nothing. withConfirmationDialog :: String -> IO () -> IO ()