{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

This is the 'GI.GObject.Objects.Object.Object' based object that represents a menu
item.  It gets created the same on both the client and
the server side and libdbusmenu-glib does the work of making
this object model appear on both sides of DBus.  Simple
really, though through updates and people coming on and off
the bus it can lead to lots of fun complex scenarios.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Dbusmenu.Objects.Menuitem
    (

-- * Exported types
    Menuitem(..)                            ,
    IsMenuitem                              ,
    toMenuitem                              ,
    noMenuitem                              ,


 -- * Methods
-- ** childAddPosition #method:childAddPosition#

#if ENABLE_OVERLOADING
    MenuitemChildAddPositionMethodInfo      ,
#endif
    menuitemChildAddPosition                ,


-- ** childAppend #method:childAppend#

#if ENABLE_OVERLOADING
    MenuitemChildAppendMethodInfo           ,
#endif
    menuitemChildAppend                     ,


-- ** childDelete #method:childDelete#

#if ENABLE_OVERLOADING
    MenuitemChildDeleteMethodInfo           ,
#endif
    menuitemChildDelete                     ,


-- ** childFind #method:childFind#

#if ENABLE_OVERLOADING
    MenuitemChildFindMethodInfo             ,
#endif
    menuitemChildFind                       ,


-- ** childPrepend #method:childPrepend#

#if ENABLE_OVERLOADING
    MenuitemChildPrependMethodInfo          ,
#endif
    menuitemChildPrepend                    ,


-- ** childReorder #method:childReorder#

#if ENABLE_OVERLOADING
    MenuitemChildReorderMethodInfo          ,
#endif
    menuitemChildReorder                    ,


-- ** findId #method:findId#

#if ENABLE_OVERLOADING
    MenuitemFindIdMethodInfo                ,
#endif
    menuitemFindId                          ,


-- ** foreach #method:foreach#

#if ENABLE_OVERLOADING
    MenuitemForeachMethodInfo               ,
#endif
    menuitemForeach                         ,


-- ** getChildren #method:getChildren#

#if ENABLE_OVERLOADING
    MenuitemGetChildrenMethodInfo           ,
#endif
    menuitemGetChildren                     ,


-- ** getId #method:getId#

#if ENABLE_OVERLOADING
    MenuitemGetIdMethodInfo                 ,
#endif
    menuitemGetId                           ,


-- ** getParent #method:getParent#

#if ENABLE_OVERLOADING
    MenuitemGetParentMethodInfo             ,
#endif
    menuitemGetParent                       ,


-- ** getPosition #method:getPosition#

#if ENABLE_OVERLOADING
    MenuitemGetPositionMethodInfo           ,
#endif
    menuitemGetPosition                     ,


-- ** getPositionRealized #method:getPositionRealized#

#if ENABLE_OVERLOADING
    MenuitemGetPositionRealizedMethodInfo   ,
#endif
    menuitemGetPositionRealized             ,


-- ** getRoot #method:getRoot#

#if ENABLE_OVERLOADING
    MenuitemGetRootMethodInfo               ,
#endif
    menuitemGetRoot                         ,


-- ** handleEvent #method:handleEvent#

#if ENABLE_OVERLOADING
    MenuitemHandleEventMethodInfo           ,
#endif
    menuitemHandleEvent                     ,


-- ** new #method:new#

    menuitemNew                             ,


-- ** newWithId #method:newWithId#

    menuitemNewWithId                       ,


-- ** propertiesCopy #method:propertiesCopy#

#if ENABLE_OVERLOADING
    MenuitemPropertiesCopyMethodInfo        ,
#endif
    menuitemPropertiesCopy                  ,


-- ** propertiesList #method:propertiesList#

#if ENABLE_OVERLOADING
    MenuitemPropertiesListMethodInfo        ,
#endif
    menuitemPropertiesList                  ,


-- ** propertyExist #method:propertyExist#

#if ENABLE_OVERLOADING
    MenuitemPropertyExistMethodInfo         ,
#endif
    menuitemPropertyExist                   ,


-- ** propertyGet #method:propertyGet#

#if ENABLE_OVERLOADING
    MenuitemPropertyGetMethodInfo           ,
#endif
    menuitemPropertyGet                     ,


-- ** propertyGetBool #method:propertyGetBool#

#if ENABLE_OVERLOADING
    MenuitemPropertyGetBoolMethodInfo       ,
#endif
    menuitemPropertyGetBool                 ,


-- ** propertyGetByteArray #method:propertyGetByteArray#

#if ENABLE_OVERLOADING
    MenuitemPropertyGetByteArrayMethodInfo  ,
#endif
    menuitemPropertyGetByteArray            ,


-- ** propertyGetInt #method:propertyGetInt#

#if ENABLE_OVERLOADING
    MenuitemPropertyGetIntMethodInfo        ,
#endif
    menuitemPropertyGetInt                  ,


-- ** propertyGetVariant #method:propertyGetVariant#

#if ENABLE_OVERLOADING
    MenuitemPropertyGetVariantMethodInfo    ,
#endif
    menuitemPropertyGetVariant              ,


-- ** propertyRemove #method:propertyRemove#

#if ENABLE_OVERLOADING
    MenuitemPropertyRemoveMethodInfo        ,
#endif
    menuitemPropertyRemove                  ,


-- ** propertySet #method:propertySet#

#if ENABLE_OVERLOADING
    MenuitemPropertySetMethodInfo           ,
#endif
    menuitemPropertySet                     ,


-- ** propertySetBool #method:propertySetBool#

#if ENABLE_OVERLOADING
    MenuitemPropertySetBoolMethodInfo       ,
#endif
    menuitemPropertySetBool                 ,


-- ** propertySetByteArray #method:propertySetByteArray#

#if ENABLE_OVERLOADING
    MenuitemPropertySetByteArrayMethodInfo  ,
#endif
    menuitemPropertySetByteArray            ,


-- ** propertySetInt #method:propertySetInt#

#if ENABLE_OVERLOADING
    MenuitemPropertySetIntMethodInfo        ,
#endif
    menuitemPropertySetInt                  ,


-- ** propertySetVariant #method:propertySetVariant#

#if ENABLE_OVERLOADING
    MenuitemPropertySetVariantMethodInfo    ,
#endif
    menuitemPropertySetVariant              ,


-- ** sendAboutToShow #method:sendAboutToShow#

#if ENABLE_OVERLOADING
    MenuitemSendAboutToShowMethodInfo       ,
#endif
    menuitemSendAboutToShow                 ,


-- ** setParent #method:setParent#

#if ENABLE_OVERLOADING
    MenuitemSetParentMethodInfo             ,
#endif
    menuitemSetParent                       ,


-- ** setRoot #method:setRoot#

#if ENABLE_OVERLOADING
    MenuitemSetRootMethodInfo               ,
#endif
    menuitemSetRoot                         ,


-- ** showToUser #method:showToUser#

#if ENABLE_OVERLOADING
    MenuitemShowToUserMethodInfo            ,
#endif
    menuitemShowToUser                      ,


-- ** takeChildren #method:takeChildren#

#if ENABLE_OVERLOADING
    MenuitemTakeChildrenMethodInfo          ,
#endif
    menuitemTakeChildren                    ,


-- ** unparent #method:unparent#

#if ENABLE_OVERLOADING
    MenuitemUnparentMethodInfo              ,
#endif
    menuitemUnparent                        ,




 -- * Properties
-- ** id #attr:id#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    MenuitemIdPropertyInfo                  ,
#endif
    constructMenuitemId                     ,
    getMenuitemId                           ,
#if ENABLE_OVERLOADING
    menuitemId                              ,
#endif




 -- * Signals
-- ** aboutToShow #signal:aboutToShow#

    C_MenuitemAboutToShowCallback           ,
    MenuitemAboutToShowCallback             ,
#if ENABLE_OVERLOADING
    MenuitemAboutToShowSignalInfo           ,
#endif
    afterMenuitemAboutToShow                ,
    genClosure_MenuitemAboutToShow          ,
    mk_MenuitemAboutToShowCallback          ,
    noMenuitemAboutToShowCallback           ,
    onMenuitemAboutToShow                   ,
    wrap_MenuitemAboutToShowCallback        ,


-- ** childAdded #signal:childAdded#

    C_MenuitemChildAddedCallback            ,
    MenuitemChildAddedCallback              ,
#if ENABLE_OVERLOADING
    MenuitemChildAddedSignalInfo            ,
#endif
    afterMenuitemChildAdded                 ,
    genClosure_MenuitemChildAdded           ,
    mk_MenuitemChildAddedCallback           ,
    noMenuitemChildAddedCallback            ,
    onMenuitemChildAdded                    ,
    wrap_MenuitemChildAddedCallback         ,


-- ** childMoved #signal:childMoved#

    C_MenuitemChildMovedCallback            ,
    MenuitemChildMovedCallback              ,
#if ENABLE_OVERLOADING
    MenuitemChildMovedSignalInfo            ,
#endif
    afterMenuitemChildMoved                 ,
    genClosure_MenuitemChildMoved           ,
    mk_MenuitemChildMovedCallback           ,
    noMenuitemChildMovedCallback            ,
    onMenuitemChildMoved                    ,
    wrap_MenuitemChildMovedCallback         ,


-- ** childRemoved #signal:childRemoved#

    C_MenuitemChildRemovedCallback          ,
    MenuitemChildRemovedCallback            ,
#if ENABLE_OVERLOADING
    MenuitemChildRemovedSignalInfo          ,
#endif
    afterMenuitemChildRemoved               ,
    genClosure_MenuitemChildRemoved         ,
    mk_MenuitemChildRemovedCallback         ,
    noMenuitemChildRemovedCallback          ,
    onMenuitemChildRemoved                  ,
    wrap_MenuitemChildRemovedCallback       ,


-- ** event #signal:event#

    C_MenuitemEventCallback                 ,
    MenuitemEventCallback                   ,
#if ENABLE_OVERLOADING
    MenuitemEventSignalInfo                 ,
#endif
    afterMenuitemEvent                      ,
    genClosure_MenuitemEvent                ,
    mk_MenuitemEventCallback                ,
    noMenuitemEventCallback                 ,
    onMenuitemEvent                         ,
    wrap_MenuitemEventCallback              ,


-- ** itemActivated #signal:itemActivated#

    C_MenuitemItemActivatedCallback         ,
    MenuitemItemActivatedCallback           ,
#if ENABLE_OVERLOADING
    MenuitemItemActivatedSignalInfo         ,
#endif
    afterMenuitemItemActivated              ,
    genClosure_MenuitemItemActivated        ,
    mk_MenuitemItemActivatedCallback        ,
    noMenuitemItemActivatedCallback         ,
    onMenuitemItemActivated                 ,
    wrap_MenuitemItemActivatedCallback      ,


-- ** propertyChanged #signal:propertyChanged#

    C_MenuitemPropertyChangedCallback       ,
    MenuitemPropertyChangedCallback         ,
#if ENABLE_OVERLOADING
    MenuitemPropertyChangedSignalInfo       ,
#endif
    afterMenuitemPropertyChanged            ,
    genClosure_MenuitemPropertyChanged      ,
    mk_MenuitemPropertyChangedCallback      ,
    noMenuitemPropertyChangedCallback       ,
    onMenuitemPropertyChanged               ,
    wrap_MenuitemPropertyChangedCallback    ,


-- ** realized #signal:realized#

    C_MenuitemRealizedCallback              ,
    MenuitemRealizedCallback                ,
#if ENABLE_OVERLOADING
    MenuitemRealizedSignalInfo              ,
#endif
    afterMenuitemRealized                   ,
    genClosure_MenuitemRealized             ,
    mk_MenuitemRealizedCallback             ,
    noMenuitemRealizedCallback              ,
    onMenuitemRealized                      ,
    wrap_MenuitemRealizedCallback           ,


-- ** showToUser #signal:showToUser#

    C_MenuitemShowToUserCallback            ,
    MenuitemShowToUserCallback              ,
#if ENABLE_OVERLOADING
    MenuitemShowToUserSignalInfo            ,
#endif
    afterMenuitemShowToUser                 ,
    genClosure_MenuitemShowToUser           ,
    mk_MenuitemShowToUserCallback           ,
    noMenuitemShowToUserCallback            ,
    onMenuitemShowToUser                    ,
    wrap_MenuitemShowToUserCallback         ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype Menuitem = Menuitem (ManagedPtr Menuitem)
foreign import ccall "dbusmenu_menuitem_get_type"
    c_dbusmenu_menuitem_get_type :: IO GType

instance GObject Menuitem where
    gobjectType = c_dbusmenu_menuitem_get_type


-- | Type class for types which can be safely cast to `Menuitem`, for instance with `toMenuitem`.
class (GObject o, O.IsDescendantOf Menuitem o) => IsMenuitem o
instance (GObject o, O.IsDescendantOf Menuitem o) => IsMenuitem o

instance O.HasParentTypes Menuitem
type instance O.ParentTypes Menuitem = '[GObject.Object.Object]

-- | Cast to `Menuitem`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toMenuitem :: (MonadIO m, IsMenuitem o) => o -> m Menuitem
toMenuitem = liftIO . unsafeCastTo Menuitem

-- | A convenience alias for `Nothing` :: `Maybe` `Menuitem`.
noMenuitem :: Maybe Menuitem
noMenuitem = Nothing

#if ENABLE_OVERLOADING
type family ResolveMenuitemMethod (t :: Symbol) (o :: *) :: * where
    ResolveMenuitemMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveMenuitemMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveMenuitemMethod "childAddPosition" o = MenuitemChildAddPositionMethodInfo
    ResolveMenuitemMethod "childAppend" o = MenuitemChildAppendMethodInfo
    ResolveMenuitemMethod "childDelete" o = MenuitemChildDeleteMethodInfo
    ResolveMenuitemMethod "childFind" o = MenuitemChildFindMethodInfo
    ResolveMenuitemMethod "childPrepend" o = MenuitemChildPrependMethodInfo
    ResolveMenuitemMethod "childReorder" o = MenuitemChildReorderMethodInfo
    ResolveMenuitemMethod "findId" o = MenuitemFindIdMethodInfo
    ResolveMenuitemMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveMenuitemMethod "foreach" o = MenuitemForeachMethodInfo
    ResolveMenuitemMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveMenuitemMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveMenuitemMethod "handleEvent" o = MenuitemHandleEventMethodInfo
    ResolveMenuitemMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveMenuitemMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveMenuitemMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveMenuitemMethod "propertiesCopy" o = MenuitemPropertiesCopyMethodInfo
    ResolveMenuitemMethod "propertiesList" o = MenuitemPropertiesListMethodInfo
    ResolveMenuitemMethod "propertyExist" o = MenuitemPropertyExistMethodInfo
    ResolveMenuitemMethod "propertyGet" o = MenuitemPropertyGetMethodInfo
    ResolveMenuitemMethod "propertyGetBool" o = MenuitemPropertyGetBoolMethodInfo
    ResolveMenuitemMethod "propertyGetByteArray" o = MenuitemPropertyGetByteArrayMethodInfo
    ResolveMenuitemMethod "propertyGetInt" o = MenuitemPropertyGetIntMethodInfo
    ResolveMenuitemMethod "propertyGetVariant" o = MenuitemPropertyGetVariantMethodInfo
    ResolveMenuitemMethod "propertyRemove" o = MenuitemPropertyRemoveMethodInfo
    ResolveMenuitemMethod "propertySet" o = MenuitemPropertySetMethodInfo
    ResolveMenuitemMethod "propertySetBool" o = MenuitemPropertySetBoolMethodInfo
    ResolveMenuitemMethod "propertySetByteArray" o = MenuitemPropertySetByteArrayMethodInfo
    ResolveMenuitemMethod "propertySetInt" o = MenuitemPropertySetIntMethodInfo
    ResolveMenuitemMethod "propertySetVariant" o = MenuitemPropertySetVariantMethodInfo
    ResolveMenuitemMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveMenuitemMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveMenuitemMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveMenuitemMethod "sendAboutToShow" o = MenuitemSendAboutToShowMethodInfo
    ResolveMenuitemMethod "showToUser" o = MenuitemShowToUserMethodInfo
    ResolveMenuitemMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveMenuitemMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveMenuitemMethod "takeChildren" o = MenuitemTakeChildrenMethodInfo
    ResolveMenuitemMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveMenuitemMethod "unparent" o = MenuitemUnparentMethodInfo
    ResolveMenuitemMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveMenuitemMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveMenuitemMethod "getChildren" o = MenuitemGetChildrenMethodInfo
    ResolveMenuitemMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveMenuitemMethod "getId" o = MenuitemGetIdMethodInfo
    ResolveMenuitemMethod "getParent" o = MenuitemGetParentMethodInfo
    ResolveMenuitemMethod "getPosition" o = MenuitemGetPositionMethodInfo
    ResolveMenuitemMethod "getPositionRealized" o = MenuitemGetPositionRealizedMethodInfo
    ResolveMenuitemMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveMenuitemMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveMenuitemMethod "getRoot" o = MenuitemGetRootMethodInfo
    ResolveMenuitemMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveMenuitemMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveMenuitemMethod "setParent" o = MenuitemSetParentMethodInfo
    ResolveMenuitemMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveMenuitemMethod "setRoot" o = MenuitemSetRootMethodInfo
    ResolveMenuitemMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveMenuitemMethod t Menuitem, O.MethodInfo info Menuitem p) => OL.IsLabel t (Menuitem -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- signal Menuitem::about-to-show
{- |
Emitted when the submenu for this item
		is about to be shown
-}
type MenuitemAboutToShowCallback =
    IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemAboutToShowCallback`@.
noMenuitemAboutToShowCallback :: Maybe MenuitemAboutToShowCallback
noMenuitemAboutToShowCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemAboutToShowCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO CInt

-- | Generate a function pointer callable from C code, from a `C_MenuitemAboutToShowCallback`.
foreign import ccall "wrapper"
    mk_MenuitemAboutToShowCallback :: C_MenuitemAboutToShowCallback -> IO (FunPtr C_MenuitemAboutToShowCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemAboutToShow :: MonadIO m => MenuitemAboutToShowCallback -> m (GClosure C_MenuitemAboutToShowCallback)
genClosure_MenuitemAboutToShow cb = liftIO $ do
    let cb' = wrap_MenuitemAboutToShowCallback cb
    mk_MenuitemAboutToShowCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemAboutToShowCallback` into a `C_MenuitemAboutToShowCallback`.
wrap_MenuitemAboutToShowCallback ::
    MenuitemAboutToShowCallback ->
    C_MenuitemAboutToShowCallback
wrap_MenuitemAboutToShowCallback _cb _ _ = do
    result <- _cb
    let result' = (fromIntegral . fromEnum) result
    return result'


{- |
Connect a signal handler for the “@about-to-show@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #aboutToShow callback
@
-}
onMenuitemAboutToShow :: (IsMenuitem a, MonadIO m) => a -> MenuitemAboutToShowCallback -> m SignalHandlerId
onMenuitemAboutToShow obj cb = liftIO $ do
    let cb' = wrap_MenuitemAboutToShowCallback cb
    cb'' <- mk_MenuitemAboutToShowCallback cb'
    connectSignalFunPtr obj "about-to-show" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@about-to-show@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #aboutToShow callback
@
-}
afterMenuitemAboutToShow :: (IsMenuitem a, MonadIO m) => a -> MenuitemAboutToShowCallback -> m SignalHandlerId
afterMenuitemAboutToShow obj cb = liftIO $ do
    let cb' = wrap_MenuitemAboutToShowCallback cb
    cb'' <- mk_MenuitemAboutToShowCallback cb'
    connectSignalFunPtr obj "about-to-show" cb'' SignalConnectAfter


-- signal Menuitem::child-added
{- |
Signaled when the child menuitem has been added to
		the parent.
-}
type MenuitemChildAddedCallback =
    GObject.Object.Object
    {- ^ /@arg1@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' which is the child. -}
    -> Word32
    {- ^ /@arg2@/: The position that the child is being added in. -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemChildAddedCallback`@.
noMenuitemChildAddedCallback :: Maybe MenuitemChildAddedCallback
noMenuitemChildAddedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemChildAddedCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemChildAddedCallback`.
foreign import ccall "wrapper"
    mk_MenuitemChildAddedCallback :: C_MenuitemChildAddedCallback -> IO (FunPtr C_MenuitemChildAddedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemChildAdded :: MonadIO m => MenuitemChildAddedCallback -> m (GClosure C_MenuitemChildAddedCallback)
genClosure_MenuitemChildAdded cb = liftIO $ do
    let cb' = wrap_MenuitemChildAddedCallback cb
    mk_MenuitemChildAddedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemChildAddedCallback` into a `C_MenuitemChildAddedCallback`.
wrap_MenuitemChildAddedCallback ::
    MenuitemChildAddedCallback ->
    C_MenuitemChildAddedCallback
wrap_MenuitemChildAddedCallback _cb _ arg1 arg2 _ = do
    arg1' <- (newObject GObject.Object.Object) arg1
    _cb  arg1' arg2


{- |
Connect a signal handler for the “@child-added@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #childAdded callback
@
-}
onMenuitemChildAdded :: (IsMenuitem a, MonadIO m) => a -> MenuitemChildAddedCallback -> m SignalHandlerId
onMenuitemChildAdded obj cb = liftIO $ do
    let cb' = wrap_MenuitemChildAddedCallback cb
    cb'' <- mk_MenuitemChildAddedCallback cb'
    connectSignalFunPtr obj "child-added" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@child-added@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #childAdded callback
@
-}
afterMenuitemChildAdded :: (IsMenuitem a, MonadIO m) => a -> MenuitemChildAddedCallback -> m SignalHandlerId
afterMenuitemChildAdded obj cb = liftIO $ do
    let cb' = wrap_MenuitemChildAddedCallback cb
    cb'' <- mk_MenuitemChildAddedCallback cb'
    connectSignalFunPtr obj "child-added" cb'' SignalConnectAfter


-- signal Menuitem::child-moved
{- |
Signaled when the child menuitem has had its location
		in the list change.
-}
type MenuitemChildMovedCallback =
    GObject.Object.Object
    {- ^ /@arg1@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' which is the child. -}
    -> Word32
    {- ^ /@arg2@/: The position that the child is being moved to. -}
    -> Word32
    {- ^ /@arg3@/: The position that the child is was in. -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemChildMovedCallback`@.
noMenuitemChildMovedCallback :: Maybe MenuitemChildMovedCallback
noMenuitemChildMovedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemChildMovedCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Word32 ->
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemChildMovedCallback`.
foreign import ccall "wrapper"
    mk_MenuitemChildMovedCallback :: C_MenuitemChildMovedCallback -> IO (FunPtr C_MenuitemChildMovedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemChildMoved :: MonadIO m => MenuitemChildMovedCallback -> m (GClosure C_MenuitemChildMovedCallback)
genClosure_MenuitemChildMoved cb = liftIO $ do
    let cb' = wrap_MenuitemChildMovedCallback cb
    mk_MenuitemChildMovedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemChildMovedCallback` into a `C_MenuitemChildMovedCallback`.
wrap_MenuitemChildMovedCallback ::
    MenuitemChildMovedCallback ->
    C_MenuitemChildMovedCallback
wrap_MenuitemChildMovedCallback _cb _ arg1 arg2 arg3 _ = do
    arg1' <- (newObject GObject.Object.Object) arg1
    _cb  arg1' arg2 arg3


{- |
Connect a signal handler for the “@child-moved@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #childMoved callback
@
-}
onMenuitemChildMoved :: (IsMenuitem a, MonadIO m) => a -> MenuitemChildMovedCallback -> m SignalHandlerId
onMenuitemChildMoved obj cb = liftIO $ do
    let cb' = wrap_MenuitemChildMovedCallback cb
    cb'' <- mk_MenuitemChildMovedCallback cb'
    connectSignalFunPtr obj "child-moved" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@child-moved@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #childMoved callback
@
-}
afterMenuitemChildMoved :: (IsMenuitem a, MonadIO m) => a -> MenuitemChildMovedCallback -> m SignalHandlerId
afterMenuitemChildMoved obj cb = liftIO $ do
    let cb' = wrap_MenuitemChildMovedCallback cb
    cb'' <- mk_MenuitemChildMovedCallback cb'
    connectSignalFunPtr obj "child-moved" cb'' SignalConnectAfter


-- signal Menuitem::child-removed
{- |
Signaled when the child menuitem has been requested to
		be removed from the parent.  This signal is called when
		it has been removed from the list but not yet had
		@/g_object_unref/@ called on it.
-}
type MenuitemChildRemovedCallback =
    GObject.Object.Object
    {- ^ /@arg1@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' which was the child. -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemChildRemovedCallback`@.
noMenuitemChildRemovedCallback :: Maybe MenuitemChildRemovedCallback
noMenuitemChildRemovedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemChildRemovedCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemChildRemovedCallback`.
foreign import ccall "wrapper"
    mk_MenuitemChildRemovedCallback :: C_MenuitemChildRemovedCallback -> IO (FunPtr C_MenuitemChildRemovedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemChildRemoved :: MonadIO m => MenuitemChildRemovedCallback -> m (GClosure C_MenuitemChildRemovedCallback)
genClosure_MenuitemChildRemoved cb = liftIO $ do
    let cb' = wrap_MenuitemChildRemovedCallback cb
    mk_MenuitemChildRemovedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemChildRemovedCallback` into a `C_MenuitemChildRemovedCallback`.
wrap_MenuitemChildRemovedCallback ::
    MenuitemChildRemovedCallback ->
    C_MenuitemChildRemovedCallback
wrap_MenuitemChildRemovedCallback _cb _ arg1 _ = do
    arg1' <- (newObject GObject.Object.Object) arg1
    _cb  arg1'


{- |
Connect a signal handler for the “@child-removed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #childRemoved callback
@
-}
onMenuitemChildRemoved :: (IsMenuitem a, MonadIO m) => a -> MenuitemChildRemovedCallback -> m SignalHandlerId
onMenuitemChildRemoved obj cb = liftIO $ do
    let cb' = wrap_MenuitemChildRemovedCallback cb
    cb'' <- mk_MenuitemChildRemovedCallback cb'
    connectSignalFunPtr obj "child-removed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@child-removed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #childRemoved callback
@
-}
afterMenuitemChildRemoved :: (IsMenuitem a, MonadIO m) => a -> MenuitemChildRemovedCallback -> m SignalHandlerId
afterMenuitemChildRemoved obj cb = liftIO $ do
    let cb' = wrap_MenuitemChildRemovedCallback cb
    cb'' <- mk_MenuitemChildRemovedCallback cb'
    connectSignalFunPtr obj "child-removed" cb'' SignalConnectAfter


-- signal Menuitem::event
{- |
Emitted when an event is passed through.  The event is signalled
		after handle_event is called.
-}
type MenuitemEventCallback =
    T.Text
    {- ^ /@arg1@/: Name of the event -}
    -> GVariant
    {- ^ /@arg2@/: Information passed along with the event -}
    -> Word32
    {- ^ /@arg3@/: X11 timestamp of when the event happened -}
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemEventCallback`@.
noMenuitemEventCallback :: Maybe MenuitemEventCallback
noMenuitemEventCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemEventCallback =
    Ptr () ->                               -- object
    CString ->
    Ptr GVariant ->
    Word32 ->
    Ptr () ->                               -- user_data
    IO CInt

-- | Generate a function pointer callable from C code, from a `C_MenuitemEventCallback`.
foreign import ccall "wrapper"
    mk_MenuitemEventCallback :: C_MenuitemEventCallback -> IO (FunPtr C_MenuitemEventCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemEvent :: MonadIO m => MenuitemEventCallback -> m (GClosure C_MenuitemEventCallback)
genClosure_MenuitemEvent cb = liftIO $ do
    let cb' = wrap_MenuitemEventCallback cb
    mk_MenuitemEventCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemEventCallback` into a `C_MenuitemEventCallback`.
wrap_MenuitemEventCallback ::
    MenuitemEventCallback ->
    C_MenuitemEventCallback
wrap_MenuitemEventCallback _cb _ arg1 arg2 arg3 _ = do
    arg1' <- cstringToText arg1
    arg2' <- B.GVariant.newGVariantFromPtr arg2
    result <- _cb  arg1' arg2' arg3
    let result' = (fromIntegral . fromEnum) result
    return result'


{- |
Connect a signal handler for the “@event@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #event callback
@
-}
onMenuitemEvent :: (IsMenuitem a, MonadIO m) => a -> MenuitemEventCallback -> m SignalHandlerId
onMenuitemEvent obj cb = liftIO $ do
    let cb' = wrap_MenuitemEventCallback cb
    cb'' <- mk_MenuitemEventCallback cb'
    connectSignalFunPtr obj "event" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@event@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #event callback
@
-}
afterMenuitemEvent :: (IsMenuitem a, MonadIO m) => a -> MenuitemEventCallback -> m SignalHandlerId
afterMenuitemEvent obj cb = liftIO $ do
    let cb' = wrap_MenuitemEventCallback cb
    cb'' <- mk_MenuitemEventCallback cb'
    connectSignalFunPtr obj "event" cb'' SignalConnectAfter


-- signal Menuitem::item-activated
{- |
Emitted on the objects on the server side when
		they are signaled on the client side.
-}
type MenuitemItemActivatedCallback =
    Word32
    {- ^ /@arg1@/: The timestamp of when it was activated -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemItemActivatedCallback`@.
noMenuitemItemActivatedCallback :: Maybe MenuitemItemActivatedCallback
noMenuitemItemActivatedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemItemActivatedCallback =
    Ptr () ->                               -- object
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemItemActivatedCallback`.
foreign import ccall "wrapper"
    mk_MenuitemItemActivatedCallback :: C_MenuitemItemActivatedCallback -> IO (FunPtr C_MenuitemItemActivatedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemItemActivated :: MonadIO m => MenuitemItemActivatedCallback -> m (GClosure C_MenuitemItemActivatedCallback)
genClosure_MenuitemItemActivated cb = liftIO $ do
    let cb' = wrap_MenuitemItemActivatedCallback cb
    mk_MenuitemItemActivatedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemItemActivatedCallback` into a `C_MenuitemItemActivatedCallback`.
wrap_MenuitemItemActivatedCallback ::
    MenuitemItemActivatedCallback ->
    C_MenuitemItemActivatedCallback
wrap_MenuitemItemActivatedCallback _cb _ arg1 _ = do
    _cb  arg1


{- |
Connect a signal handler for the “@item-activated@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #itemActivated callback
@
-}
onMenuitemItemActivated :: (IsMenuitem a, MonadIO m) => a -> MenuitemItemActivatedCallback -> m SignalHandlerId
onMenuitemItemActivated obj cb = liftIO $ do
    let cb' = wrap_MenuitemItemActivatedCallback cb
    cb'' <- mk_MenuitemItemActivatedCallback cb'
    connectSignalFunPtr obj "item-activated" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@item-activated@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #itemActivated callback
@
-}
afterMenuitemItemActivated :: (IsMenuitem a, MonadIO m) => a -> MenuitemItemActivatedCallback -> m SignalHandlerId
afterMenuitemItemActivated obj cb = liftIO $ do
    let cb' = wrap_MenuitemItemActivatedCallback cb
    cb'' <- mk_MenuitemItemActivatedCallback cb'
    connectSignalFunPtr obj "item-activated" cb'' SignalConnectAfter


-- signal Menuitem::property-changed
{- |
Emitted everytime a property on a menuitem is either
		updated or added.
-}
type MenuitemPropertyChangedCallback =
    T.Text
    {- ^ /@arg1@/: The name of the property that changed -}
    -> GVariant
    {- ^ /@arg2@/: The new value of the property -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemPropertyChangedCallback`@.
noMenuitemPropertyChangedCallback :: Maybe MenuitemPropertyChangedCallback
noMenuitemPropertyChangedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemPropertyChangedCallback =
    Ptr () ->                               -- object
    CString ->
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemPropertyChangedCallback`.
foreign import ccall "wrapper"
    mk_MenuitemPropertyChangedCallback :: C_MenuitemPropertyChangedCallback -> IO (FunPtr C_MenuitemPropertyChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemPropertyChanged :: MonadIO m => MenuitemPropertyChangedCallback -> m (GClosure C_MenuitemPropertyChangedCallback)
genClosure_MenuitemPropertyChanged cb = liftIO $ do
    let cb' = wrap_MenuitemPropertyChangedCallback cb
    mk_MenuitemPropertyChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemPropertyChangedCallback` into a `C_MenuitemPropertyChangedCallback`.
wrap_MenuitemPropertyChangedCallback ::
    MenuitemPropertyChangedCallback ->
    C_MenuitemPropertyChangedCallback
wrap_MenuitemPropertyChangedCallback _cb _ arg1 arg2 _ = do
    arg1' <- cstringToText arg1
    arg2' <- B.GVariant.newGVariantFromPtr arg2
    _cb  arg1' arg2'


{- |
Connect a signal handler for the “@property-changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #propertyChanged callback
@
-}
onMenuitemPropertyChanged :: (IsMenuitem a, MonadIO m) => a -> MenuitemPropertyChangedCallback -> m SignalHandlerId
onMenuitemPropertyChanged obj cb = liftIO $ do
    let cb' = wrap_MenuitemPropertyChangedCallback cb
    cb'' <- mk_MenuitemPropertyChangedCallback cb'
    connectSignalFunPtr obj "property-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@property-changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #propertyChanged callback
@
-}
afterMenuitemPropertyChanged :: (IsMenuitem a, MonadIO m) => a -> MenuitemPropertyChangedCallback -> m SignalHandlerId
afterMenuitemPropertyChanged obj cb = liftIO $ do
    let cb' = wrap_MenuitemPropertyChangedCallback cb
    cb'' <- mk_MenuitemPropertyChangedCallback cb'
    connectSignalFunPtr obj "property-changed" cb'' SignalConnectAfter


-- signal Menuitem::realized
{- |
Emitted when the initial request for properties
		is complete on the item.  If there is a type
		handler configured for the \"type\" parameter
		that will be executed before this is signaled.
-}
type MenuitemRealizedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemRealizedCallback`@.
noMenuitemRealizedCallback :: Maybe MenuitemRealizedCallback
noMenuitemRealizedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemRealizedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemRealizedCallback`.
foreign import ccall "wrapper"
    mk_MenuitemRealizedCallback :: C_MenuitemRealizedCallback -> IO (FunPtr C_MenuitemRealizedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemRealized :: MonadIO m => MenuitemRealizedCallback -> m (GClosure C_MenuitemRealizedCallback)
genClosure_MenuitemRealized cb = liftIO $ do
    let cb' = wrap_MenuitemRealizedCallback cb
    mk_MenuitemRealizedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemRealizedCallback` into a `C_MenuitemRealizedCallback`.
wrap_MenuitemRealizedCallback ::
    MenuitemRealizedCallback ->
    C_MenuitemRealizedCallback
wrap_MenuitemRealizedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@realized@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #realized callback
@
-}
onMenuitemRealized :: (IsMenuitem a, MonadIO m) => a -> MenuitemRealizedCallback -> m SignalHandlerId
onMenuitemRealized obj cb = liftIO $ do
    let cb' = wrap_MenuitemRealizedCallback cb
    cb'' <- mk_MenuitemRealizedCallback cb'
    connectSignalFunPtr obj "realized" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@realized@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #realized callback
@
-}
afterMenuitemRealized :: (IsMenuitem a, MonadIO m) => a -> MenuitemRealizedCallback -> m SignalHandlerId
afterMenuitemRealized obj cb = liftIO $ do
    let cb' = wrap_MenuitemRealizedCallback cb
    cb'' <- mk_MenuitemRealizedCallback cb'
    connectSignalFunPtr obj "realized" cb'' SignalConnectAfter


-- signal Menuitem::show-to-user
{- |
Signaled when the application would like the visualization
		of this menu item shown to the user.  This usually requires
		going over the bus to get it done.
-}
type MenuitemShowToUserCallback =
    Word32
    {- ^ /@arg1@/: Timestamp the event happened at -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuitemShowToUserCallback`@.
noMenuitemShowToUserCallback :: Maybe MenuitemShowToUserCallback
noMenuitemShowToUserCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuitemShowToUserCallback =
    Ptr () ->                               -- object
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuitemShowToUserCallback`.
foreign import ccall "wrapper"
    mk_MenuitemShowToUserCallback :: C_MenuitemShowToUserCallback -> IO (FunPtr C_MenuitemShowToUserCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuitemShowToUser :: MonadIO m => MenuitemShowToUserCallback -> m (GClosure C_MenuitemShowToUserCallback)
genClosure_MenuitemShowToUser cb = liftIO $ do
    let cb' = wrap_MenuitemShowToUserCallback cb
    mk_MenuitemShowToUserCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `MenuitemShowToUserCallback` into a `C_MenuitemShowToUserCallback`.
wrap_MenuitemShowToUserCallback ::
    MenuitemShowToUserCallback ->
    C_MenuitemShowToUserCallback
wrap_MenuitemShowToUserCallback _cb _ arg1 _ = do
    _cb  arg1


{- |
Connect a signal handler for the “@show-to-user@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' menuitem #showToUser callback
@
-}
onMenuitemShowToUser :: (IsMenuitem a, MonadIO m) => a -> MenuitemShowToUserCallback -> m SignalHandlerId
onMenuitemShowToUser obj cb = liftIO $ do
    let cb' = wrap_MenuitemShowToUserCallback cb
    cb'' <- mk_MenuitemShowToUserCallback cb'
    connectSignalFunPtr obj "show-to-user" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@show-to-user@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' menuitem #showToUser callback
@
-}
afterMenuitemShowToUser :: (IsMenuitem a, MonadIO m) => a -> MenuitemShowToUserCallback -> m SignalHandlerId
afterMenuitemShowToUser obj cb = liftIO $ do
    let cb' = wrap_MenuitemShowToUserCallback cb
    cb'' <- mk_MenuitemShowToUserCallback cb'
    connectSignalFunPtr obj "show-to-user" cb'' SignalConnectAfter


-- VVV Prop "id"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@id@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' menuitem #id
@
-}
getMenuitemId :: (MonadIO m, IsMenuitem o) => o -> m Int32
getMenuitemId obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "id"

{- |
Construct a `GValueConstruct` with valid value for the “@id@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructMenuitemId :: (IsMenuitem o) => Int32 -> IO (GValueConstruct o)
constructMenuitemId val = B.Properties.constructObjectPropertyInt32 "id" val

#if ENABLE_OVERLOADING
data MenuitemIdPropertyInfo
instance AttrInfo MenuitemIdPropertyInfo where
    type AttrAllowedOps MenuitemIdPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MenuitemIdPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint MenuitemIdPropertyInfo = IsMenuitem
    type AttrGetType MenuitemIdPropertyInfo = Int32
    type AttrLabel MenuitemIdPropertyInfo = "id"
    type AttrOrigin MenuitemIdPropertyInfo = Menuitem
    attrGet _ = getMenuitemId
    attrSet _ = undefined
    attrConstruct _ = constructMenuitemId
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList Menuitem
type instance O.AttributeList Menuitem = MenuitemAttributeList
type MenuitemAttributeList = ('[ '("id", MenuitemIdPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
menuitemId :: AttrLabelProxy "id"
menuitemId = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data MenuitemAboutToShowSignalInfo
instance SignalInfo MenuitemAboutToShowSignalInfo where
    type HaskellCallbackType MenuitemAboutToShowSignalInfo = MenuitemAboutToShowCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemAboutToShowCallback cb
        cb'' <- mk_MenuitemAboutToShowCallback cb'
        connectSignalFunPtr obj "about-to-show" cb'' connectMode

data MenuitemChildAddedSignalInfo
instance SignalInfo MenuitemChildAddedSignalInfo where
    type HaskellCallbackType MenuitemChildAddedSignalInfo = MenuitemChildAddedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemChildAddedCallback cb
        cb'' <- mk_MenuitemChildAddedCallback cb'
        connectSignalFunPtr obj "child-added" cb'' connectMode

data MenuitemChildMovedSignalInfo
instance SignalInfo MenuitemChildMovedSignalInfo where
    type HaskellCallbackType MenuitemChildMovedSignalInfo = MenuitemChildMovedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemChildMovedCallback cb
        cb'' <- mk_MenuitemChildMovedCallback cb'
        connectSignalFunPtr obj "child-moved" cb'' connectMode

data MenuitemChildRemovedSignalInfo
instance SignalInfo MenuitemChildRemovedSignalInfo where
    type HaskellCallbackType MenuitemChildRemovedSignalInfo = MenuitemChildRemovedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemChildRemovedCallback cb
        cb'' <- mk_MenuitemChildRemovedCallback cb'
        connectSignalFunPtr obj "child-removed" cb'' connectMode

data MenuitemEventSignalInfo
instance SignalInfo MenuitemEventSignalInfo where
    type HaskellCallbackType MenuitemEventSignalInfo = MenuitemEventCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemEventCallback cb
        cb'' <- mk_MenuitemEventCallback cb'
        connectSignalFunPtr obj "event" cb'' connectMode

data MenuitemItemActivatedSignalInfo
instance SignalInfo MenuitemItemActivatedSignalInfo where
    type HaskellCallbackType MenuitemItemActivatedSignalInfo = MenuitemItemActivatedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemItemActivatedCallback cb
        cb'' <- mk_MenuitemItemActivatedCallback cb'
        connectSignalFunPtr obj "item-activated" cb'' connectMode

data MenuitemPropertyChangedSignalInfo
instance SignalInfo MenuitemPropertyChangedSignalInfo where
    type HaskellCallbackType MenuitemPropertyChangedSignalInfo = MenuitemPropertyChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemPropertyChangedCallback cb
        cb'' <- mk_MenuitemPropertyChangedCallback cb'
        connectSignalFunPtr obj "property-changed" cb'' connectMode

data MenuitemRealizedSignalInfo
instance SignalInfo MenuitemRealizedSignalInfo where
    type HaskellCallbackType MenuitemRealizedSignalInfo = MenuitemRealizedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemRealizedCallback cb
        cb'' <- mk_MenuitemRealizedCallback cb'
        connectSignalFunPtr obj "realized" cb'' connectMode

data MenuitemShowToUserSignalInfo
instance SignalInfo MenuitemShowToUserSignalInfo where
    type HaskellCallbackType MenuitemShowToUserSignalInfo = MenuitemShowToUserCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MenuitemShowToUserCallback cb
        cb'' <- mk_MenuitemShowToUserCallback cb'
        connectSignalFunPtr obj "show-to-user" cb'' connectMode

type instance O.SignalList Menuitem = MenuitemSignalList
type MenuitemSignalList = ('[ '("aboutToShow", MenuitemAboutToShowSignalInfo), '("childAdded", MenuitemChildAddedSignalInfo), '("childMoved", MenuitemChildMovedSignalInfo), '("childRemoved", MenuitemChildRemovedSignalInfo), '("event", MenuitemEventSignalInfo), '("itemActivated", MenuitemItemActivatedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("propertyChanged", MenuitemPropertyChangedSignalInfo), '("realized", MenuitemRealizedSignalInfo), '("showToUser", MenuitemShowToUserSignalInfo)] :: [(Symbol, *)])

#endif

-- method Menuitem::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_new" dbusmenu_menuitem_new ::
    IO (Ptr Menuitem)

{- |
Create a new 'GI.Dbusmenu.Objects.Menuitem.Menuitem' with all default values.
-}
menuitemNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Menuitem
    {- ^ __Returns:__ A newly allocated 'GI.Dbusmenu.Objects.Menuitem.Menuitem'. -}
menuitemNew  = liftIO $ do
    result <- dbusmenu_menuitem_new
    checkUnexpectedReturnNULL "menuitemNew" result
    result' <- (wrapObject Menuitem) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Menuitem::new_with_id
-- method type : Constructor
-- Args : [Arg {argCName = "id", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "ID to use for this menuitem", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_new_with_id" dbusmenu_menuitem_new_with_id ::
    Int32 ->                                -- id : TBasicType TInt
    IO (Ptr Menuitem)

{- |
This creates a blank 'GI.Dbusmenu.Objects.Menuitem.Menuitem' with a specific ID.
-}
menuitemNewWithId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@id@/: ID to use for this menuitem -}
    -> m Menuitem
    {- ^ __Returns:__ A newly allocated 'GI.Dbusmenu.Objects.Menuitem.Menuitem'. -}
menuitemNewWithId id = liftIO $ do
    result <- dbusmenu_menuitem_new_with_id id
    checkUnexpectedReturnNULL "menuitemNewWithId" result
    result' <- (wrapObject Menuitem) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Menuitem::child_add_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem that we're adding the child @child to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "child", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to make a child of @mi.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Where in @mi object's list of chidren @child should be placed.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_child_add_position" dbusmenu_menuitem_child_add_position ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- child : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Word32 ->                               -- position : TBasicType TUInt
    IO CInt

{- |
Puts /@child@/ in the list of children for /@mi@/ at the location
specified in /@position@/.  If there is not enough entires available
then /@child@/ will be placed at the end of the list.
-}
menuitemChildAddPosition ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' that we\'re adding the child /@child@/ to. -}
    -> b
    {- ^ /@child@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to make a child of /@mi@/. -}
    -> Word32
    {- ^ /@position@/: Where in /@mi@/ object\'s list of chidren /@child@/ should be placed. -}
    -> m Bool
    {- ^ __Returns:__ Whether /@child@/ was added successfully. -}
menuitemChildAddPosition mi child position = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    child' <- unsafeManagedPtrCastPtr child
    result <- dbusmenu_menuitem_child_add_position mi' child' position
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr child
    return result'

#if ENABLE_OVERLOADING
data MenuitemChildAddPositionMethodInfo
instance (signature ~ (b -> Word32 -> m Bool), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemChildAddPositionMethodInfo a signature where
    overloadedMethod _ = menuitemChildAddPosition

#endif

-- method Menuitem::child_append
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem which will become a new parent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "child", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenMenuitem that will be a child", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_child_append" dbusmenu_menuitem_child_append ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- child : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO CInt

{- |
This function adds /@child@/ to the list of children on /@mi@/ at
the end of that list.
-}
menuitemChildAppend ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' which will become a new parent -}
    -> b
    {- ^ /@child@/: The @/DbusmenMenuitem/@ that will be a child -}
    -> m Bool
    {- ^ __Returns:__ Whether the child has been added successfully. -}
menuitemChildAppend mi child = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    child' <- unsafeManagedPtrCastPtr child
    result <- dbusmenu_menuitem_child_append mi' child'
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr child
    return result'

#if ENABLE_OVERLOADING
data MenuitemChildAppendMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemChildAppendMethodInfo a signature where
    overloadedMethod _ = menuitemChildAppend

#endif

-- method Menuitem::child_delete
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem which has @child as a child", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "child", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The child #DbusmenuMenuitem that you want to no longer\n    be a child of @mi.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_child_delete" dbusmenu_menuitem_child_delete ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- child : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO CInt

{- |
This function removes /@child@/ from the children list of /@mi@/.  It does
not call @/g_object_unref/@ on /@child@/.
-}
menuitemChildDelete ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' which has /@child@/ as a child -}
    -> b
    {- ^ /@child@/: The child 'GI.Dbusmenu.Objects.Menuitem.Menuitem' that you want to no longer
    be a child of /@mi@/. -}
    -> m Bool
    {- ^ __Returns:__ If we were able to delete /@child@/. -}
menuitemChildDelete mi child = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    child' <- unsafeManagedPtrCastPtr child
    result <- dbusmenu_menuitem_child_delete mi' child'
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr child
    return result'

#if ENABLE_OVERLOADING
data MenuitemChildDeleteMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemChildDeleteMethodInfo a signature where
    overloadedMethod _ = menuitemChildDelete

#endif

-- method Menuitem::child_find
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem who's children to look on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The ID of the child that we're looking for.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_child_find" dbusmenu_menuitem_child_find ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Int32 ->                                -- id : TBasicType TInt
    IO (Ptr Menuitem)

{- |
Search the children of /@mi@/ to find one with the ID of /@id@/.
If it doesn\'t exist then we return @/NULL/@.
-}
menuitemChildFind ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' who\'s children to look on -}
    -> Int32
    {- ^ /@id@/: The ID of the child that we\'re looking for. -}
    -> m Menuitem
    {- ^ __Returns:__ The menu item with the ID /@id@/ or @/NULL/@ if it
   can\'t be found. -}
menuitemChildFind mi id = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_child_find mi' id
    checkUnexpectedReturnNULL "menuitemChildFind" result
    result' <- (newObject Menuitem) result
    touchManagedPtr mi
    return result'

#if ENABLE_OVERLOADING
data MenuitemChildFindMethodInfo
instance (signature ~ (Int32 -> m Menuitem), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemChildFindMethodInfo a signature where
    overloadedMethod _ = menuitemChildFind

#endif

-- method Menuitem::child_prepend
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem which will become a new parent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "child", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenMenuitem that will be a child", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_child_prepend" dbusmenu_menuitem_child_prepend ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- child : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO CInt

{- |
This function adds /@child@/ to the list of children on /@mi@/ at
the beginning of that list.
-}
menuitemChildPrepend ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' which will become a new parent -}
    -> b
    {- ^ /@child@/: The @/DbusmenMenuitem/@ that will be a child -}
    -> m Bool
    {- ^ __Returns:__ Whether the child has been added successfully. -}
menuitemChildPrepend mi child = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    child' <- unsafeManagedPtrCastPtr child
    result <- dbusmenu_menuitem_child_prepend mi' child'
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr child
    return result'

#if ENABLE_OVERLOADING
data MenuitemChildPrependMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemChildPrependMethodInfo a signature where
    overloadedMethod _ = menuitemChildPrepend

#endif

-- method Menuitem::child_reorder
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem that has children needing realignment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "child", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem that is a child needing to be moved", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The position in the list to place it in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_child_reorder" dbusmenu_menuitem_child_reorder ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- child : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Word32 ->                               -- position : TBasicType TUInt
    IO CInt

{- |
This function moves a child on the list of children.  It is
for a child that is already in the list, but simply needs a
new location.
-}
menuitemChildReorder ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' that has children needing realignment -}
    -> b
    {- ^ /@child@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' that is a child needing to be moved -}
    -> Word32
    {- ^ /@position@/: The position in the list to place it in -}
    -> m Bool
    {- ^ __Returns:__ Whether the move was successful. -}
menuitemChildReorder mi child position = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    child' <- unsafeManagedPtrCastPtr child
    result <- dbusmenu_menuitem_child_reorder mi' child' position
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr child
    return result'

#if ENABLE_OVERLOADING
data MenuitemChildReorderMethodInfo
instance (signature ~ (b -> Word32 -> m Bool), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemChildReorderMethodInfo a signature where
    overloadedMethod _ = menuitemChildReorder

#endif

-- method Menuitem::find_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitem at the top of the tree to search", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "ID of the #DbusmenuMenuitem to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_find_id" dbusmenu_menuitem_find_id ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Int32 ->                                -- id : TBasicType TInt
    IO (Ptr Menuitem)

{- |
This function searchs the whole tree of children that
are attached to /@mi@/.  This could be quite a few nodes, all
the way down the tree.  It is a depth first search.
-}
menuitemFindId ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: 'GI.Dbusmenu.Objects.Menuitem.Menuitem' at the top of the tree to search -}
    -> Int32
    {- ^ /@id@/: ID of the 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to search for -}
    -> m Menuitem
    {- ^ __Returns:__ The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' with the ID of /@id@/
	or @/NULL/@ if there isn\'t such a menu item in the tree
	represented by /@mi@/. -}
menuitemFindId mi id = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_find_id mi' id
    checkUnexpectedReturnNULL "menuitemFindId" result
    result' <- (newObject Menuitem) result
    touchManagedPtr mi
    return result'

#if ENABLE_OVERLOADING
data MenuitemFindIdMethodInfo
instance (signature ~ (Int32 -> m Menuitem), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemFindIdMethodInfo a signature where
    overloadedMethod _ = menuitemFindId

#endif

-- method Menuitem::foreach
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenItem to start from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Function to call on every node in the tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "User data to pass to the function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_foreach" dbusmenu_menuitem_foreach ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr () ->                               -- func : TBasicType TPtr
    Ptr () ->                               -- data : TBasicType TPtr
    IO ()

{- |
This calls the function /@func@/ on this menu item and all
of the children of this item.  And their children.  And
their children.  And... you get the point.  It will get
called on the whole tree.
-}
menuitemForeach ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The @/DbusmenItem/@ to start from -}
    -> Ptr ()
    {- ^ /@func@/: Function to call on every node in the tree -}
    -> Ptr ()
    {- ^ /@data@/: User data to pass to the function -}
    -> m ()
menuitemForeach mi func data_ = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    dbusmenu_menuitem_foreach mi' func data_
    touchManagedPtr mi
    return ()

#if ENABLE_OVERLOADING
data MenuitemForeachMethodInfo
instance (signature ~ (Ptr () -> Ptr () -> m ()), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemForeachMethodInfo a signature where
    overloadedMethod _ = menuitemForeach

#endif

-- method Menuitem::get_children
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_get_children" dbusmenu_menuitem_get_children ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO (Ptr (GList (Ptr Menuitem)))

{- |
Returns simply the list of children that this menu item
has.  The list is valid until another child related function
is called, where it might be changed.
-}
menuitemGetChildren ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to query. -}
    -> m [Menuitem]
    {- ^ __Returns:__ A 'GI.GLib.Structs.List.List' of pointers to 'GI.Dbusmenu.Objects.Menuitem.Menuitem' objects. -}
menuitemGetChildren mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_get_children mi'
    result' <- unpackGList result
    result'' <- mapM (newObject Menuitem) result'
    touchManagedPtr mi
    return result''

#if ENABLE_OVERLOADING
data MenuitemGetChildrenMethodInfo
instance (signature ~ (m [Menuitem]), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemGetChildrenMethodInfo a signature where
    overloadedMethod _ = menuitemGetChildren

#endif

-- method Menuitem::get_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_get_id" dbusmenu_menuitem_get_id ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO Int32

{- |
Gets the unique ID for /@mi@/.
-}
menuitemGetId ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to query. -}
    -> m Int32
    {- ^ __Returns:__ The ID of the /@mi@/. -}
menuitemGetId mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_get_id mi'
    touchManagedPtr mi
    return result

#if ENABLE_OVERLOADING
data MenuitemGetIdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemGetIdMethodInfo a signature where
    overloadedMethod _ = menuitemGetId

#endif

-- method Menuitem::get_parent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem for which to inspect the parent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_get_parent" dbusmenu_menuitem_get_parent ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO (Ptr Menuitem)

{- |
This function looks up the parent of /@mi@/
-}
menuitemGetParent ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' for which to inspect the parent -}
    -> m Menuitem
    {- ^ __Returns:__ The parent of this menu item -}
menuitemGetParent mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_get_parent mi'
    checkUnexpectedReturnNULL "menuitemGetParent" result
    result' <- (newObject Menuitem) result
    touchManagedPtr mi
    return result'

#if ENABLE_OVERLOADING
data MenuitemGetParentMethodInfo
instance (signature ~ (m Menuitem), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemGetParentMethodInfo a signature where
    overloadedMethod _ = menuitemGetParent

#endif

-- method Menuitem::get_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to find the position of", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem who's children contain @mi", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_get_position" dbusmenu_menuitem_get_position ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- parent : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO Word32

{- |
This function returns the position of the menu item /@mi@/
in the children of /@parent@/.  It will return zero if the
menu item can\'t be found.
-}
menuitemGetPosition ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to find the position of -}
    -> b
    {- ^ /@parent@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' who\'s children contain /@mi@/ -}
    -> m Word32
    {- ^ __Returns:__ The position of /@mi@/ in the children of /@parent@/. -}
menuitemGetPosition mi parent = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    parent' <- unsafeManagedPtrCastPtr parent
    result <- dbusmenu_menuitem_get_position mi' parent'
    touchManagedPtr mi
    touchManagedPtr parent
    return result

#if ENABLE_OVERLOADING
data MenuitemGetPositionMethodInfo
instance (signature ~ (b -> m Word32), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemGetPositionMethodInfo a signature where
    overloadedMethod _ = menuitemGetPosition

#endif

-- method Menuitem::get_position_realized
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to find the position of", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem who's children contain @mi", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_get_position_realized" dbusmenu_menuitem_get_position_realized ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- parent : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO Word32

{- |
This function is very similar to @/dbusmenu_menuitem_get_position/@
except that it only counts in the children that have been realized.
-}
menuitemGetPositionRealized ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to find the position of -}
    -> b
    {- ^ /@parent@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' who\'s children contain /@mi@/ -}
    -> m Word32
    {- ^ __Returns:__ The position of /@mi@/ in the realized children of /@parent@/. -}
menuitemGetPositionRealized mi parent = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    parent' <- unsafeManagedPtrCastPtr parent
    result <- dbusmenu_menuitem_get_position_realized mi' parent'
    touchManagedPtr mi
    touchManagedPtr parent
    return result

#if ENABLE_OVERLOADING
data MenuitemGetPositionRealizedMethodInfo
instance (signature ~ (b -> m Word32), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemGetPositionRealizedMethodInfo a signature where
    overloadedMethod _ = menuitemGetPositionRealized

#endif

-- method Menuitem::get_root
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitem to see whether it's root", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_get_root" dbusmenu_menuitem_get_root ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO CInt

{- |
This function returns the internal value of whether this is a
root node or not.
-}
menuitemGetRoot ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to see whether it\'s root -}
    -> m Bool
    {- ^ __Returns:__ @/TRUE/@ if this is a root node -}
menuitemGetRoot mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_get_root mi'
    let result' = (/= 0) result
    touchManagedPtr mi
    return result'

#if ENABLE_OVERLOADING
data MenuitemGetRootMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemGetRootMethodInfo a signature where
    overloadedMethod _ = menuitemGetRoot

#endif

-- method Menuitem::handle_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to send the signal on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The name of the signal", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "variant", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A value that could be set for the event", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The timestamp of when the event happened", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_handle_event" dbusmenu_menuitem_handle_event ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- name : TBasicType TUTF8
    Ptr GVariant ->                         -- variant : TVariant
    Word32 ->                               -- timestamp : TBasicType TUInt
    IO ()

{- |
This function is called to create an event.  It is likely
to be overrided by subclasses.  The default menu item
will respond to the activate signal and do:

Emits the 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/item-activate/@ signal on this
menu item.  Called by server objects when they get the
appropriate DBus signals from the client.

If you subclass this function you should really think
about calling the parent function unless you have a good
reason not to.
-}
menuitemHandleEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to send the signal on. -}
    -> T.Text
    {- ^ /@name@/: The name of the signal -}
    -> GVariant
    {- ^ /@variant@/: A value that could be set for the event -}
    -> Word32
    {- ^ /@timestamp@/: The timestamp of when the event happened -}
    -> m ()
menuitemHandleEvent mi name variant timestamp = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    name' <- textToCString name
    variant' <- unsafeManagedPtrGetPtr variant
    dbusmenu_menuitem_handle_event mi' name' variant' timestamp
    touchManagedPtr mi
    touchManagedPtr variant
    freeMem name'
    return ()

#if ENABLE_OVERLOADING
data MenuitemHandleEventMethodInfo
instance (signature ~ (T.Text -> GVariant -> Word32 -> m ()), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemHandleEventMethodInfo a signature where
    overloadedMethod _ = menuitemHandleEvent

#endif

-- method Menuitem::properties_copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitem that we're interested in the properties of", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGHash (TBasicType TPtr) (TBasicType TPtr))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_properties_copy" dbusmenu_menuitem_properties_copy ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO (Ptr (GHashTable (Ptr ()) (Ptr ())))

{- |
This function takes the properties of a 'GI.Dbusmenu.Objects.Menuitem.Menuitem'
and puts them into a 'GI.GLib.Structs.HashTable.HashTable' that is referenced by the
key of a string and has the value of a string.  The hash
table may not have any entries if there aren\'t any or there
is an error in processing.  It is the caller\'s responsibility
to destroy the created 'GI.GLib.Structs.HashTable.HashTable'.
-}
menuitemPropertiesCopy ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: 'GI.Dbusmenu.Objects.Menuitem.Menuitem' that we\'re interested in the properties of -}
    -> m (Map.Map (Ptr ()) (Ptr ()))
    {- ^ __Returns:__ A brand new 'GI.GLib.Structs.HashTable.HashTable' that contains all of
   theroperties that are on this 'GI.Dbusmenu.Objects.Menuitem.Menuitem' /@mi@/. -}
menuitemPropertiesCopy mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_properties_copy mi'
    checkUnexpectedReturnNULL "menuitemPropertiesCopy" result
    result' <- unpackGHashTable result
    let result'' = mapFirst ptrUnpackPtr result'
    let result''' = mapSecond ptrUnpackPtr result''
    let result'''' = Map.fromList result'''
    unrefGHashTable result
    touchManagedPtr mi
    return result''''

#if ENABLE_OVERLOADING
data MenuitemPropertiesCopyMethodInfo
instance (signature ~ (m (Map.Map (Ptr ()) (Ptr ()))), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertiesCopyMethodInfo a signature where
    overloadedMethod _ = menuitemPropertiesCopy

#endif

-- method Menuitem::properties_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitem to list the properties on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_properties_list" dbusmenu_menuitem_properties_list ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO (Ptr (GList CString))

{- |
This functiong gets a list of the names of all the properties
that are set on this menu item.  This data on the list is owned
by the menuitem but the list is not and should be freed using
@/g_list_free()/@ when the calling function is done with it.
-}
menuitemPropertiesList ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to list the properties on -}
    -> m [T.Text]
    {- ^ __Returns:__ A list of
strings or NULL if there are none. -}
menuitemPropertiesList mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_properties_list mi'
    result' <- unpackGList result
    result'' <- mapM cstringToText result'
    g_list_free result
    touchManagedPtr mi
    return result''

#if ENABLE_OVERLOADING
data MenuitemPropertiesListMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertiesListMethodInfo a signature where
    overloadedMethod _ = menuitemPropertiesList

#endif

-- method Menuitem::property_exist
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to look for the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to look for.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_exist" dbusmenu_menuitem_property_exist ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    IO CInt

{- |
Checkes to see if a particular property exists on /@mi@/ and
returns @/TRUE/@ if so.
-}
menuitemPropertyExist ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to look for. -}
    -> m Bool
    {- ^ __Returns:__ A boolean checking to see if the property is available -}
menuitemPropertyExist mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_exist mi' property'
    let result' = (/= 0) result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertyExistMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyExistMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyExist

#endif

-- method Menuitem::property_get
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to look for the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to grab.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_get" dbusmenu_menuitem_property_get ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    IO CString

{- |
Look up a property on /@mi@/ and return the value of it if
it exits.  @/NULL/@ will be returned if the property doesn\'t
exist.
-}
menuitemPropertyGet ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to grab. -}
    -> m T.Text
    {- ^ __Returns:__ A string with the value of the property
	that shouldn\'t be free\'d.  Or @/NULL/@ if the property
	is not set or is not a string. -}
menuitemPropertyGet mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_get mi' property'
    checkUnexpectedReturnNULL "menuitemPropertyGet" result
    result' <- cstringToText result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertyGetMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyGetMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyGet

#endif

-- method Menuitem::property_get_bool
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to look for the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to grab.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_get_bool" dbusmenu_menuitem_property_get_bool ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    IO CInt

{- |
Look up a property on /@mi@/ and return the value of it if
it exits.  Returns @/FALSE/@ if the property doesn\'t exist.
-}
menuitemPropertyGetBool ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to grab. -}
    -> m Bool
    {- ^ __Returns:__ The value of the property or @/FALSE/@. -}
menuitemPropertyGetBool mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_get_bool mi' property'
    let result' = (/= 0) result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertyGetBoolMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyGetBoolMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyGetBool

#endif

-- method Menuitem::property_get_byte_array
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to look for the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to grab.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nelements", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the location to store the number of items (out)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "nelements", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the location to store the number of items (out)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 2 (TBasicType TUInt8))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_get_byte_array" dbusmenu_menuitem_property_get_byte_array ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    Ptr Word64 ->                           -- nelements : TBasicType TUInt64
    IO (Ptr Word8)

{- |
Look up a property on /@mi@/ and return the value of it if
it exits.  @/NULL/@ will be returned if the property doesn\'t
exist.
-}
menuitemPropertyGetByteArray ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to grab. -}
    -> m ByteString
    {- ^ __Returns:__ A byte array with the
	value of the property that shouldn\'t be free\'d.  Or @/NULL/@ if the property
	is not set or is not a byte array. -}
menuitemPropertyGetByteArray mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    nelements <- allocMem :: IO (Ptr Word64)
    result <- dbusmenu_menuitem_property_get_byte_array mi' property' nelements
    nelements' <- peek nelements
    checkUnexpectedReturnNULL "menuitemPropertyGetByteArray" result
    result' <- (unpackByteStringWithLength nelements') result
    touchManagedPtr mi
    freeMem property'
    freeMem nelements
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertyGetByteArrayMethodInfo
instance (signature ~ (T.Text -> m ByteString), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyGetByteArrayMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyGetByteArray

#endif

-- method Menuitem::property_get_int
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to look for the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to grab.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_get_int" dbusmenu_menuitem_property_get_int ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    IO Int32

{- |
Look up a property on /@mi@/ and return the value of it if
it exits.  Returns zero if the property doesn\'t exist.
-}
menuitemPropertyGetInt ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to grab. -}
    -> m Int32
    {- ^ __Returns:__ The value of the property or zero. -}
menuitemPropertyGetInt mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_get_int mi' property'
    touchManagedPtr mi
    freeMem property'
    return result

#if ENABLE_OVERLOADING
data MenuitemPropertyGetIntMethodInfo
instance (signature ~ (T.Text -> m Int32), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyGetIntMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyGetInt

#endif

-- method Menuitem::property_get_variant
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to look for the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to grab.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_get_variant" dbusmenu_menuitem_property_get_variant ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    IO (Ptr GVariant)

{- |
Look up a property on /@mi@/ and return the value of it if
it exits.  @/NULL/@ will be returned if the property doesn\'t
exist.
-}
menuitemPropertyGetVariant ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to grab. -}
    -> m GVariant
    {- ^ __Returns:__ A GVariant for the property. -}
menuitemPropertyGetVariant mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_get_variant mi' property'
    checkUnexpectedReturnNULL "menuitemPropertyGetVariant" result
    result' <- B.GVariant.newGVariantFromPtr result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertyGetVariantMethodInfo
instance (signature ~ (T.Text -> m GVariant), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyGetVariantMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyGetVariant

#endif

-- method Menuitem::property_remove
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to remove the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The property to look for.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_remove" dbusmenu_menuitem_property_remove ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    IO ()

{- |
Removes a property from the menuitem.
-}
menuitemPropertyRemove ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to remove the property on. -}
    -> T.Text
    {- ^ /@property@/: The property to look for. -}
    -> m ()
menuitemPropertyRemove mi property = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    dbusmenu_menuitem_property_remove mi' property'
    touchManagedPtr mi
    freeMem property'
    return ()

#if ENABLE_OVERLOADING
data MenuitemPropertyRemoveMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertyRemoveMethodInfo a signature where
    overloadedMethod _ = menuitemPropertyRemove

#endif

-- method Menuitem::property_set
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to set the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of the property to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The value of the property.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_set" dbusmenu_menuitem_property_set ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    CString ->                              -- value : TBasicType TUTF8
    IO CInt

{- |
Takes the pair of /@property@/ and /@value@/ and places them as a
property on /@mi@/.  If a property already exists by that name,
then the value is set to the new value.  If not, the property
is added.  If the value is changed or the property was previously
unset then the signal 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/prop-changed/@ will be
emitted by this function.
-}
menuitemPropertySet ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the property on. -}
    -> T.Text
    {- ^ /@property@/: Name of the property to set. -}
    -> T.Text
    {- ^ /@value@/: The value of the property. -}
    -> m Bool
    {- ^ __Returns:__ A boolean representing if the property value was set. -}
menuitemPropertySet mi property value = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    value' <- textToCString value
    result <- dbusmenu_menuitem_property_set mi' property' value'
    let result' = (/= 0) result
    touchManagedPtr mi
    freeMem property'
    freeMem value'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertySetMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertySetMethodInfo a signature where
    overloadedMethod _ = menuitemPropertySet

#endif

-- method Menuitem::property_set_bool
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to set the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of the property to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The value of the property.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_set_bool" dbusmenu_menuitem_property_set_bool ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    CInt ->                                 -- value : TBasicType TBoolean
    IO CInt

{- |
Takes a boolean /@value@/ and sets it on /@property@/ as a
property on /@mi@/.  If a property already exists by that name,
then the value is set to the new value.  If not, the property
is added.  If the value is changed or the property was previously
unset then the signal 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/prop-changed/@ will be
emitted by this function.
-}
menuitemPropertySetBool ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the property on. -}
    -> T.Text
    {- ^ /@property@/: Name of the property to set. -}
    -> Bool
    {- ^ /@value@/: The value of the property. -}
    -> m Bool
    {- ^ __Returns:__ A boolean representing if the property value was set. -}
menuitemPropertySetBool mi property value = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    let value' = (fromIntegral . fromEnum) value
    result <- dbusmenu_menuitem_property_set_bool mi' property' value'
    let result' = (/= 0) result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertySetBoolMethodInfo
instance (signature ~ (T.Text -> Bool -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertySetBoolMethodInfo a signature where
    overloadedMethod _ = menuitemPropertySetBool

#endif

-- method Menuitem::property_set_byte_array
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to set the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of the property to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The byte array.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nelements", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The number of elements in the byte array.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_set_byte_array" dbusmenu_menuitem_property_set_byte_array ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    Word8 ->                                -- value : TBasicType TUInt8
    Word64 ->                               -- nelements : TBasicType TUInt64
    IO CInt

{- |
Takes a byte array /@value@/ and sets it on /@property@/ as a
property on /@mi@/.  If a property already exists by that name,
then the value is set to the new value.  If not, the property
is added.  If the value is changed or the property was previously
unset then the signal 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/prop-changed/@ will be
emitted by this function.
-}
menuitemPropertySetByteArray ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the property on. -}
    -> T.Text
    {- ^ /@property@/: Name of the property to set. -}
    -> Word8
    {- ^ /@value@/: The byte array. -}
    -> Word64
    {- ^ /@nelements@/: The number of elements in the byte array. -}
    -> m Bool
    {- ^ __Returns:__ A boolean representing if the property value was set. -}
menuitemPropertySetByteArray mi property value nelements = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_set_byte_array mi' property' value nelements
    let result' = (/= 0) result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertySetByteArrayMethodInfo
instance (signature ~ (T.Text -> Word8 -> Word64 -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertySetByteArrayMethodInfo a signature where
    overloadedMethod _ = menuitemPropertySetByteArray

#endif

-- method Menuitem::property_set_int
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to set the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of the property to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The value of the property.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_set_int" dbusmenu_menuitem_property_set_int ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    Int32 ->                                -- value : TBasicType TInt
    IO CInt

{- |
Takes a boolean /@value@/ and sets it on /@property@/ as a
property on /@mi@/.  If a property already exists by that name,
then the value is set to the new value.  If not, the property
is added.  If the value is changed or the property was previously
unset then the signal 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/prop-changed/@ will be
emitted by this function.
-}
menuitemPropertySetInt ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the property on. -}
    -> T.Text
    {- ^ /@property@/: Name of the property to set. -}
    -> Int32
    {- ^ /@value@/: The value of the property. -}
    -> m Bool
    {- ^ __Returns:__ A boolean representing if the property value was set. -}
menuitemPropertySetInt mi property value = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    result <- dbusmenu_menuitem_property_set_int mi' property' value
    let result' = (/= 0) result
    touchManagedPtr mi
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertySetIntMethodInfo
instance (signature ~ (T.Text -> Int32 -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertySetIntMethodInfo a signature where
    overloadedMethod _ = menuitemPropertySetInt

#endif

-- method Menuitem::property_set_variant
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to set the property on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of the property to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The value of the property.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_property_set_variant" dbusmenu_menuitem_property_set_variant ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CString ->                              -- property : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    IO CInt

{- |
Takes the pair of /@property@/ and /@value@/ and places them as a
property on /@mi@/.  If a property already exists by that name,
then the value is set to the new value.  If not, the property
is added.  If the value is changed or the property was previously
unset then the signal 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/prop-changed/@ will be
emitted by this function.
-}
menuitemPropertySetVariant ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the property on. -}
    -> T.Text
    {- ^ /@property@/: Name of the property to set. -}
    -> GVariant
    {- ^ /@value@/: The value of the property. -}
    -> m Bool
    {- ^ __Returns:__ A boolean representing if the property value was set. -}
menuitemPropertySetVariant mi property value = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    property' <- textToCString property
    value' <- unsafeManagedPtrGetPtr value
    result <- dbusmenu_menuitem_property_set_variant mi' property' value'
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr value
    freeMem property'
    return result'

#if ENABLE_OVERLOADING
data MenuitemPropertySetVariantMethodInfo
instance (signature ~ (T.Text -> GVariant -> m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemPropertySetVariantMethodInfo a signature where
    overloadedMethod _ = menuitemPropertySetVariant

#endif

-- method Menuitem::send_about_to_show
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to send the signal on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cb", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Callback to call when the call has returned.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cb_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Data to pass to the callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_send_about_to_show" dbusmenu_menuitem_send_about_to_show ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr () ->                               -- cb : TBasicType TPtr
    Ptr () ->                               -- cb_data : TBasicType TPtr
    IO ()

{- |
This function is used to send the even that the submenu
of this item is about to be shown.  Callers to this event
should delay showing the menu until their callback is
called if possible.
-}
menuitemSendAboutToShow ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to send the signal on. -}
    -> Ptr ()
    {- ^ /@cb@/: Callback to call when the call has returned. -}
    -> Ptr ()
    {- ^ /@cbData@/: Data to pass to the callback. -}
    -> m ()
menuitemSendAboutToShow mi cb cbData = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    dbusmenu_menuitem_send_about_to_show mi' cb cbData
    touchManagedPtr mi
    return ()

#if ENABLE_OVERLOADING
data MenuitemSendAboutToShowMethodInfo
instance (signature ~ (Ptr () -> Ptr () -> m ()), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemSendAboutToShowMethodInfo a signature where
    overloadedMethod _ = menuitemSendAboutToShow

#endif

-- method Menuitem::set_parent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem for which to set the parent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new parent #DbusmenuMenuitem", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_set_parent" dbusmenu_menuitem_set_parent ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Ptr Menuitem ->                         -- parent : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO CInt

{- |
Sets the parent of /@mi@/ to /@parent@/. If /@mi@/ already
has a parent, then this call will fail. The parent will
be set automatically when using the usual methods to add a
child menuitem, so this function should not normally be
called directly
-}
menuitemSetParent ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a, IsMenuitem b) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' for which to set the parent -}
    -> b
    {- ^ /@parent@/: The new parent 'GI.Dbusmenu.Objects.Menuitem.Menuitem' -}
    -> m Bool
    {- ^ __Returns:__ Whether the parent was set successfully -}
menuitemSetParent mi parent = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    parent' <- unsafeManagedPtrCastPtr parent
    result <- dbusmenu_menuitem_set_parent mi' parent'
    let result' = (/= 0) result
    touchManagedPtr mi
    touchManagedPtr parent
    return result'

#if ENABLE_OVERLOADING
data MenuitemSetParentMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsMenuitem a, IsMenuitem b) => O.MethodInfo MenuitemSetParentMethodInfo a signature where
    overloadedMethod _ = menuitemSetParent

#endif

-- method Menuitem::set_root
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitem to set whether it's root", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "root", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether @mi is a root node or not", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_set_root" dbusmenu_menuitem_set_root ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    CInt ->                                 -- root : TBasicType TBoolean
    IO ()

{- |
This function sets the internal value of whether this is a
root node or not.
-}
menuitemSetRoot ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set whether it\'s root -}
    -> Bool
    {- ^ /@root@/: Whether /@mi@/ is a root node or not -}
    -> m ()
menuitemSetRoot mi root = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    let root' = (fromIntegral . fromEnum) root
    dbusmenu_menuitem_set_root mi' root'
    touchManagedPtr mi
    return ()

#if ENABLE_OVERLOADING
data MenuitemSetRootMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemSetRootMethodInfo a signature where
    overloadedMethod _ = menuitemSetRoot

#endif

-- method Menuitem::show_to_user
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitem to show", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The time that the user requested it to be shown", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_show_to_user" dbusmenu_menuitem_show_to_user ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    Word32 ->                               -- timestamp : TBasicType TUInt
    IO ()

{- |
Signals that this menu item should be shown to the user.  If this is
server side the server will then take it and send it over the
bus.
-}
menuitemShowToUser ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to show -}
    -> Word32
    {- ^ /@timestamp@/: The time that the user requested it to be shown -}
    -> m ()
menuitemShowToUser mi timestamp = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    dbusmenu_menuitem_show_to_user mi' timestamp
    touchManagedPtr mi
    return ()

#if ENABLE_OVERLOADING
data MenuitemShowToUserMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemShowToUserMethodInfo a signature where
    overloadedMethod _ = menuitemShowToUser

#endif

-- method Menuitem::take_children
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenMenuitem to take the children from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_take_children" dbusmenu_menuitem_take_children ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO (Ptr (GList (Ptr Menuitem)))

{- |
While the name sounds devious that\'s exactly what this function
does.  It takes the list of children from the /@mi@/ and clears the
internal list.  The calling function is now in charge of the ref\'s
on the children it has taken.  A lot of responsibility involved
in taking children.
-}
menuitemTakeChildren ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The @/DbusmenMenuitem/@ to take the children from. -}
    -> m [Menuitem]
    {- ^ __Returns:__ 
   A 'GI.GLib.Structs.List.List' of pointers to 'GI.Dbusmenu.Objects.Menuitem.Menuitem' objects. -}
menuitemTakeChildren mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_take_children mi'
    result' <- unpackGList result
    result'' <- mapM (wrapObject Menuitem) result'
    g_list_free result
    touchManagedPtr mi
    return result''

#if ENABLE_OVERLOADING
data MenuitemTakeChildrenMethodInfo
instance (signature ~ (m [Menuitem]), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemTakeChildrenMethodInfo a signature where
    overloadedMethod _ = menuitemTakeChildren

#endif

-- method Menuitem::unparent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to unparent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_unparent" dbusmenu_menuitem_unparent ::
    Ptr Menuitem ->                         -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO CInt

{- |
Unparents the menu item /@mi@/. If /@mi@/ doesn\'t have a
parent, then this call will fail. The menuitem will
be unparented automatically when using the usual methods
to delete a child menuitem, so this function should not
normally be called directly
-}
menuitemUnparent ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to unparent -}
    -> m Bool
    {- ^ __Returns:__ Whether the menu item was unparented successfully -}
menuitemUnparent mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_unparent mi'
    let result' = (/= 0) result
    touchManagedPtr mi
    return result'

#if ENABLE_OVERLOADING
data MenuitemUnparentMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMenuitem a) => O.MethodInfo MenuitemUnparentMethodInfo a signature where
    overloadedMethod _ = menuitemUnparent

#endif