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

The client for a 'GI.Dbusmenu.Objects.Server.Server' creating a shared
	object set of 'GI.Dbusmenu.Objects.Menuitem.Menuitem' objects.
-}

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

module GI.Dbusmenu.Objects.Client
    (

-- * Exported types
    Client(..)                              ,
    IsClient                                ,
    toClient                                ,
    noClient                                ,


 -- * Methods
-- ** addTypeHandler #method:addTypeHandler#

#if ENABLE_OVERLOADING
    ClientAddTypeHandlerMethodInfo          ,
#endif
    clientAddTypeHandler                    ,


-- ** addTypeHandlerFull #method:addTypeHandlerFull#

#if ENABLE_OVERLOADING
    ClientAddTypeHandlerFullMethodInfo      ,
#endif
    clientAddTypeHandlerFull                ,


-- ** getIconPaths #method:getIconPaths#

#if ENABLE_OVERLOADING
    ClientGetIconPathsMethodInfo            ,
#endif
    clientGetIconPaths                      ,


-- ** getRoot #method:getRoot#

#if ENABLE_OVERLOADING
    ClientGetRootMethodInfo                 ,
#endif
    clientGetRoot                           ,


-- ** getStatus #method:getStatus#

#if ENABLE_OVERLOADING
    ClientGetStatusMethodInfo               ,
#endif
    clientGetStatus                         ,


-- ** getTextDirection #method:getTextDirection#

#if ENABLE_OVERLOADING
    ClientGetTextDirectionMethodInfo        ,
#endif
    clientGetTextDirection                  ,


-- ** new #method:new#

    clientNew                               ,




 -- * Properties
-- ** dbusName #attr:dbusName#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ClientDbusNamePropertyInfo              ,
#endif
#if ENABLE_OVERLOADING
    clientDbusName                          ,
#endif
    constructClientDbusName                 ,
    getClientDbusName                       ,


-- ** dbusObject #attr:dbusObject#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ClientDbusObjectPropertyInfo            ,
#endif
#if ENABLE_OVERLOADING
    clientDbusObject                        ,
#endif
    constructClientDbusObject               ,
    getClientDbusObject                     ,


-- ** groupEvents #attr:groupEvents#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ClientGroupEventsPropertyInfo           ,
#endif
#if ENABLE_OVERLOADING
    clientGroupEvents                       ,
#endif
    constructClientGroupEvents              ,
    getClientGroupEvents                    ,
    setClientGroupEvents                    ,




 -- * Signals
-- ** eventResult #signal:eventResult#

    C_ClientEventResultCallback             ,
    ClientEventResultCallback               ,
#if ENABLE_OVERLOADING
    ClientEventResultSignalInfo             ,
#endif
    afterClientEventResult                  ,
    genClosure_ClientEventResult            ,
    mk_ClientEventResultCallback            ,
    noClientEventResultCallback             ,
    onClientEventResult                     ,
    wrap_ClientEventResultCallback          ,


-- ** iconThemeDirsChanged #signal:iconThemeDirsChanged#

    C_ClientIconThemeDirsChangedCallback    ,
    ClientIconThemeDirsChangedCallback      ,
#if ENABLE_OVERLOADING
    ClientIconThemeDirsChangedSignalInfo    ,
#endif
    afterClientIconThemeDirsChanged         ,
    genClosure_ClientIconThemeDirsChanged   ,
    mk_ClientIconThemeDirsChangedCallback   ,
    noClientIconThemeDirsChangedCallback    ,
    onClientIconThemeDirsChanged            ,
    wrap_ClientIconThemeDirsChangedCallback ,


-- ** itemActivate #signal:itemActivate#

    C_ClientItemActivateCallback            ,
    ClientItemActivateCallback              ,
#if ENABLE_OVERLOADING
    ClientItemActivateSignalInfo            ,
#endif
    afterClientItemActivate                 ,
    genClosure_ClientItemActivate           ,
    mk_ClientItemActivateCallback           ,
    noClientItemActivateCallback            ,
    onClientItemActivate                    ,
    wrap_ClientItemActivateCallback         ,


-- ** layoutUpdated #signal:layoutUpdated#

    C_ClientLayoutUpdatedCallback           ,
    ClientLayoutUpdatedCallback             ,
#if ENABLE_OVERLOADING
    ClientLayoutUpdatedSignalInfo           ,
#endif
    afterClientLayoutUpdated                ,
    genClosure_ClientLayoutUpdated          ,
    mk_ClientLayoutUpdatedCallback          ,
    noClientLayoutUpdatedCallback           ,
    onClientLayoutUpdated                   ,
    wrap_ClientLayoutUpdatedCallback        ,


-- ** newMenuitem #signal:newMenuitem#

    C_ClientNewMenuitemCallback             ,
    ClientNewMenuitemCallback               ,
#if ENABLE_OVERLOADING
    ClientNewMenuitemSignalInfo             ,
#endif
    afterClientNewMenuitem                  ,
    genClosure_ClientNewMenuitem            ,
    mk_ClientNewMenuitemCallback            ,
    noClientNewMenuitemCallback             ,
    onClientNewMenuitem                     ,
    wrap_ClientNewMenuitemCallback          ,


-- ** rootChanged #signal:rootChanged#

    C_ClientRootChangedCallback             ,
    ClientRootChangedCallback               ,
#if ENABLE_OVERLOADING
    ClientRootChangedSignalInfo             ,
#endif
    afterClientRootChanged                  ,
    genClosure_ClientRootChanged            ,
    mk_ClientRootChangedCallback            ,
    noClientRootChangedCallback             ,
    onClientRootChanged                     ,
    wrap_ClientRootChangedCallback          ,




    ) 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.Dbusmenu.Callbacks as Dbusmenu.Callbacks
