GTK: implement home and up buttons wrt #40
This commit is contained in:
parent
c0bd5f3c37
commit
e98fb577ed
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.19.0 -->
|
<!-- Generated with glade 3.18.3 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.16"/>
|
<requires lib="gtk+" version="3.16"/>
|
||||||
<object class="GtkImage" id="image1">
|
<object class="GtkImage" id="image1">
|
||||||
@ -104,6 +104,11 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-zoom-fit</property>
|
<property name="stock">gtk-zoom-fit</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkImage" id="image5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="stock">gtk-zoom-fit</property>
|
||||||
|
</object>
|
||||||
<object class="GtkApplicationWindow" id="rootWin">
|
<object class="GtkApplicationWindow" id="rootWin">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
@ -307,6 +312,35 @@
|
|||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="upViewB">
|
||||||
|
<property name="label">gtk-go-up</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">2</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="homeViewB">
|
||||||
|
<property name="label">gtk-home</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="refreshViewB">
|
<object class="GtkButton" id="refreshViewB">
|
||||||
<property name="label">gtk-refresh</property>
|
<property name="label">gtk-refresh</property>
|
||||||
@ -318,8 +352,8 @@
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="padding">5</property>
|
<property name="padding">2</property>
|
||||||
<property name="position">1</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@ -396,9 +430,4 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="image5">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="stock">gtk-zoom-fit</property>
|
|
||||||
</object>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -63,7 +63,10 @@ import System.Glib.UTFString
|
|||||||
(
|
(
|
||||||
glibToString
|
glibToString
|
||||||
)
|
)
|
||||||
|
import System.Posix.Env.ByteString
|
||||||
|
(
|
||||||
|
getEnv
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -128,6 +131,10 @@ setCallbacks mygui myview = do
|
|||||||
-- GUI events
|
-- GUI events
|
||||||
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
||||||
|
|
||||||
|
_ <- upViewB mygui `on` buttonActivated $
|
||||||
|
upDir mygui myview
|
||||||
|
_ <- homeViewB mygui `on` buttonActivated $
|
||||||
|
goHome mygui myview
|
||||||
_ <- refreshViewB mygui `on` buttonActivated $ do
|
_ <- refreshViewB mygui `on` buttonActivated $ do
|
||||||
cdir <- liftIO $ getCurrentDir myview
|
cdir <- liftIO $ getCurrentDir myview
|
||||||
refreshView' mygui myview cdir
|
refreshView' mygui myview cdir
|
||||||
@ -234,6 +241,12 @@ urlGoTo mygui myview = withErrorDialog $ do
|
|||||||
refreshView mygui myview (Just fp')
|
refreshView mygui myview (Just fp')
|
||||||
|
|
||||||
|
|
||||||
|
goHome :: MyGUI -> MyView -> IO ()
|
||||||
|
goHome mygui myview = withErrorDialog $ do
|
||||||
|
mhomedir <- getEnv "HOME"
|
||||||
|
refreshView mygui myview (P.parseAbs =<< mhomedir)
|
||||||
|
|
||||||
|
|
||||||
-- |Supposed to be used with 'withRows'. Opens a file or directory.
|
-- |Supposed to be used with 'withRows'. Opens a file or directory.
|
||||||
open :: [Item] -> MyGUI -> MyView -> IO ()
|
open :: [Item] -> MyGUI -> MyView -> IO ()
|
||||||
open [item] mygui myview = withErrorDialog $
|
open [item] mygui myview = withErrorDialog $
|
||||||
|
@ -72,6 +72,8 @@ data MyGUI = MkMyGUI {
|
|||||||
, rcFileRename :: ImageMenuItem
|
, rcFileRename :: ImageMenuItem
|
||||||
, rcFilePaste :: ImageMenuItem
|
, rcFilePaste :: ImageMenuItem
|
||||||
, rcFileDelete :: ImageMenuItem
|
, rcFileDelete :: ImageMenuItem
|
||||||
|
, upViewB :: Button
|
||||||
|
, homeViewB :: Button
|
||||||
, refreshViewB :: Button
|
, refreshViewB :: Button
|
||||||
, urlBar :: Entry
|
, urlBar :: Entry
|
||||||
, statusBar :: Statusbar
|
, statusBar :: Statusbar
|
||||||
|
@ -99,6 +99,10 @@ createMyGUI = do
|
|||||||
"rcFilePaste"
|
"rcFilePaste"
|
||||||
rcFileDelete <- builderGetObject builder castToImageMenuItem
|
rcFileDelete <- builderGetObject builder castToImageMenuItem
|
||||||
"rcFileDelete"
|
"rcFileDelete"
|
||||||
|
upViewB <- builderGetObject builder castToButton
|
||||||
|
"upViewB"
|
||||||
|
homeViewB <- builderGetObject builder castToButton
|
||||||
|
"homeViewB"
|
||||||
refreshViewB <- builderGetObject builder castToButton
|
refreshViewB <- builderGetObject builder castToButton
|
||||||
"refreshViewB"
|
"refreshViewB"
|
||||||
menubarViewTree <- builderGetObject builder castToImageMenuItem
|
menubarViewTree <- builderGetObject builder castToImageMenuItem
|
||||||
|
Loading…
Reference in New Issue
Block a user