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="can_focus">False</property>
|
||||||
<property name="stock">gtk-edit</property>
|
<property name="stock">gtk-edit</property>
|
||||||
</object>
|
</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">
|
<object class="GtkApplicationWindow" id="rootWin">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
@ -314,17 +319,45 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStatusbar" id="statusBar">
|
<object class="GtkBox" id="box3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="margin_left">10</property>
|
<child>
|
||||||
<property name="margin_right">10</property>
|
<object class="GtkStatusbar" id="statusBar">
|
||||||
<property name="margin_start">10</property>
|
<property name="visible">True</property>
|
||||||
<property name="margin_end">10</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="margin_top">6</property>
|
<property name="margin_left">10</property>
|
||||||
<property name="margin_bottom">6</property>
|
<property name="margin_right">10</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="margin_start">10</property>
|
||||||
<property name="spacing">2</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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -191,6 +191,8 @@ startMainWindow startdir = do
|
|||||||
"urlBar"
|
"urlBar"
|
||||||
statusBar <- builderGetObject builder castToStatusbar
|
statusBar <- builderGetObject builder castToStatusbar
|
||||||
"statusBar"
|
"statusBar"
|
||||||
|
clearStatusBar <- builderGetObject builder castToButton
|
||||||
|
"clearStatusBar"
|
||||||
rcMenu <- builderGetObject builder castToMenu
|
rcMenu <- builderGetObject builder castToMenu
|
||||||
"rcMenu"
|
"rcMenu"
|
||||||
rcFileOpen <- builderGetObject builder castToImageMenuItem
|
rcFileOpen <- builderGetObject builder castToImageMenuItem
|
||||||
|
@ -86,6 +86,12 @@ setCallbacks mygui myview = do
|
|||||||
-- GUI events
|
-- GUI events
|
||||||
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
||||||
_ <- treeView mygui `on` rowActivated $ (\_ _ -> withRows mygui myview open)
|
_ <- 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
|
-- key events
|
||||||
_ <- rootWin mygui `on` keyPressEvent $ tryEvent $ do
|
_ <- rootWin mygui `on` keyPressEvent $ tryEvent $ do
|
||||||
@ -123,10 +129,6 @@ setCallbacks mygui myview = do
|
|||||||
"v" <- fmap glibToString eventKeyName
|
"v" <- fmap glibToString eventKeyName
|
||||||
liftIO $ operationFinal mygui myview
|
liftIO $ operationFinal mygui myview
|
||||||
|
|
||||||
_ <- refreshView mygui `on` buttonActivated $ do
|
|
||||||
cdir <- liftIO $ getCurrentDir myview
|
|
||||||
refreshTreeView' mygui myview cdir
|
|
||||||
|
|
||||||
-- menubar-file
|
-- menubar-file
|
||||||
_ <- menubarFileQuit mygui `on` menuItemActivated $ mainQuit
|
_ <- menubarFileQuit mygui `on` menuItemActivated $ mainQuit
|
||||||
_ <- menubarFileOpen mygui `on` menuItemActivated $
|
_ <- menubarFileOpen mygui `on` menuItemActivated $
|
||||||
@ -177,7 +179,6 @@ setCallbacks mygui myview = do
|
|||||||
_ <- rcFileCut mygui `on` menuItemActivated $
|
_ <- rcFileCut mygui `on` menuItemActivated $
|
||||||
liftIO $ withRows mygui myview moveInit
|
liftIO $ withRows mygui myview moveInit
|
||||||
|
|
||||||
|
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
|
||||||
@ -240,8 +241,10 @@ del _ _ _ = withErrorDialog
|
|||||||
--
|
--
|
||||||
-- * 'operationBuffer' writes
|
-- * 'operationBuffer' writes
|
||||||
moveInit :: [Row] -> MyGUI -> MyView -> IO ()
|
moveInit :: [Row] -> MyGUI -> MyView -> IO ()
|
||||||
moveInit [row] mygui myview =
|
moveInit [row] mygui myview = do
|
||||||
writeTVarIO (operationBuffer myview) (FMove . MP1 $ row)
|
writeTVarIO (operationBuffer myview) (FMove . MP1 $ row)
|
||||||
|
let sbmsg = "Move buffer: " ++ fullPath row
|
||||||
|
void $ pushStatusBar mygui sbmsg
|
||||||
moveInit _ _ _ = withErrorDialog
|
moveInit _ _ _ = withErrorDialog
|
||||||
. throw $ InvalidOperation
|
. throw $ InvalidOperation
|
||||||
"Operation not supported on multiple files"
|
"Operation not supported on multiple files"
|
||||||
@ -252,8 +255,10 @@ moveInit _ _ _ = withErrorDialog
|
|||||||
--
|
--
|
||||||
-- * 'operationBuffer' writes
|
-- * 'operationBuffer' writes
|
||||||
copyInit :: [Row] -> MyGUI -> MyView -> IO ()
|
copyInit :: [Row] -> MyGUI -> MyView -> IO ()
|
||||||
copyInit [row] mygui myview =
|
copyInit [row] mygui myview = do
|
||||||
writeTVarIO (operationBuffer myview) (FCopy . CP1 $ row)
|
writeTVarIO (operationBuffer myview) (FCopy . CP1 $ row)
|
||||||
|
let sbmsg = "Copy buffer: " ++ fullPath row
|
||||||
|
void $ pushStatusBar mygui sbmsg
|
||||||
copyInit _ _ _ = withErrorDialog
|
copyInit _ _ _ = withErrorDialog
|
||||||
. throw $ InvalidOperation
|
. throw $ InvalidOperation
|
||||||
"Operation not supported on multiple files"
|
"Operation not supported on multiple files"
|
||||||
|
@ -73,6 +73,7 @@ data MyGUI = MkMyGUI {
|
|||||||
, refreshView :: Button
|
, refreshView :: Button
|
||||||
, urlBar :: Entry
|
, urlBar :: Entry
|
||||||
, statusBar :: Statusbar
|
, statusBar :: Statusbar
|
||||||
|
, clearStatusBar :: Button
|
||||||
, treeView :: TreeView
|
, treeView :: TreeView
|
||||||
-- |first column
|
-- |first column
|
||||||
, cF :: TreeViewColumn
|
, cF :: TreeViewColumn
|
||||||
|
@ -294,3 +294,11 @@ pushStatusBar mygui str = do
|
|||||||
cid <- statusbarGetContextId sb "FM Status"
|
cid <- statusbarGetContextId sb "FM Status"
|
||||||
mid <- statusbarPush sb cid str
|
mid <- statusbarPush sb cid str
|
||||||
return (cid, mid)
|
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