import {-# SOURCE #-} qualified GI.Dbusmenu.Enums as Dbusmenu.Enums
import {-# SOURCE #-} qualified GI.Dbusmenu.Objects.Menuitem as Dbusmenu.Menuitem
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype Client = Client (ManagedPtr Client)
foreign import ccall "dbusmenu_client_get_type"
    c_dbusmenu_client_get_type :: IO GType

instance GObject Client where
    gobjectType = c_dbusmenu_client_get_type


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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `Client`.
noClient :: Maybe Client
noClient = Nothing

#if ENABLE_OVERLOADING
type family ResolveClientMethod (t :: Symbol) (o :: *) :: * where
    ResolveClientMethod "addTypeHandler" o = ClientAddTypeHandlerMethodInfo
    ResolveClientMethod "addTypeHandlerFull" o = ClientAddTypeHandlerFullMethodInfo
    ResolveClientMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveClientMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveClientMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveClientMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveClientMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveClientMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveClientMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveClientMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveClientMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveClientMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveClientMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveClientMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveClientMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveClientMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveClientMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveClientMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveClientMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveClientMethod "getIconPaths" o = ClientGetIconPathsMethodInfo
    ResolveClientMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveClientMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveClientMethod "getRoot" o = ClientGetRootMethodInfo
    ResolveClientMethod "getStatus" o = ClientGetStatusMethodInfo
    ResolveClientMethod "getTextDirection" o = ClientGetTextDirectionMethodInfo
    ResolveClientMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveClientMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveClientMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveClientMethod t Client, O.MethodInfo info Client p) => OL.IsLabel t (Client -> 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 Client::event-result
{- |
/No description available in the introspection data./
-}
type ClientEventResultCallback =
    GObject.Object.Object
    -> T.Text
    -> GVariant
    -> Word32
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClientEventResultCallback`@.
noClientEventResultCallback :: Maybe ClientEventResultCallback
noClientEventResultCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ClientEventResult :: MonadIO m => ClientEventResultCallback -> m (GClosure C_ClientEventResultCallback)
genClosure_ClientEventResult cb = liftIO $ do
    let cb' = wrap_ClientEventResultCallback cb
    mk_ClientEventResultCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ClientEventResultCallback` into a `C_ClientEventResultCallback`.
wrap_ClientEventResultCallback ::
    ClientEventResultCallback ->
    C_ClientEventResultCallback
wrap_ClientEventResultCallback _cb _ object p0 p1 p2 p3 _ = do
    object' <- (newObject GObject.Object.Object) object
    p0' <- cstringToText p0
    p1' <- B.GVariant.newGVariantFromPtr p1
    _cb  object' p0' p1' p2 p3


{- |
Connect a signal handler for the “@event-result@” 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' client #eventResult callback
@
-}
onClientEventResult :: (IsClient a, MonadIO m) => a -> ClientEventResultCallback -> m SignalHandlerId
onClientEventResult obj cb = liftIO $ do
    let cb' = wrap_ClientEventResultCallback cb
    cb'' <- mk_ClientEventResultCallback cb'
    connectSignalFunPtr obj "event-result" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@event-result@” 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' client #eventResult callback
@
-}
afterClientEventResult :: (IsClient a, MonadIO m) => a -> ClientEventResultCallback -> m SignalHandlerId
afterClientEventResult obj cb = liftIO $ do
    let cb' = wrap_ClientEventResultCallback cb
    cb'' <- mk_ClientEventResultCallback cb'
    connectSignalFunPtr obj "event-result" cb'' SignalConnectAfter


-- signal Client::icon-theme-dirs-changed
{- |
Signaled when the theme directories are changed by the server.
-}
type ClientIconThemeDirsChangedCallback =
    Ptr ()
    {- ^ /@arg1@/: A @/GStrv/@ of theme directories -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClientIconThemeDirsChangedCallback`@.
noClientIconThemeDirsChangedCallback :: Maybe ClientIconThemeDirsChangedCallback
noClientIconThemeDirsChangedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ClientIconThemeDirsChanged :: MonadIO m => ClientIconThemeDirsChangedCallback -> m (GClosure C_ClientIconThemeDirsChangedCallback)
genClosure_ClientIconThemeDirsChanged cb = liftIO $ do
    let cb' = wrap_ClientIconThemeDirsChangedCallback cb
    mk_ClientIconThemeDirsChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ClientIconThemeDirsChangedCallback` into a `C_ClientIconThemeDirsChangedCallback`.
wrap_ClientIconThemeDirsChangedCallback ::
    ClientIconThemeDirsChangedCallback ->
    C_ClientIconThemeDirsChangedCallback
wrap_ClientIconThemeDirsChangedCallback _cb _ arg1 _ = do
    _cb  arg1


{- |
Connect a signal handler for the “@icon-theme-dirs-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' client #iconThemeDirsChanged callback
@
-}
onClientIconThemeDirsChanged :: (IsClient a, MonadIO m) => a -> ClientIconThemeDirsChangedCallback -> m SignalHandlerId
onClientIconThemeDirsChanged obj cb = liftIO $ do
    let cb' = wrap_ClientIconThemeDirsChangedCallback cb
    cb'' <- mk_ClientIconThemeDirsChangedCallback cb'
    connectSignalFunPtr obj "icon-theme-dirs-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@icon-theme-dirs-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' client #iconThemeDirsChanged callback
@
-}
afterClientIconThemeDirsChanged :: (IsClient a, MonadIO m) => a -> ClientIconThemeDirsChangedCallback -> m SignalHandlerId
afterClientIconThemeDirsChanged obj cb = liftIO $ do
    let cb' = wrap_ClientIconThemeDirsChangedCallback cb
    cb'' <- mk_ClientIconThemeDirsChangedCallback cb'
    connectSignalFunPtr obj "icon-theme-dirs-changed" cb'' SignalConnectAfter


-- signal Client::item-activate
{- |
Signaled when the server wants to activate an item in
		order to display the menu.
-}
type ClientItemActivateCallback =
    GObject.Object.Object
    {- ^ /@arg1@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' activated -}
    -> Word32
    {- ^ /@arg2@/: A timestamp that the event happened at -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClientItemActivateCallback`@.
noClientItemActivateCallback :: Maybe ClientItemActivateCallback
noClientItemActivateCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ClientItemActivate :: MonadIO m => ClientItemActivateCallback -> m (GClosure C_ClientItemActivateCallback)
genClosure_ClientItemActivate cb = liftIO $ do
    let cb' = wrap_ClientItemActivateCallback cb
    mk_ClientItemActivateCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ClientItemActivateCallback` into a `C_ClientItemActivateCallback`.
wrap_ClientItemActivateCallback ::
    ClientItemActivateCallback ->
    C_ClientItemActivateCallback
wrap_ClientItemActivateCallback _cb _ arg1 arg2 _ = do
    arg1' <- (newObject GObject.Object.Object) arg1
    _cb  arg1' arg2


{- |
Connect a signal handler for the “@item-activate@” 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' client #itemActivate callback
@
-}
onClientItemActivate :: (IsClient a, MonadIO m) => a -> ClientItemActivateCallback -> m SignalHandlerId
onClientItemActivate obj cb = liftIO $ do
    let cb' = wrap_ClientItemActivateCallback cb
    cb'' <- mk_ClientItemActivateCallback cb'
    connectSignalFunPtr obj "item-activate" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@item-activate@” 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' client #itemActivate callback
@
-}
afterClientItemActivate :: (IsClient a, MonadIO m) => a -> ClientItemActivateCallback -> m SignalHandlerId
afterClientItemActivate obj cb = liftIO $ do
    let cb' = wrap_ClientItemActivateCallback cb
    cb'' <- mk_ClientItemActivateCallback cb'
    connectSignalFunPtr obj "item-activate" cb'' SignalConnectAfter


-- signal Client::layout-updated
{- |
/No description available in the introspection data./
-}
type ClientLayoutUpdatedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClientLayoutUpdatedCallback`@.
noClientLayoutUpdatedCallback :: Maybe ClientLayoutUpdatedCallback
noClientLayoutUpdatedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ClientLayoutUpdated :: MonadIO m => ClientLayoutUpdatedCallback -> m (GClosure C_ClientLayoutUpdatedCallback)
genClosure_ClientLayoutUpdated cb = liftIO $ do
    let cb' = wrap_ClientLayoutUpdatedCallback cb
    mk_ClientLayoutUpdatedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ClientLayoutUpdatedCallback` into a `C_ClientLayoutUpdatedCallback`.
wrap_ClientLayoutUpdatedCallback ::
    ClientLayoutUpdatedCallback ->
    C_ClientLayoutUpdatedCallback
wrap_ClientLayoutUpdatedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@layout-updated@” 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' client #layoutUpdated callback
@
-}
onClientLayoutUpdated :: (IsClient a, MonadIO m) => a -> ClientLayoutUpdatedCallback -> m SignalHandlerId
onClientLayoutUpdated obj cb = liftIO $ do
    let cb' = wrap_ClientLayoutUpdatedCallback cb
    cb'' <- mk_ClientLayoutUpdatedCallback cb'
    connectSignalFunPtr obj "layout-updated" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@layout-updated@” 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' client #layoutUpdated callback
@
-}
afterClientLayoutUpdated :: (IsClient a, MonadIO m) => a -> ClientLayoutUpdatedCallback -> m SignalHandlerId
afterClientLayoutUpdated obj cb = liftIO $ do
    let cb' = wrap_ClientLayoutUpdatedCallback cb
    cb'' <- mk_ClientLayoutUpdatedCallback cb'
    connectSignalFunPtr obj "layout-updated" cb'' SignalConnectAfter


