GTK: fix callbacks for IconView
This commit is contained in:
parent
b266b78e14
commit
ee676d0a83
@ -80,8 +80,16 @@ setCallbacks :: MyGUI -> MyView -> IO ()
|
|||||||
setCallbacks mygui myview = do
|
setCallbacks mygui myview = do
|
||||||
view' <- readTVarIO $ view myview
|
view' <- readTVarIO $ view myview
|
||||||
case view' of
|
case view' of
|
||||||
FMTreeView treeView -> setTreeViewCallbacks treeView
|
FMTreeView treeView -> do
|
||||||
FMIconView iconView -> return ()
|
_ <- treeView `on` rowActivated
|
||||||
|
$ (\_ _ -> withItems mygui myview open)
|
||||||
|
commonGuiEvents treeView
|
||||||
|
return ()
|
||||||
|
FMIconView iconView -> do
|
||||||
|
_ <- iconView `on` itemActivated
|
||||||
|
$ (\_ -> withItems mygui myview open)
|
||||||
|
commonGuiEvents iconView
|
||||||
|
return ()
|
||||||
menubarCallbacks
|
menubarCallbacks
|
||||||
where
|
where
|
||||||
menubarCallbacks = do
|
menubarCallbacks = do
|
||||||
@ -116,11 +124,10 @@ setCallbacks mygui myview = do
|
|||||||
_ <- menubarHelpAbout mygui `on` menuItemActivated $
|
_ <- menubarHelpAbout mygui `on` menuItemActivated $
|
||||||
liftIO showAboutDialog
|
liftIO showAboutDialog
|
||||||
return ()
|
return ()
|
||||||
setTreeViewCallbacks treeView = do
|
commonGuiEvents view = do
|
||||||
-- GUI events
|
-- GUI events
|
||||||
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
_ <- urlBar mygui `on` entryActivated $ urlGoTo mygui myview
|
||||||
_ <- treeView `on` rowActivated
|
|
||||||
$ (\_ _ -> withItems mygui myview open)
|
|
||||||
_ <- 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
|
||||||
@ -133,39 +140,39 @@ setCallbacks mygui myview = do
|
|||||||
[Control] <- eventModifier
|
[Control] <- eventModifier
|
||||||
"q" <- fmap glibToString eventKeyName
|
"q" <- fmap glibToString eventKeyName
|
||||||
liftIO mainQuit
|
liftIO mainQuit
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
[Control] <- eventModifier
|
[Control] <- eventModifier
|
||||||
"h" <- fmap glibToString eventKeyName
|
"h" <- fmap glibToString eventKeyName
|
||||||
cdir <- liftIO $ getCurrentDir myview
|
cdir <- liftIO $ getCurrentDir myview
|
||||||
liftIO $ modifyTVarIO (settings mygui)
|
liftIO $ modifyTVarIO (settings mygui)
|
||||||
(\x -> x { showHidden = not . showHidden $ x})
|
(\x -> x { showHidden = not . showHidden $ x})
|
||||||
>> refreshView' mygui myview cdir
|
>> refreshView' mygui myview cdir
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
[Alt] <- eventModifier
|
[Alt] <- eventModifier
|
||||||
"Up" <- fmap glibToString eventKeyName
|
"Up" <- fmap glibToString eventKeyName
|
||||||
liftIO $ upDir mygui myview
|
liftIO $ upDir mygui myview
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
"Delete" <- fmap glibToString eventKeyName
|
"Delete" <- fmap glibToString eventKeyName
|
||||||
liftIO $ withItems mygui myview del
|
liftIO $ withItems mygui myview del
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
[] <- eventModifier
|
[] <- eventModifier
|
||||||
"Return" <- fmap glibToString eventKeyName
|
"Return" <- fmap glibToString eventKeyName
|
||||||
liftIO $ withItems mygui myview open
|
liftIO $ withItems mygui myview open
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
[Control] <- eventModifier
|
[Control] <- eventModifier
|
||||||
"c" <- fmap glibToString eventKeyName
|
"c" <- fmap glibToString eventKeyName
|
||||||
liftIO $ withItems mygui myview copyInit
|
liftIO $ withItems mygui myview copyInit
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
[Control] <- eventModifier
|
[Control] <- eventModifier
|
||||||
"x" <- fmap glibToString eventKeyName
|
"x" <- fmap glibToString eventKeyName
|
||||||
liftIO $ withItems mygui myview moveInit
|
liftIO $ withItems mygui myview moveInit
|
||||||
_ <- treeView `on` keyPressEvent $ tryEvent $ do
|
_ <- view `on` keyPressEvent $ tryEvent $ do
|
||||||
[Control] <- eventModifier
|
[Control] <- eventModifier
|
||||||
"v" <- fmap glibToString eventKeyName
|
"v" <- fmap glibToString eventKeyName
|
||||||
liftIO $ operationFinal mygui myview
|
liftIO $ operationFinal mygui myview
|
||||||
|
|
||||||
-- righ-click
|
-- righ-click
|
||||||
_ <- treeView `on` buttonPressEvent $ do
|
_ <- view `on` buttonPressEvent $ do
|
||||||
eb <- eventButton
|
eb <- eventButton
|
||||||
t <- eventTime
|
t <- eventTime
|
||||||
case eb of
|
case eb of
|
||||||
|
Loading…
Reference in New Issue
Block a user