{- |
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.MenuItem
    ( 

-- * Exported types
    MenuItem(..)                            ,
    MenuItemK                               ,
    toMenuItem                              ,
    noMenuItem                              ,


 -- * Methods
-- ** menuItemGetAttributeValue
    menuItemGetAttributeValue               ,


-- ** menuItemGetLink
    menuItemGetLink                         ,


-- ** menuItemNew
    menuItemNew                             ,


-- ** menuItemNewFromModel
    menuItemNewFromModel                    ,


-- ** menuItemNewSection
    menuItemNewSection                      ,


-- ** menuItemNewSubmenu
    menuItemNewSubmenu                      ,


-- ** menuItemSetActionAndTargetValue
    menuItemSetActionAndTargetValue         ,


-- ** menuItemSetAttributeValue
    menuItemSetAttributeValue               ,


-- ** menuItemSetDetailedAction
    menuItemSetDetailedAction               ,


-- ** menuItemSetIcon
    menuItemSetIcon                         ,


-- ** menuItemSetLabel
    menuItemSetLabel                        ,


-- ** menuItemSetLink
    menuItemSetLink                         ,


-- ** menuItemSetSection
    menuItemSetSection                      ,


-- ** menuItemSetSubmenu
    menuItemSetSubmenu                      ,




    ) 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.GLib as GLib
import qualified GI.GObject as GObject

newtype MenuItem = MenuItem (ForeignPtr MenuItem)
foreign import ccall "g_menu_item_get_type"
    c_g_menu_item_get_type :: IO GType

type instance ParentTypes MenuItem = MenuItemParentTypes
type MenuItemParentTypes = '[GObject.Object]

instance GObject MenuItem where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_menu_item_get_type
    

class GObject o => MenuItemK o
instance (GObject o, IsDescendantOf MenuItem o) => MenuItemK o

toMenuItem :: MenuItemK o => o -> IO MenuItem
toMenuItem = unsafeCastTo MenuItem

noMenuItem :: Maybe MenuItem
noMenuItem = Nothing

type instance AttributeList MenuItem = MenuItemAttributeList
type MenuItemAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList MenuItem = MenuItemSignalList
type MenuItemSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method MenuItem::new
-- method type : Constructor
-- Args : [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 = "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 : TInterface "Gio" "MenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_item_new" g_menu_item_new :: 
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- detailed_action : TBasicType TUTF8
    IO (Ptr MenuItem)


menuItemNew ::
    (MonadIO m) =>
    Maybe (T.Text) ->                       -- label
    Maybe (T.Text) ->                       -- detailed_action
    m MenuItem
menuItemNew label detailed_action = liftIO $ do
    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'
    result <- g_menu_item_new maybeLabel maybeDetailed_action
    checkUnexpectedReturnNULL "g_menu_item_new" result
    result' <- (wrapObject MenuItem) result
    freeMem maybeLabel
    freeMem maybeDetailed_action
    return result'

-- method MenuItem::new_from_model
-- method type : Constructor
-- Args : [Arg {argName = "model", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item_index", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "model", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "item_index", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "MenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_item_new_from_model" g_menu_item_new_from_model :: 
    Ptr MenuModel ->                        -- model : TInterface "Gio" "MenuModel"
    Int32 ->                                -- item_index : TBasicType TInt32
    IO (Ptr MenuItem)


menuItemNewFromModel ::
    (MonadIO m, MenuModelK a) =>
    a ->                                    -- model
    Int32 ->                                -- item_index
    m MenuItem
menuItemNewFromModel model item_index = liftIO $ do
    let model' = unsafeManagedPtrCastPtr model
    result <- g_menu_item_new_from_model model' item_index
    checkUnexpectedReturnNULL "g_menu_item_new_from_model" result
    result' <- (wrapObject MenuItem) result
    touchManagedPtr model
    return result'

-- method MenuItem::new_section
-- method type : Constructor
-- Args : [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 = "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 : TInterface "Gio" "MenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_item_new_section" g_menu_item_new_section :: 
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- section : TInterface "Gio" "MenuModel"
    IO (Ptr MenuItem)


menuItemNewSection ::
    (MonadIO m, MenuModelK a) =>
    Maybe (T.Text) ->                       -- label
    a ->                                    -- section
    m MenuItem
menuItemNewSection label section = liftIO $ do
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let section' = unsafeManagedPtrCastPtr section
    result <- g_menu_item_new_section maybeLabel section'
    checkUnexpectedReturnNULL "g_menu_item_new_section" result
    result' <- (wrapObject MenuItem) result
    touchManagedPtr section
    freeMem maybeLabel
    return result'

-- method MenuItem::new_submenu
-- method type : Constructor
-- Args : [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 = "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 : TInterface "Gio" "MenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_item_new_submenu" g_menu_item_new_submenu :: 
    CString ->                              -- label : TBasicType TUTF8
    Ptr MenuModel ->                        -- submenu : TInterface "Gio" "MenuModel"
    IO (Ptr MenuItem)


menuItemNewSubmenu ::
    (MonadIO m, MenuModelK a) =>
    Maybe (T.Text) ->                       -- label
    a ->                                    -- submenu
    m MenuItem
menuItemNewSubmenu label submenu = liftIO $ do
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    let submenu' = unsafeManagedPtrCastPtr submenu
    result <- g_menu_item_new_submenu maybeLabel submenu'
    checkUnexpectedReturnNULL "g_menu_item_new_submenu" result
    result' <- (wrapObject MenuItem) result
    touchManagedPtr submenu
    freeMem maybeLabel
    return result'

-- method MenuItem::get_attribute_value
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "expected_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "expected_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_item_get_attribute_value" g_menu_item_get_attribute_value :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- attribute : TBasicType TUTF8
    Ptr GLib.VariantType ->                 -- expected_type : TInterface "GLib" "VariantType"
    IO (Ptr GVariant)


menuItemGetAttributeValue ::
    (MonadIO m, MenuItemK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- attribute
    Maybe (GLib.VariantType) ->             -- expected_type
    m GVariant
menuItemGetAttributeValue _obj attribute expected_type = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    attribute' <- textToCString attribute
    maybeExpected_type <- case expected_type of
        Nothing -> return nullPtr
        Just jExpected_type -> do
            let jExpected_type' = unsafeManagedPtrGetPtr jExpected_type
            return jExpected_type'
    result <- g_menu_item_get_attribute_value _obj' attribute' maybeExpected_type
    checkUnexpectedReturnNULL "g_menu_item_get_attribute_value" result
    result' <- wrapGVariantPtr result
    touchManagedPtr _obj
    whenJust expected_type touchManagedPtr
    freeMem attribute'
    return result'

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

foreign import ccall "g_menu_item_get_link" g_menu_item_get_link :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- link : TBasicType TUTF8
    IO (Ptr MenuModel)


menuItemGetLink ::
    (MonadIO m, MenuItemK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- link
    m MenuModel
menuItemGetLink _obj link = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    link' <- textToCString link
    result <- g_menu_item_get_link _obj' link'
    checkUnexpectedReturnNULL "g_menu_item_get_link" result
    result' <- (wrapObject MenuModel) result
    touchManagedPtr _obj
    freeMem link'
    return result'

-- method MenuItem::set_action_and_target_value
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target_value", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target_value", argType = TVariant, 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_item_set_action_and_target_value" g_menu_item_set_action_and_target_value :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- action : TBasicType TUTF8
    Ptr GVariant ->                         -- target_value : TVariant
    IO ()


menuItemSetActionAndTargetValue ::
    (MonadIO m, MenuItemK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- action
    Maybe (GVariant) ->                     -- target_value
    m ()
menuItemSetActionAndTargetValue _obj action target_value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeAction <- case action of
        Nothing -> return nullPtr
        Just jAction -> do
            jAction' <- textToCString jAction
            return jAction'
    maybeTarget_value <- case target_value of
        Nothing -> return nullPtr
        Just jTarget_value -> do
            let jTarget_value' = unsafeManagedPtrGetPtr jTarget_value
            return jTarget_value'
    g_menu_item_set_action_and_target_value _obj' maybeAction maybeTarget_value
    touchManagedPtr _obj
    freeMem maybeAction
    return ()

-- method MenuItem::set_attribute_value
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, 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_item_set_attribute_value" g_menu_item_set_attribute_value :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- attribute : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    IO ()


menuItemSetAttributeValue ::
    (MonadIO m, MenuItemK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- attribute
    Maybe (GVariant) ->                     -- value
    m ()
menuItemSetAttributeValue _obj attribute value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    attribute' <- textToCString attribute
    maybeValue <- case value of
        Nothing -> return nullPtr
        Just jValue -> do
            let jValue' = unsafeManagedPtrGetPtr jValue
            return jValue'
    g_menu_item_set_attribute_value _obj' attribute' maybeValue
    touchManagedPtr _obj
    freeMem attribute'
    return ()

-- method MenuItem::set_detailed_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detailed_action", argType = TBasicType TUTF8, 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_item_set_detailed_action" g_menu_item_set_detailed_action :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- detailed_action : TBasicType TUTF8
    IO ()


menuItemSetDetailedAction ::
    (MonadIO m, MenuItemK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- detailed_action
    m ()
menuItemSetDetailedAction _obj detailed_action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    detailed_action' <- textToCString detailed_action
    g_menu_item_set_detailed_action _obj' detailed_action'
    touchManagedPtr _obj
    freeMem detailed_action'
    return ()

-- method MenuItem::set_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", 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_item_set_icon" g_menu_item_set_icon :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    Ptr Icon ->                             -- icon : TInterface "Gio" "Icon"
    IO ()


menuItemSetIcon ::
    (MonadIO m, MenuItemK a, IconK b) =>
    a ->                                    -- _obj
    b ->                                    -- icon
    m ()
menuItemSetIcon _obj icon = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let icon' = unsafeManagedPtrCastPtr icon
    g_menu_item_set_icon _obj' icon'
    touchManagedPtr _obj
    touchManagedPtr icon
    return ()

-- method MenuItem::set_label
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", 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}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", 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}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_item_set_label" g_menu_item_set_label :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- label : TBasicType TUTF8
    IO ()


menuItemSetLabel ::
    (MonadIO m, MenuItemK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- label
    m ()
menuItemSetLabel _obj label = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    g_menu_item_set_label _obj' maybeLabel
    touchManagedPtr _obj
    freeMem maybeLabel
    return ()

-- method MenuItem::set_link
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "link", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "model", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "link", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "model", argType = TInterface "Gio" "MenuModel", 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_item_set_link" g_menu_item_set_link :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    CString ->                              -- link : TBasicType TUTF8
    Ptr MenuModel ->                        -- model : TInterface "Gio" "MenuModel"
    IO ()


menuItemSetLink ::
    (MonadIO m, MenuItemK a, MenuModelK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- link
    Maybe (b) ->                            -- model
    m ()
menuItemSetLink _obj link model = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    link' <- textToCString link
    maybeModel <- case model of
        Nothing -> return nullPtr
        Just jModel -> do
            let jModel' = unsafeManagedPtrCastPtr jModel
            return jModel'
    g_menu_item_set_link _obj' link' maybeModel
    touchManagedPtr _obj
    whenJust model touchManagedPtr
    freeMem link'
    return ()

-- method MenuItem::set_section
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "section", argType = TInterface "Gio" "MenuModel", 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_item_set_section" g_menu_item_set_section :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    Ptr MenuModel ->                        -- section : TInterface "Gio" "MenuModel"
    IO ()


menuItemSetSection ::
    (MonadIO m, MenuItemK a, MenuModelK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- section
    m ()
menuItemSetSection _obj section = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeSection <- case section of
        Nothing -> return nullPtr
        Just jSection -> do
            let jSection' = unsafeManagedPtrCastPtr jSection
            return jSection'
    g_menu_item_set_section _obj' maybeSection
    touchManagedPtr _obj
    whenJust section touchManagedPtr
    return ()

-- method MenuItem::set_submenu
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "submenu", argType = TInterface "Gio" "MenuModel", 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_item_set_submenu" g_menu_item_set_submenu :: 
    Ptr MenuItem ->                         -- _obj : TInterface "Gio" "MenuItem"
    Ptr MenuModel ->                        -- submenu : TInterface "Gio" "MenuModel"
    IO ()


menuItemSetSubmenu ::
    (MonadIO m, MenuItemK a, MenuModelK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- submenu
    m ()
menuItemSetSubmenu _obj submenu = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeSubmenu <- case submenu of
        Nothing -> return nullPtr
        Just jSubmenu -> do
            let jSubmenu' = unsafeManagedPtrCastPtr jSubmenu
            return jSubmenu'
    g_menu_item_set_submenu _obj' maybeSubmenu
    touchManagedPtr _obj
    whenJust submenu touchManagedPtr
    return ()