-- signal Client::new-menuitem
{- |
Signaled when the client creates a new menuitem.  This
		doesn\'t mean that it\'s placed anywhere.  The parent that
		it\'s applied to will signal 'GI.Dbusmenu.Objects.Menuitem.Menuitem'::@/child-added/@
		when it gets parented.
-}
type ClientNewMenuitemCallback =
    GObject.Object.Object
    {- ^ /@arg1@/: The new 'GI.Dbusmenu.Objects.Menuitem.Menuitem' created -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClientNewMenuitemCallback`@.
noClientNewMenuitemCallback :: Maybe ClientNewMenuitemCallback
noClientNewMenuitemCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ClientNewMenuitem :: MonadIO m => ClientNewMenuitemCallback -> m (GClosure C_ClientNewMenuitemCallback)
genClosure_ClientNewMenuitem cb = liftIO $ do
    let cb' = wrap_ClientNewMenuitemCallback cb
    mk_ClientNewMenuitemCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ClientNewMenuitemCallback` into a `C_ClientNewMenuitemCallback`.
wrap_ClientNewMenuitemCallback ::
    ClientNewMenuitemCallback ->
    C_ClientNewMenuitemCallback
wrap_ClientNewMenuitemCallback _cb _ arg1 _ = do
    arg1' <- (newObject GObject.Object.Object) arg1
    _cb  arg1'


{- |
Connect a signal handler for the “@new-menuitem@” 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' client #newMenuitem callback
@
-}
onClientNewMenuitem :: (IsClient a, MonadIO m) => a -> ClientNewMenuitemCallback -> m SignalHandlerId
onClientNewMenuitem obj cb = liftIO $ do
    let cb' = wrap_ClientNewMenuitemCallback cb
    cb'' <- mk_ClientNewMenuitemCallback cb'
    connectSignalFunPtr obj "new-menuitem" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@new-menuitem@” 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' client #newMenuitem callback
@
-}
afterClientNewMenuitem :: (IsClient a, MonadIO m) => a -> ClientNewMenuitemCallback -> m SignalHandlerId
afterClientNewMenuitem obj cb = liftIO $ do
    let cb' = wrap_ClientNewMenuitemCallback cb
    cb'' <- mk_ClientNewMenuitemCallback cb'
    connectSignalFunPtr obj "new-menuitem" cb'' SignalConnectAfter


-- signal Client::root-changed
{- |
The layout has changed in a way that can not be
		represented by the individual items changing as the
		root of this client has changed.
-}
type ClientRootChangedCallback =
    GObject.Object.Object
    {- ^ /@arg1@/: The new root 'GI.Dbusmenu.Objects.Menuitem.Menuitem' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClientRootChangedCallback`@.
noClientRootChangedCallback :: Maybe ClientRootChangedCallback
noClientRootChangedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ClientRootChanged :: MonadIO m => ClientRootChangedCallback -> m (GClosure C_ClientRootChangedCallback)
genClosure_ClientRootChanged cb = liftIO $ do
    let cb' = wrap_ClientRootChangedCallback cb
    mk_ClientRootChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ClientRootChangedCallback` into a `C_ClientRootChangedCallback`.
wrap_ClientRootChangedCallback ::
    ClientRootChangedCallback ->
    C_ClientRootChangedCallback
wrap_ClientRootChangedCallback _cb _ arg1 _ = do
    arg1' <- (newObject GObject.Object.Object) arg1
    _cb  arg1'


{- |
Connect a signal handler for the “@root-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' client #rootChanged callback
@
-}
onClientRootChanged :: (IsClient a, MonadIO m) => a -> ClientRootChangedCallback -> m SignalHandlerId
onClientRootChanged obj cb = liftIO $ do
    let cb' = wrap_ClientRootChangedCallback cb
    cb'' <- mk_ClientRootChangedCallback cb'
    connectSignalFunPtr obj "root-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@root-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' client #rootChanged callback
@
-}
afterClientRootChanged :: (IsClient a, MonadIO m) => a -> ClientRootChangedCallback -> m SignalHandlerId
afterClientRootChanged obj cb = liftIO $ do
    let cb' = wrap_ClientRootChangedCallback cb
    cb'' <- mk_ClientRootChangedCallback cb'
    connectSignalFunPtr obj "root-changed" cb'' SignalConnectAfter


