Skip to content

Instantly share code, notes, and snippets.

@thiagoarrais
Created July 13, 2009 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagoarrais/146102 to your computer and use it in GitHub Desktop.
Save thiagoarrais/146102 to your computer and use it in GitHub Desktop.
import Graphics.UI.Gtk
connectAction actg accg id accelerator command =
do action <- actionNew id "Go!" Nothing Nothing
actionGroupAddActionWithAccel actg action (Just accelerator)
actionSetAccelGroup action accg
actionConnectAccelerator action
on action actionActivated command
return action
main =
do initGUI
window <- windowNew
ag <- actionGroupNew "AGR"
ui <- uiManagerNew
acg <- uiManagerGetAccelGroup ui
uiManagerInsertActionGroup ui ag 0
windowAddAccelGroup window acg
connectAction ag acg "CLSE" "<Control>w" (putStrLn "Ctrl-W")
connectAction ag acg "TBAD" "<Control>t" (putStrLn "Ctrl-T")
onDestroy window mainQuit
widgetShowAll window
mainGUI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment