main = do
  initGUI

  -- Create the menus
  fileAct <- actionNew "FileAction" (__"File") Nothing Nothing
  editAct <- actionNew "EditAction" (__"Edit") Nothing Nothing

  -- Create menu items
  newAct <- actionNew "NewAction" (__"New")
            (Just (__"Clear the spreadsheet area."))
            (Just stockNew)
  on newAct actionActivated $ putStrLn "New activated."
  openAct <- actionNew "OpenAction" (__"Open")
            (Just (__"Open an existing spreadsheet."))
            (Just stockOpen)
  on openAct actionActivated $ putStrLn "Open activated."
  saveAct <- actionNew "SaveAction" (__"Save")
            (Just (__"Save the current spreadsheet."))
            (Just stockSave)
  on saveAct actionActivated $ putStrLn "Save activated."
  saveAsAct <- actionNew "SaveAsAction" (__"SaveAs")
            (Just (__"Save spreadsheet under new name."))
            (Just stockSaveAs)
  on saveAsAct actionActivated $ putStrLn "SaveAs activated."
  exitAct <- actionNew "ExitAction" (__"Exit")
            (Just (__"Exit this application."))
            (Just stockSaveAs)
  on exitAct actionActivated $ mainQuit
  cutAct <- actionNew "CutAction" (__"Cut")
            (Just (__"Cut out the current selection."))
            (Just stockCut)
  on cutAct actionActivated $ putStrLn "Cut activated."
  copyAct <- actionNew "CopyAction" (__"Copy")
            (Just (__"Copy the current selection."))
            (Just stockCopy)
  on copyAct actionActivated $ putStrLn "Copy activated."
  pasteAct <- actionNew "PasteAction" (__"Paste")
            (Just (__"Paste the current selection."))
            (Just stockPaste)
  on pasteAct actionActivated $ putStrLn "Paste activated."

  standardGroup <- actionGroupNew ("standard"::Text)
  mapM_ (actionGroupAddAction standardGroup) [fileAct, editAct]
  mapM_ (\act -> actionGroupAddActionWithAccel standardGroup act (Nothing::Maybe Text))
    [newAct, openAct, saveAct, saveAsAct, exitAct, cutAct, copyAct, pasteAct]

  ui <- uiManagerNew
  mid <- uiManagerAddUiFromString ui uiDef
  uiManagerInsertActionGroup ui standardGroup 0

  win <- windowNew
  on win objectDestroy mainQuit
  on win sizeRequest $ return (Requisition 200 100)
  (Just menuBar) <- uiManagerGetWidget ui ("/ui/menubar"::Text)
  (Just toolBar) <- uiManagerGetWidget ui ("/ui/toolbar"::Text)

  edit <- textViewNew
  vBox <- vBoxNew False 0
  set vBox [boxHomogeneous := False]
  boxPackStart vBox menuBar PackNatural 0
  boxPackStart vBox toolBar PackNatural 0
  boxPackStart vBox edit PackGrow 0

  containerAdd win vBox
  widgetShowAll win

  mainGUI
main = do
  initGUI

  -- Create the menus
  fileAct <- actionNew "FileAction" (__"File") Nothing Nothing
  editAct <- actionNew "EditAction" (__"Edit") Nothing Nothing

  -- Create menu items
  newAct <- actionNew "NewAction" (__"New")
            (Just (__"Clear the spreadsheet area."))
            (Just stockNew)
  on newAct actionActivated $ putStrLn "New activated."
  openAct <- actionNew "OpenAction" (__"Open")
            (Just (__"Open an existing spreadsheet."))
            (Just stockOpen)
  on openAct actionActivated $ putStrLn "Open activated."
  saveAct <- actionNew "SaveAction" (__"Save")
            (Just (__"Save the current spreadsheet."))
            (Just stockSave)
  on saveAct actionActivated $ putStrLn "Save activated."
  saveAsAct <- actionNew "SaveAsAction" (__"SaveAs")
            (Just (__"Save spreadsheet under new name."))
            (Just stockSaveAs)
  on saveAsAct actionActivated $ putStrLn "SaveAs activated."
  exitAct <- actionNew "ExitAction" (__"Exit")
            (Just (__"Exit this application."))
            (Just stockSaveAs)
  on exitAct actionActivated $ mainQuit
  cutAct <- actionNew "CutAction" (__"Cut")
            (Just (__"Cut out the current selection."))
            (Just stockCut)
  on cutAct actionActivated $ putStrLn "Cut activated."
  copyAct <- actionNew "CopyAction" (__"Copy")
            (Just (__"Copy the current selection."))
            (Just stockCopy)
  on copyAct actionActivated $ putStrLn "Copy activated."
  pasteAct <- actionNew "PasteAction" (__"Paste")
            (Just (__"Paste the current selection."))
            (Just stockPaste)
  on pasteAct actionActivated $ putStrLn "Paste activated."

  standardGroup <- actionGroupNew ("standard"::Text)
  mapM_ (actionGroupAddAction standardGroup) [fileAct, editAct]
  mapM_ (\act -> actionGroupAddActionWithAccel standardGroup act (Nothing::Maybe Text))
    [newAct, openAct, saveAct, saveAsAct, exitAct, cutAct, copyAct, pasteAct]

  ui <- uiManagerNew
  mid <- uiManagerAddUiFromString ui uiDef
  uiManagerInsertActionGroup ui standardGroup 0

  win <- windowNew
  on win objectDestroy mainQuit
  on win sizeRequest $ return (Requisition 200 100)
  (Just menuBar) <- uiManagerGetWidget ui ("/ui/menubar"::Text)
  (Just toolBar) <- uiManagerGetWidget ui ("/ui/toolbar"::Text)

  edit <- textViewNew
  vBox <- vBoxNew False 0
  set vBox [boxHomogeneous := False]
  boxPackStart vBox menuBar PackNatural 0
  boxPackStart vBox toolBar PackNatural 0
  boxPackStart vBox edit PackGrow 0

  containerAdd win vBox
  widgetShowAll win

  mainGUI
main = do
  initGUI

  -- Create the menus
  fileAct <- actionNew "FileAction" (__"File") Nothing Nothing
  editAct <- actionNew "EditAction" (__"Edit") Nothing Nothing

  -- Create menu items
  newAct <- actionNew "NewAction" (__"New")
            (Just (__"Clear the spreadsheet area."))
            (Just stockNew)
  on newAct actionActivated $ putStrLn "New activated."
  openAct <- actionNew "OpenAction" (__"Open")
            (Just (__"Open an existing spreadsheet."))
            (Just stockOpen)
  on openAct actionActivated $ putStrLn "Open activated."
  saveAct <- actionNew "SaveAction" (__"Save")
            (Just (__"Save the current spreadsheet."))
            (Just stockSave)
  on saveAct actionActivated $ putStrLn "Save activated."
  saveAsAct <- actionNew "SaveAsAction" (__"SaveAs")
            (Just (__"Save spreadsheet under new name."))
            (Just stockSaveAs)
  on saveAsAct actionActivated $ putStrLn "SaveAs activated."
  exitAct <- actionNew "ExitAction" (__"Exit")
            (Just (__"Exit this application."))
            (Just stockSaveAs)
  on exitAct actionActivated $ mainQuit
  cutAct <- actionNew "CutAction" (__"Cut")
            (Just (__"Cut out the current selection."))
            (Just stockCut)
  on cutAct actionActivated $ putStrLn "Cut activated."
  copyAct <- actionNew "CopyAction" (__"Copy")
            (Just (__"Copy the current selection."))
            (Just stockCopy)
  on copyAct actionActivated $ putStrLn "Copy activated."
  pasteAct <- actionNew "PasteAction" (__"Paste")
            (Just (__"Paste the current selection."))
            (Just stockPaste)
  on pasteAct actionActivated $ putStrLn "Paste activated."

  standardGroup <- actionGroupNew ("standard"::Text)
  mapM_ (actionGroupAddAction standardGroup) [fileAct, editAct]
  mapM_ (\act -> actionGroupAddActionWithAccel standardGroup act (Nothing::Maybe Text))
    [newAct, openAct, saveAct, saveAsAct, exitAct, cutAct, copyAct, pasteAct]

  ui <- uiManagerNew
  mid <- uiManagerAddUiFromString ui uiDef
  uiManagerInsertActionGroup ui standardGroup 0

  win <- windowNew
  on win objectDestroy mainQuit
  on win sizeRequest $ return (Requisition 200 100)
  (Just menuBar) <- uiManagerGetWidget ui ("/ui/menubar"::Text)
  (Just toolBar) <- uiManagerGetWidget ui ("/ui/toolbar"::Text)

  edit <- textViewNew
  vBox <- vBoxNew False 0
  set vBox [boxHomogeneous := False]
  boxPackStart vBox menuBar PackNatural 0
  boxPackStart vBox toolBar PackNatural 0
  boxPackStart vBox edit PackGrow 0

  containerAdd win vBox
  widgetShowAll win

  mainGUI