-- VVV Prop "dbus-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

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

@
'Data.GI.Base.Attributes.get' client #dbusName
@
-}
getClientDbusName :: (MonadIO m, IsClient o) => o -> m (Maybe T.Text)
getClientDbusName obj = liftIO $ B.Properties.getObjectPropertyString obj "dbus-name"

{- |
Construct a `GValueConstruct` with valid value for the “@dbus-name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructClientDbusName :: (IsClient o) => T.Text -> IO (GValueConstruct o)
constructClientDbusName val = B.Properties.constructObjectPropertyString "dbus-name" (Just val)

#if ENABLE_OVERLOADING
data ClientDbusNamePropertyInfo
instance AttrInfo ClientDbusNamePropertyInfo where
    type AttrAllowedOps ClientDbusNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ClientDbusNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint ClientDbusNamePropertyInfo = IsClient
    type AttrGetType ClientDbusNamePropertyInfo = (Maybe T.Text)
    type AttrLabel ClientDbusNamePropertyInfo = "dbus-name"
    type AttrOrigin ClientDbusNamePropertyInfo = Client
    attrGet _ = getClientDbusName
    attrSet _ = undefined
    attrConstruct _ = constructClientDbusName
    attrClear _ = undefined
#endif

-- VVV Prop "dbus-object"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

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

@
'Data.GI.Base.Attributes.get' client #dbusObject
@
-}
getClientDbusObject :: (MonadIO m, IsClient o) => o -> m (Maybe T.Text)
getClientDbusObject obj = liftIO $ B.Properties.getObjectPropertyString obj "dbus-object"

{- |
Construct a `GValueConstruct` with valid value for the “@dbus-object@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructClientDbusObject :: (IsClient o) => T.Text -> IO (GValueConstruct o)
constructClientDbusObject val = B.Properties.constructObjectPropertyString "dbus-object" (Just val)

#if ENABLE_OVERLOADING
data ClientDbusObjectPropertyInfo
instance AttrInfo ClientDbusObjectPropertyInfo where
    type AttrAllowedOps ClientDbusObjectPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ClientDbusObjectPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint ClientDbusObjectPropertyInfo = IsClient
    type AttrGetType ClientDbusObjectPropertyInfo = (Maybe T.Text)
    type AttrLabel ClientDbusObjectPropertyInfo = "dbus-object"
    type AttrOrigin ClientDbusObjectPropertyInfo = Client
    attrGet _ = getClientDbusObject
    attrSet _ = undefined
    attrConstruct _ = constructClientDbusObject
    attrClear _ = undefined
#endif

-- VVV Prop "group-events"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

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

@
'Data.GI.Base.Attributes.get' client #groupEvents
@
-}
getClientGroupEvents :: (MonadIO m, IsClient o) => o -> m Bool
getClientGroupEvents obj = liftIO $ B.Properties.getObjectPropertyBool obj "group-events"

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

@
'Data.GI.Base.Attributes.set' client [ #groupEvents 'Data.GI.Base.Attributes.:=' value ]
@
-}
setClientGroupEvents :: (MonadIO m, IsClient o) => o -> Bool -> m ()
setClientGroupEvents obj val = liftIO $ B.Properties.setObjectPropertyBool obj "group-events" val

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

