GTK: make the statusBar show the operation buffer
This commit is contained in:
parent
36768519a3
commit
eae68cc0ea
@ -94,6 +94,11 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</object>
|
||||
<object class="GtkApplicationWindow" id="rootWin">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
@ -314,17 +319,45 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="statusBar">
|
||||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="margin_start">10</property>
|
||||
<property name="margin_end">10</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="statusBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="margin_start">10</property>
|
||||
<property name="margin_end">10</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="clearStatusBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="image">image3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -191,6 +191,8 @@ startMainWindow startdir = do
|
||||
"urlBar"
|
||||
statusBar <- builderGetObject builder castToStatusbar
|
||||
"statusBar"
|
||||
clearStatusBar <- builderGetObject builder castToButton
|
||||
"clearStatusBar"
|
||||
rcMenu <- builderGetObject builder castToMenu
|
||||
"rcMenu"
|
||||
rcFileOpen <- builderGetObject builder castToImageMenuItem
|
||||
|
@ -86,6 +86,12 @@ setCallbacks mygui myview = do
|
||||
-- GUI events
|
||||
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
||||
_ <- treeView mygui `on` rowActivated $ (\_ _ -> withRows mygui myview open)
|
||||
_ <- refreshView mygui `on` buttonActivated $ do
|
||||
cdir <- liftIO $ getCurrentDir myview
|
||||
refreshTreeView' mygui myview cdir
|
||||
_ <- clearStatusBar mygui `on` buttonActivated $ do
|
||||
popStatusbar mygui
|
||||
writeTVarIO (operationBuffer myview) None
|
||||
|
||||
-- key events
|
||||
_ <- rootWin mygui `on` keyPressEvent $ tryEvent $ do
|
||||
@ -123,10 +129,6 @@ setCallbacks mygui myview = do
|
||||
"v" <- fmap glibToString eventKeyName
|
||||
liftIO $ operationFinal mygui myview
|
||||
|
||||
_ <- refreshView mygui `on` buttonActivated $ do
|
||||
cdir <- liftIO $ getCurrentDir myview
|
||||
refreshTreeView' mygui myview cdir
|
||||
|
||||
-- menubar-file
|
||||
_ <- menubarFileQuit mygui `on` menuItemActivated $ mainQuit
|
||||
_ <- menubarFileOpen mygui `on` menuItemActivated $
|
||||
@ -177,7 +179,6 @@ setCallbacks mygui myview = do
|
||||
_ <- rcFileCut mygui `on` menuItemActivated $
|
||||
liftIO $ withRows mygui myview moveInit
|
||||
|
||||
|
||||
return ()
|
||||
|
||||
|
||||
@ -240,8 +241,10 @@ del _ _ _ = withErrorDialog
|
||||
--
|
||||
-- * 'operationBuffer' writes
|
||||
moveInit :: [Row] -> MyGUI -> MyView -> IO ()
|
||||
moveInit [row] mygui myview =
|
||||
moveInit [row] mygui myview = do
|
||||
writeTVarIO (operationBuffer myview) (FMove . MP1 $ row)
|
||||
let sbmsg = "Move buffer: " ++ fullPath row
|
||||
void $ pushStatusBar mygui sbmsg
|
||||
moveInit _ _ _ = withErrorDialog
|
||||
. throw $ InvalidOperation
|
||||
"Operation not supported on multiple files"
|
||||
@ -252,8 +255,10 @@ moveInit _ _ _ = withErrorDialog
|
||||
--
|
||||
-- * 'operationBuffer' writes
|
||||
copyInit :: [Row] -> MyGUI -> MyView -> IO ()
|
||||
copyInit [row] mygui myview =
|
||||
copyInit [row] mygui myview = do
|
||||
writeTVarIO (operationBuffer myview) (FCopy . CP1 $ row)
|
||||
let sbmsg = "Copy buffer: " ++ fullPath row
|
||||
void $ pushStatusBar mygui sbmsg
|
||||
copyInit _ _ _ = withErrorDialog
|
||||
. throw $ InvalidOperation
|
||||
"Operation not supported on multiple files"
|
||||
|
@ -73,6 +73,7 @@ data MyGUI = MkMyGUI {
|
||||
, refreshView :: Button
|
||||
, urlBar :: Entry
|
||||
, statusBar :: Statusbar
|
||||
, clearStatusBar :: Button
|
||||
, treeView :: TreeView
|
||||
-- |first column
|
||||
, cF :: TreeViewColumn
|
||||
|
@ -294,3 +294,11 @@ pushStatusBar mygui str = do
|
||||
cid <- statusbarGetContextId sb "FM Status"
|
||||
mid <- statusbarPush sb cid str
|
||||
return (cid, mid)
|
||||
|
||||
|
||||
-- |Pop a message from the status bar.
|
||||
popStatusbar :: MyGUI -> IO ()
|
||||
popStatusbar mygui = do
|
||||
let sb = statusBar mygui
|
||||
cid <- statusbarGetContextId sb "FM Status"
|
||||
statusbarPop sb cid
|
||||
|
Loading…
Reference in New Issue
Block a user