{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gio.Objects.Menu
    ( 

-- * Exported types
    Menu(..)                                ,
    MenuK                                   ,
    toMenu                                  ,
    noMenu                                  ,


 -- * Methods
-- ** menuAppend
    menuAppend                              ,


-- ** menuAppendItem
    menuAppendItem                          ,


-- ** menuAppendSection
    menuAppendSection                       ,


-- ** menuAppendSubmenu
    menuAppendSubmenu                       ,


-- ** menuFreeze
    menuFreeze                              ,


-- ** menuInsert
    menuInsert                              ,


-- ** menuInsertItem
    menuInsertItem                          ,


-- ** menuInsertSection
    menuInsertSection                       ,


-- ** menuInsertSubmenu
    menuInsertSubmenu                       ,


-- ** menuNew
    menuNew                                 ,


-- ** menuPrepend
    menuPrepend                             ,


-- ** menuPrependItem
    menuPrependItem                         ,


-- ** menuPrependSection
    menuPrependSection                      ,


-- ** menuPrependSubmenu
    menuPrependSubmenu                      ,


-- ** menuRemove
    menuRemove                              ,


-- ** menuRemoveAll
    menuRemoveAll                           ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype Menu = Menu (ForeignPtr Menu)
foreign import ccall "g_menu_get_type"
    c_g_menu_get_type :: IO GType

type instance ParentTypes Menu = MenuParentTypes
type MenuParentTypes = '[MenuModel, GObject.Object]

instance GObject Menu where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_menu_get_type
    

class GObject o => MenuK o
instance (GObject o, IsDescendantOf Menu o) => MenuK o

toMenu :: MenuK o => o -> IO Menu
toMenu = unsafeCastTo Menu

noMenu :: Maybe Menu
noMenu = Nothing

type instance AttributeList Menu = MenuAttributeList
type MenuAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList Menu = MenuSignalList
type MenuSignalList = ('[ '("items-changed", MenuModelItemsChangedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Menu::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gio" "Menu"
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_new" g_menu_new :: 
    IO (Ptr Menu)


menuNew ::
    (MonadIO m) =>
    m Menu
menuNew  = liftIO $ do
    result <- g_menu_new
    checkUnexpectedReturnNULL "g_menu_new" result
    result' <- (wrapObject Menu) result
    return result'

-- method Menu::append
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_append" g_menu_append :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- detailed_action : TBasicType TUTF8
    IO ()


menuAppend ::
    (MonadIO m, MenuK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    Maybe (T.Text) ->                       -- detailed_action
    m ()
menuAppend _obj label detailed_action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    maybeDetailed_action <- case detailed_action of
        Nothing -> return nullPtr
        Just jDetailed_action -> do
            jDetailed_action' <- textToCString jDetailed_action
            return jDetailed_action'
    g_menu_append _obj' maybeLabel maybeDetailed_action
    touchManagedPtr _obj
    freeMem maybeLabel
    freeMem maybeDetailed_action
    return ()

-- method Menu::append_item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_append_item" g_menu_append_item :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Ptr MenuItem ->                         -- item : TInterface "Gio" "MenuItem"
    IO ()


menuAppendItem ::
    (MonadIO m, MenuK a, MenuItemK b) =>
    a ->                                    -- _obj
    b ->                                    -- item
    m ()
menuAppendItem _obj item = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let item' = unsafeManagedPtrCastPtr item
    g_menu_append_item _obj' item'
    touchManagedPtr _obj
    touchManagedPtr item
    return ()

-- method Menu::append_section
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_append_section" g_menu_append_section :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- section : TInterface "Gio" "MenuModel"
    IO ()


menuAppendSection ::
    (MonadIO m, MenuK a, MenuModelK b) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    b ->                                    -- section
    m ()
menuAppendSection _obj label section = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let section' = unsafeManagedPtrCastPtr section
    g_menu_append_section _obj' maybeLabel section'
    touchManagedPtr _obj
    touchManagedPtr section
    freeMem maybeLabel
    return ()

-- method Menu::append_submenu
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_append_submenu" g_menu_append_submenu :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- submenu : TInterface "Gio" "MenuModel"
    IO ()


menuAppendSubmenu ::
    (MonadIO m, MenuK a, MenuModelK b) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    b ->                                    -- submenu
    m ()
menuAppendSubmenu _obj label submenu = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let submenu' = unsafeManagedPtrCastPtr submenu
    g_menu_append_submenu _obj' maybeLabel submenu'
    touchManagedPtr _obj
    touchManagedPtr submenu
    freeMem maybeLabel
    return ()

-- method Menu::freeze
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_freeze" g_menu_freeze :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    IO ()


menuFreeze ::
    (MonadIO m, MenuK a) =>
    a ->                                    -- _obj
    m ()
menuFreeze _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_menu_freeze _obj'
    touchManagedPtr _obj
    return ()

-- method Menu::insert
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_insert" g_menu_insert :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Int32 ->                                -- position : TBasicType TInt32
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- detailed_action : TBasicType TUTF8
    IO ()


menuInsert ::
    (MonadIO m, MenuK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    Maybe (T.Text) ->                       -- label
    Maybe (T.Text) ->                       -- detailed_action
    m ()
menuInsert _obj position label detailed_action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    maybeDetailed_action <- case detailed_action of
        Nothing -> return nullPtr
        Just jDetailed_action -> do
            jDetailed_action' <- textToCString jDetailed_action
            return jDetailed_action'
    g_menu_insert _obj' position maybeLabel maybeDetailed_action
    touchManagedPtr _obj
    freeMem maybeLabel
    freeMem maybeDetailed_action
    return ()

-- method Menu::insert_item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_insert_item" g_menu_insert_item :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Int32 ->                                -- position : TBasicType TInt32
    Ptr MenuItem ->                         -- item : TInterface "Gio" "MenuItem"
    IO ()


menuInsertItem ::
    (MonadIO m, MenuK a, MenuItemK b) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    b ->                                    -- item
    m ()
menuInsertItem _obj position item = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let item' = unsafeManagedPtrCastPtr item
    g_menu_insert_item _obj' position item'
    touchManagedPtr _obj
    touchManagedPtr item
    return ()

-- method Menu::insert_section
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_insert_section" g_menu_insert_section :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Int32 ->                                -- position : TBasicType TInt32
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- section : TInterface "Gio" "MenuModel"
    IO ()


menuInsertSection ::
    (MonadIO m, MenuK a, MenuModelK b) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    Maybe (T.Text) ->                       -- label
    b ->                                    -- section
    m ()
menuInsertSection _obj position label section = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let section' = unsafeManagedPtrCastPtr section
    g_menu_insert_section _obj' position maybeLabel section'
    touchManagedPtr _obj
    touchManagedPtr section
    freeMem maybeLabel
    return ()

-- method Menu::insert_submenu
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_insert_submenu" g_menu_insert_submenu :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Int32 ->                                -- position : TBasicType TInt32
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- submenu : TInterface "Gio" "MenuModel"
    IO ()


menuInsertSubmenu ::
    (MonadIO m, MenuK a, MenuModelK b) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    Maybe (T.Text) ->                       -- label
    b ->                                    -- submenu
    m ()
menuInsertSubmenu _obj position label submenu = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let submenu' = unsafeManagedPtrCastPtr submenu
    g_menu_insert_submenu _obj' position maybeLabel submenu'
    touchManagedPtr _obj
    touchManagedPtr submenu
    freeMem maybeLabel
    return ()

-- method Menu::prepend
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_prepend" g_menu_prepend :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- detailed_action : TBasicType TUTF8
    IO ()


menuPrepend ::
    (MonadIO m, MenuK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    Maybe (T.Text) ->                       -- detailed_action
    m ()
menuPrepend _obj label detailed_action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    maybeDetailed_action <- case detailed_action of
        Nothing -> return nullPtr
        Just jDetailed_action -> do
            jDetailed_action' <- textToCString jDetailed_action
            return jDetailed_action'
    g_menu_prepend _obj' maybeLabel maybeDetailed_action
    touchManagedPtr _obj
    freeMem maybeLabel
    freeMem maybeDetailed_action
    return ()

-- method Menu::prepend_item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_prepend_item" g_menu_prepend_item :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Ptr MenuItem ->                         -- item : TInterface "Gio" "MenuItem"
    IO ()


menuPrependItem ::
    (MonadIO m, MenuK a, MenuItemK b) =>
    a ->                                    -- _obj
    b ->                                    -- item
    m ()
menuPrependItem _obj item = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let item' = unsafeManagedPtrCastPtr item
    g_menu_prepend_item _obj' item'
    touchManagedPtr _obj
    touchManagedPtr item
    return ()

-- method Menu::prepend_section
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_prepend_section" g_menu_prepend_section :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- section : TInterface "Gio" "MenuModel"
    IO ()


menuPrependSection ::
    (MonadIO m, MenuK a, MenuModelK b) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    b ->                                    -- section
    m ()
menuPrependSection _obj label section = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let section' = unsafeManagedPtrCastPtr section
    g_menu_prepend_section _obj' maybeLabel section'
    touchManagedPtr _obj
    touchManagedPtr section
    freeMem maybeLabel
    return ()

-- method Menu::prepend_submenu
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_prepend_submenu" g_menu_prepend_submenu :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- submenu : TInterface "Gio" "MenuModel"
    IO ()


menuPrependSubmenu ::
    (MonadIO m, MenuK a, MenuModelK b) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    b ->                                    -- submenu
    m ()
menuPrependSubmenu _obj label submenu = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let submenu' = unsafeManagedPtrCastPtr submenu
    g_menu_prepend_submenu _obj' maybeLabel submenu'
    touchManagedPtr _obj
    touchManagedPtr submenu
    freeMem maybeLabel
    return ()

-- method Menu::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_remove" g_menu_remove :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    Int32 ->                                -- position : TBasicType TInt32
    IO ()


menuRemove ::
    (MonadIO m, MenuK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    m ()
menuRemove _obj position = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_menu_remove _obj' position
    touchManagedPtr _obj
    return ()

-- method Menu::remove_all
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Menu", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_remove_all" g_menu_remove_all :: 
    Ptr Menu ->                             -- _obj : TInterface "Gio" "Menu"
    IO ()


menuRemoveAll ::
    (MonadIO m, MenuK a) =>
    a ->                                    -- _obj
    m ()
menuRemoveAll _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_menu_remove_all _obj'
    touchManagedPtr _obj
    return ()