#if ENABLE_OVERLOADING
data ClientGroupEventsPropertyInfo
instance AttrInfo ClientGroupEventsPropertyInfo where
    type AttrAllowedOps ClientGroupEventsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ClientGroupEventsPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint ClientGroupEventsPropertyInfo = IsClient
    type AttrGetType ClientGroupEventsPropertyInfo = Bool
    type AttrLabel ClientGroupEventsPropertyInfo = "group-events"
    type AttrOrigin ClientGroupEventsPropertyInfo = Client
    attrGet _ = getClientGroupEvents
    attrSet _ = setClientGroupEvents
    attrConstruct _ = constructClientGroupEvents
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList Client
type instance O.AttributeList Client = ClientAttributeList
type ClientAttributeList = ('[ '("dbusName", ClientDbusNamePropertyInfo), '("dbusObject", ClientDbusObjectPropertyInfo), '("groupEvents", ClientGroupEventsPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
clientDbusName :: AttrLabelProxy "dbusName"
clientDbusName = AttrLabelProxy

clientDbusObject :: AttrLabelProxy "dbusObject"
clientDbusObject = AttrLabelProxy

clientGroupEvents :: AttrLabelProxy "groupEvents"
clientGroupEvents = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data ClientEventResultSignalInfo
instance SignalInfo ClientEventResultSignalInfo where
    type HaskellCallbackType ClientEventResultSignalInfo = ClientEventResultCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ClientEventResultCallback cb
        cb'' <- mk_ClientEventResultCallback cb'
        connectSignalFunPtr obj "event-result" cb'' connectMode

data ClientIconThemeDirsChangedSignalInfo
instance SignalInfo ClientIconThemeDirsChangedSignalInfo where
    type HaskellCallbackType ClientIconThemeDirsChangedSignalInfo = ClientIconThemeDirsChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ClientIconThemeDirsChangedCallback cb
        cb'' <- mk_ClientIconThemeDirsChangedCallback cb'
        connectSignalFunPtr obj "icon-theme-dirs-changed" cb'' connectMode

data ClientItemActivateSignalInfo
instance SignalInfo ClientItemActivateSignalInfo where
    type HaskellCallbackType ClientItemActivateSignalInfo = ClientItemActivateCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ClientItemActivateCallback cb
        cb'' <- mk_ClientItemActivateCallback cb'
        connectSignalFunPtr obj "item-activate" cb'' connectMode

data ClientLayoutUpdatedSignalInfo
instance SignalInfo ClientLayoutUpdatedSignalInfo where
    type HaskellCallbackType ClientLayoutUpdatedSignalInfo = ClientLayoutUpdatedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ClientLayoutUpdatedCallback cb
        cb'' <- mk_ClientLayoutUpdatedCallback cb'
        connectSignalFunPtr obj "layout-updated" cb'' connectMode

data ClientNewMenuitemSignalInfo
instance SignalInfo ClientNewMenuitemSignalInfo where
    type HaskellCallbackType ClientNewMenuitemSignalInfo = ClientNewMenuitemCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ClientNewMenuitemCallback cb
        cb'' <- mk_ClientNewMenuitemCallback cb'
        connectSignalFunPtr obj "new-menuitem" cb'' connectMode

data ClientRootChangedSignalInfo
instance SignalInfo ClientRootChangedSignalInfo where
    type HaskellCallbackType ClientRootChangedSignalInfo = ClientRootChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ClientRootChangedCallback cb
        cb'' <- mk_ClientRootChangedCallback cb'
        connectSignalFunPtr obj "root-changed" cb'' connectMode

type instance O.SignalList Client = ClientSignalList
type ClientSignalList = ('[ '("eventResult", ClientEventResultSignalInfo), '("iconThemeDirsChanged", ClientIconThemeDirsChangedSignalInfo), '("itemActivate", ClientItemActivateSignalInfo), '("layoutUpdated", ClientLayoutUpdatedSignalInfo), '("newMenuitem", ClientNewMenuitemSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("rootChanged", ClientRootChangedSignalInfo)] :: [(Symbol, *)])

#endif

-- method Client::new
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The DBus name for the server to connect to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The object on the server to monitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Client"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_client_new" dbusmenu_client_new ::
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- object : TBasicType TUTF8
    IO (Ptr Client)

{- |
This function creates a new client that connects to a specific
server on DBus.  That server is at a specific location sharing
a known object.  The interface is assumed by the code to be
the DBus menu interface.  The newly created client will start
sending out events as it syncs up with the server.
-}
clientNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: The DBus name for the server to connect to -}
    -> T.Text
    {- ^ /@object@/: The object on the server to monitor -}
    -> m Client
    {- ^ __Returns:__ A brand new 'GI.Dbusmenu.Objects.Client.Client' -}
clientNew name object = liftIO $ do
    name' <- textToCString name
    object' <- textToCString object
    result <- dbusmenu_client_new name' object'
    checkUnexpectedReturnNULL "clientNew" result
    result' <- (wrapObject Client) result
    freeMem name'
    freeMem object'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Client::add_type_handler
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "client", argType = TInterface (Name {namespace = "Dbusmenu", name = "Client"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Client where we're getting types coming in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A text string that will be matched with the 'type'\n    property on incoming menu items", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "newfunc", argType = TInterface (Name {namespace = "Dbusmenu", name = "ClientTypeHandler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The function that will be executed with those new\n    items when they come in.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_client_add_type_handler" dbusmenu_client_add_type_handler ::
    Ptr Client ->                           -- client : TInterface (Name {namespace = "Dbusmenu", name = "Client"})
    CString ->                              -- type : TBasicType TUTF8
    FunPtr Dbusmenu.Callbacks.C_ClientTypeHandler -> -- newfunc : TInterface (Name {namespace = "Dbusmenu", name = "ClientTypeHandler"})
    IO CInt

{- |
This function connects into the type handling of the 'GI.Dbusmenu.Objects.Client.Client'.
Every new menuitem that comes in immediately gets asked for its
properties.  When we get those properties we check the \'type\'
property and look to see if it matches a handler that is known
by the client.  If so, the /@newfunc@/ function is executed on that
'GI.Dbusmenu.Objects.Menuitem.Menuitem'.  If not, then the DbusmenuClient::new-menuitem
signal is sent.

In the future the known types will be sent to the server so that it
can make choices about the menu item types availble.
-}
clientAddTypeHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsClient a) =>
    a
    {- ^ /@client@/: Client where we\'re getting types coming in -}
    -> T.Text
    {- ^ /@type@/: A text string that will be matched with the \'type\'
    property on incoming menu items -}
    -> Dbusmenu.Callbacks.ClientTypeHandler
    {- ^ /@newfunc@/: The function that will be executed with those new
    items when they come in. -}
    -> m Bool
    {- ^ __Returns:__ If registering the new type was successful. -}
clientAddTypeHandler client type_ newfunc = liftIO $ do
    client' <- unsafeManagedPtrCastPtr client
    type_' <- textToCString type_
    newfunc' <- Dbusmenu.Callbacks.mk_ClientTypeHandler (Dbusmenu.Callbacks.wrap_ClientTypeHandler Nothing (Dbusmenu.Callbacks.drop_closures_ClientTypeHandler newfunc))
    result <- dbusmenu_client_add_type_handler client' type_' newfunc'
    let result' = (/= 0) result
    touchManagedPtr client
    freeMem type_'
    return result'

#if ENABLE_OVERLOADING
data ClientAddTypeHandlerMethodInfo
instance (signature ~ (T.Text -> Dbusmenu.Callbacks.ClientTypeHandler -> m Bool), MonadIO m, IsClient a) => O.MethodInfo ClientAddTypeHandlerMethodInfo a signature where
    overloadedMethod _ = clientAddTypeHandler

#endif

-- method Client::add_type_handler_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "client", argType = TInterface (Name {namespace = "Dbusmenu", name = "Client"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Client where we're getting types coming in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A text string that will be matched with the 'type'\n    property on incoming menu items", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "newfunc", argType = TInterface (Name {namespace = "Dbusmenu", name = "ClientTypeHandler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The function that will be executed with those new\n    items when they come in.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Data passed to @newfunc when it is called", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy_func", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A function that is called when the type handler is\n\tremoved (usually on client destruction) which will free\n\tthe resources in @user_data.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_client_add_type_handler_full" dbusmenu_client_add_type_handler_full ::
    Ptr Client ->                           -- client : TInterface (Name {namespace = "Dbusmenu", name = "Client"})
    CString ->                              -- type : TBasicType TUTF8
    FunPtr Dbusmenu.Callbacks.C_ClientTypeHandler -> -- newfunc : TInterface (Name {namespace = "Dbusmenu", name = "ClientTypeHandler"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy_func : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO CInt

{- |
This function connects into the type handling of the 'GI.Dbusmenu.Objects.Client.Client'.
Every new menuitem that comes in immediately gets asked for its
properties.  When we get those properties we check the \'type\'
property and look to see if it matches a handler that is known
by the client.  If so, the /@newfunc@/ function is executed on that
'GI.Dbusmenu.Objects.Menuitem.Menuitem'.  If not, then the DbusmenuClient::new-menuitem
signal is sent.

In the future the known types will be sent to the server so that it
can make choices about the menu item types availble.
-}
clientAddTypeHandlerFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsClient a) =>
    a
    {- ^ /@client@/: Client where we\'re getting types coming in -}
    -> T.Text
    {- ^ /@type@/: A text string that will be matched with the \'type\'
    property on incoming menu items -}
    -> Dbusmenu.Callbacks.ClientTypeHandler
    {- ^ /@newfunc@/: The function that will be executed with those new
    items when they come in. -}
    -> m Bool
    {- ^ __Returns:__ If registering the new type was successful. -}
clientAddTypeHandlerFull client type_ newfunc = liftIO $ do
    client' <- unsafeManagedPtrCastPtr client
    type_' <- textToCString type_
    newfunc' <- Dbusmenu.Callbacks.mk_ClientTypeHandler (Dbusmenu.Callbacks.wrap_ClientTypeHandler Nothing (Dbusmenu.Callbacks.drop_closures_ClientTypeHandler newfunc))
    let userData = castFunPtrToPtr newfunc'
    let destroyFunc = safeFreeFunPtrPtr
    result <- dbusmenu_client_add_type_handler_full client' type_' newfunc' userData destroyFunc
    let result' = (/= 0) result
    touchManagedPtr client
    freeMem type_'
    return result'

#if ENABLE_OVERLOADING
data ClientAddTypeHandlerFullMethodInfo
instance (signature ~ (T.Text -> Dbusmenu.Callbacks.ClientTypeHandler -> m Bool), MonadIO m, IsClient a) => O.MethodInfo ClientAddTypeHandlerFullMethodInfo a signature where
    overloadedMethod _ = clientAddTypeHandlerFull

#endif

-- method Client::get_icon_paths
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "client", argType = TInterface (Name {namespace = "Dbusmenu", name = "Client"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuClient to get the icon paths from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_client_get_icon_paths" dbusmenu_client_get_icon_paths ::
    Ptr Client ->                           -- client : TInterface (Name {namespace = "Dbusmenu", name = "Client"})
    IO (Ptr CString)

{- |
Gets the stored and exported icon paths from the client.
-}
clientGetIconPaths ::
    (B.CallStack.HasCallStack, MonadIO m, IsClient a) =>
    a
    {- ^ /@client@/: The 'GI.Dbusmenu.Objects.Client.Client' to get the icon paths from -}
    -> m [T.Text]
    {- ^ __Returns:__ A NULL-terminated list of icon paths with
  memory managed by the client.  Duplicate if you want
  to keep them. -}
clientGetIconPaths client = liftIO $ do
    client' <- unsafeManagedPtrCastPtr client
    result <- dbusmenu_client_get_icon_paths client'
    checkUnexpectedReturnNULL "clientGetIconPaths" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr client
    return result'

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

#endif

-- method Client::get_root
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "client", argType = TInterface (Name {namespace = "Dbusmenu", name = "Client"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuClient to get the root node from", 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_client_get_root" dbusmenu_client_get_root ::
    Ptr Client ->                           -- client : TInterface (Name {namespace = "Dbusmenu", name = "Client"})
    IO (Ptr Dbusmenu.Menuitem.Menuitem)

{- |
Grabs the root node for the specified client /@client@/.  This
function may block.  It will block if there is currently a
call to update the layout, it will block on that layout
updated and then return the newly updated layout.  Chances
are that this update is in the queue for the mainloop as
it would have been requested some time ago, but in theory
it could block longer.
-}
clientGetRoot ::
    (B.CallStack.HasCallStack, MonadIO m, IsClient a) =>
    a
    {- ^ /@client@/: The 'GI.Dbusmenu.Objects.Client.Client' to get the root node from -}
    -> m Dbusmenu.Menuitem.Menuitem
    {- ^ __Returns:__ A 'GI.Dbusmenu.Objects.Menuitem.Menuitem' representing the root of
	menu on the server.  If there is no server or there is
	an error receiving its layout it\'ll return @/NULL/@. -}
clientGetRoot client = liftIO $ do
    client' <- unsafeManagedPtrCastPtr client
    result <- dbusmenu_client_get_root client'
    checkUnexpectedReturnNULL "clientGetRoot" result
    result' <- (newObject Dbusmenu.Menuitem.Menuitem) result
    touchManagedPtr client
    return result'

#if ENABLE_OVERLOADING
data ClientGetRootMethodInfo
instance (signature ~ (m Dbusmenu.Menuitem.Menuitem), MonadIO m, IsClient a) => O.MethodInfo ClientGetRootMethodInfo a signature where
    overloadedMethod _ = clientGetRoot

#endif

-- method Client::get_status
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "client", argType = TInterface (Name {namespace = "Dbusmenu", name = "Client"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuClient to check the status on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Status"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_client_get_status" dbusmenu_client_get_status ::
    Ptr Client ->                           -- client : TInterface (Name {namespace = "Dbusmenu", name = "Client"})
    IO CUInt

{- |
Gets the recommended current status that the server
	is exporting for the menus.  In situtations where the
	value is @/DBUSMENU_STATUS_NOTICE/@ it is recommended that
	the client show the menus to the user an a more noticible
	way.

	Return value: Status being exported.
-}
clientGetStatus ::
    (B.CallStack.HasCallStack, MonadIO m, IsClient a) =>
    a
    {- ^ /@client@/: 'GI.Dbusmenu.Objects.Client.Client' to check the status on -}
    -> m Dbusmenu.Enums.Status
clientGetStatus client = liftIO $ do
    client' <- unsafeManagedPtrCastPtr client
    result <- dbusmenu_client_get_status client'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr client
    return result'

#if ENABLE_OVERLOADING
data ClientGetStatusMethodInfo
instance (signature ~ (m Dbusmenu.Enums.Status), MonadIO m, IsClient a) => O.MethodInfo ClientGetStatusMethodInfo a signature where
    overloadedMethod _ = clientGetStatus

#endif

-- method Client::get_text_direction
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "client", argType = TInterface (Name {namespace = "Dbusmenu", name = "Client"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuClient to check the text direction on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "TextDirection"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_client_get_text_direction" dbusmenu_client_get_text_direction ::
    Ptr Client ->                           -- client : TInterface (Name {namespace = "Dbusmenu", name = "Client"})
    IO CUInt

{- |
Gets the text direction that the server is exporting.  If
	the server is not exporting a direction then the value
	@/DBUSMENU_TEXT_DIRECTION_NONE/@ will be returned.

	Return value: Text direction being exported.
-}
clientGetTextDirection ::
    (B.CallStack.HasCallStack, MonadIO m, IsClient a) =>
    a
    {- ^ /@client@/: 'GI.Dbusmenu.Objects.Client.Client' to check the text direction on -}
    -> m Dbusmenu.Enums.TextDirection
clientGetTextDirection client = liftIO $ do
    client' <- unsafeManagedPtrCastPtr client
    result <- dbusmenu_client_get_text_direction client'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr client
    return result'

#if ENABLE_OVERLOADING
data ClientGetTextDirectionMethodInfo
instance (signature ~ (m Dbusmenu.Enums.TextDirection), MonadIO m, IsClient a) => O.MethodInfo ClientGetTextDirectionMethodInfo a signature where
    overloadedMethod _ = clientGetTextDirection

#endif