From 3e4621fe70e8f7b3fb54587747c8ccb04a61d44e Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 3 Jun 2016 14:42:28 +0200 Subject: [PATCH] GTK: add "New -> Terminal" to right-click menu --- data/Gtk/builder.xml | 16 +++++++++++++++- src/HSFM/GUI/Gtk/Callbacks.hs | 2 ++ src/HSFM/GUI/Gtk/Data.hs | 1 + src/HSFM/GUI/Gtk/MyView.hs | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/data/Gtk/builder.xml b/data/Gtk/builder.xml index fd6ee08..3601d79 100644 --- a/data/Gtk/builder.xml +++ b/data/Gtk/builder.xml @@ -518,13 +518,22 @@ - New Tab + Tab True False image8 False + + + Terminal + True + False + image9 + False + + @@ -634,6 +643,11 @@ False gtk-add + + True + False + utilities-terminal + True False diff --git a/src/HSFM/GUI/Gtk/Callbacks.hs b/src/HSFM/GUI/Gtk/Callbacks.hs index 2c94a2d..6b6419b 100644 --- a/src/HSFM/GUI/Gtk/Callbacks.hs +++ b/src/HSFM/GUI/Gtk/Callbacks.hs @@ -296,6 +296,8 @@ setViewCallbacks mygui myview = do liftIO $ newDir mygui myview _ <- (rcFileNewTab . rcmenu) myview `on` menuItemActivated $ liftIO $ newTab' mygui myview + _ <- (rcFileNewTerm . rcmenu) myview `on` menuItemActivated $ + liftIO $ void $ openTerminalHere myview _ <- (rcFileCopy . rcmenu) myview `on` menuItemActivated $ liftIO $ withItems mygui myview copyInit _ <- (rcFileRename . rcmenu) myview `on` menuItemActivated $ diff --git a/src/HSFM/GUI/Gtk/Data.hs b/src/HSFM/GUI/Gtk/Data.hs index 0cf242b..989e7e1 100644 --- a/src/HSFM/GUI/Gtk/Data.hs +++ b/src/HSFM/GUI/Gtk/Data.hs @@ -108,6 +108,7 @@ data RightClickMenu = MkRightClickMenu { , rcFileNewRegFile :: !ImageMenuItem , rcFileNewDir :: !ImageMenuItem , rcFileNewTab :: !ImageMenuItem + , rcFileNewTerm :: !ImageMenuItem , rcFileCut :: !ImageMenuItem , rcFileCopy :: !ImageMenuItem , rcFileRename :: !ImageMenuItem diff --git a/src/HSFM/GUI/Gtk/MyView.hs b/src/HSFM/GUI/Gtk/MyView.hs index 6b95bcd..07aa85b 100644 --- a/src/HSFM/GUI/Gtk/MyView.hs +++ b/src/HSFM/GUI/Gtk/MyView.hs @@ -163,6 +163,8 @@ createMyView mygui iofmv = do "rcFileNewDir" rcFileNewTab <- builderGetObject builder castToImageMenuItem "rcFileNewTab" + rcFileNewTerm <- builderGetObject builder castToImageMenuItem + "rcFileNewTerm" rcFileCut <- builderGetObject builder castToImageMenuItem "rcFileCut" rcFileCopy <- builderGetObject builder castToImageMenuItem