{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.DBusMenuModel
(
DBusMenuModel(..) ,
IsDBusMenuModel ,
toDBusMenuModel ,
#if defined(ENABLE_OVERLOADING)
ResolveDBusMenuModelMethod ,
#endif
dBusMenuModelGet ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GLib.Structs.String as GLib.String
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GObject.Structs.Parameter as GObject.Parameter
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.ActionGroup as Gio.ActionGroup
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncInitable as Gio.AsyncInitable
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusAuthObserver as Gio.DBusAuthObserver
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusMessage as Gio.DBusMessage
import {-# SOURCE #-} qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuAttributeIter as Gio.MenuAttributeIter
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuLinkIter as Gio.MenuLinkIter
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuModel as Gio.MenuModel
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.UnixFDList as Gio.UnixFDList
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusAnnotationInfo as Gio.DBusAnnotationInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusArgInfo as Gio.DBusArgInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusInterfaceInfo as Gio.DBusInterfaceInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusMethodInfo as Gio.DBusMethodInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusPropertyInfo as Gio.DBusPropertyInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusSignalInfo as Gio.DBusSignalInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusSubtreeVTable as Gio.DBusSubtreeVTable
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuModel as Gio.MenuModel
#endif
newtype = (SP.ManagedPtr DBusMenuModel)
deriving (DBusMenuModel -> DBusMenuModel -> Bool
(DBusMenuModel -> DBusMenuModel -> Bool)
-> (DBusMenuModel -> DBusMenuModel -> Bool) -> Eq DBusMenuModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DBusMenuModel -> DBusMenuModel -> Bool
== :: DBusMenuModel -> DBusMenuModel -> Bool
$c/= :: DBusMenuModel -> DBusMenuModel -> Bool
/= :: DBusMenuModel -> DBusMenuModel -> Bool
Eq)
instance SP.ManagedPtrNewtype DBusMenuModel where
toManagedPtr :: DBusMenuModel -> ManagedPtr DBusMenuModel
toManagedPtr (DBusMenuModel ManagedPtr DBusMenuModel
p) = ManagedPtr DBusMenuModel
p
foreign import ccall "g_dbus_menu_model_get_type"
:: IO B.Types.GType
instance B.Types.TypedObject DBusMenuModel where
glibType :: IO GType
glibType = IO GType
c_g_dbus_menu_model_get_type
instance B.Types.GObject DBusMenuModel
class (SP.GObject o, O.IsDescendantOf DBusMenuModel o) => o
instance (SP.GObject o, O.IsDescendantOf DBusMenuModel o) => IsDBusMenuModel o
instance O.HasParentTypes DBusMenuModel
type instance O.ParentTypes DBusMenuModel = '[Gio.MenuModel.MenuModel, GObject.Object.Object]
toDBusMenuModel :: (MIO.MonadIO m, IsDBusMenuModel o) => o -> m DBusMenuModel
= IO DBusMenuModel -> m DBusMenuModel
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO DBusMenuModel -> m DBusMenuModel)
-> (o -> IO DBusMenuModel) -> o -> m DBusMenuModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr DBusMenuModel -> DBusMenuModel)
-> o -> IO DBusMenuModel
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr DBusMenuModel -> DBusMenuModel
DBusMenuModel
instance B.GValue.IsGValue (Maybe DBusMenuModel) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_dbus_menu_model_get_type
gvalueSet_ :: Ptr GValue -> Maybe DBusMenuModel -> IO ()
gvalueSet_ Ptr GValue
gv Maybe DBusMenuModel
P.Nothing = Ptr GValue -> Ptr DBusMenuModel -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr DBusMenuModel
forall a. Ptr a
FP.nullPtr :: FP.Ptr DBusMenuModel)
gvalueSet_ Ptr GValue
gv (P.Just DBusMenuModel
obj) = DBusMenuModel -> (Ptr DBusMenuModel -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DBusMenuModel
obj (Ptr GValue -> Ptr DBusMenuModel -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe DBusMenuModel)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr DBusMenuModel)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr DBusMenuModel)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject DBusMenuModel ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveDBusMenuModelMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveDBusMenuModelMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDBusMenuModelMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDBusMenuModelMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDBusMenuModelMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDBusMenuModelMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDBusMenuModelMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDBusMenuModelMethod "isMutable" o = Gio.MenuModel.MenuModelIsMutableMethodInfo
ResolveDBusMenuModelMethod "itemsChanged" o = Gio.MenuModel.MenuModelItemsChangedMethodInfo
ResolveDBusMenuModelMethod "iterateItemAttributes" o = Gio.MenuModel.MenuModelIterateItemAttributesMethodInfo
ResolveDBusMenuModelMethod "iterateItemLinks" o = Gio.MenuModel.MenuModelIterateItemLinksMethodInfo
ResolveDBusMenuModelMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDBusMenuModelMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDBusMenuModelMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDBusMenuModelMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDBusMenuModelMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDBusMenuModelMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDBusMenuModelMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDBusMenuModelMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDBusMenuModelMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDBusMenuModelMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDBusMenuModelMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDBusMenuModelMethod "getItemAttributeValue" o = Gio.MenuModel.MenuModelGetItemAttributeValueMethodInfo
ResolveDBusMenuModelMethod "getItemLink" o = Gio.MenuModel.MenuModelGetItemLinkMethodInfo
ResolveDBusMenuModelMethod "getNItems" o = Gio.MenuModel.MenuModelGetNItemsMethodInfo
ResolveDBusMenuModelMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDBusMenuModelMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDBusMenuModelMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDBusMenuModelMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveDBusMenuModelMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDBusMenuModelMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDBusMenuModelMethod t DBusMenuModel, O.OverloadedMethod info DBusMenuModel p) => OL.IsLabel t (DBusMenuModel -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveDBusMenuModelMethod t DBusMenuModel, O.OverloadedMethod info DBusMenuModel p, R.HasField t DBusMenuModel p) => R.HasField t DBusMenuModel p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveDBusMenuModelMethod t DBusMenuModel, O.OverloadedMethodInfo info DBusMenuModel) => OL.IsLabel t (O.MethodProxy info DBusMenuModel) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DBusMenuModel
type instance O.AttributeList DBusMenuModel = DBusMenuModelAttributeList
type DBusMenuModelAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DBusMenuModel = DBusMenuModelSignalList
type DBusMenuModelSignalList = ('[ '("itemsChanged", Gio.MenuModel.MenuModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_dbus_menu_model_get" ::
Ptr Gio.DBusConnection.DBusConnection ->
CString ->
CString ->
IO (Ptr DBusMenuModel)
dBusMenuModelGet ::
(B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
a
-> Maybe (T.Text)
-> T.Text
-> m DBusMenuModel
a
connection Maybe Text
busName Text
objectPath = IO DBusMenuModel -> m DBusMenuModel
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusMenuModel -> m DBusMenuModel)
-> IO DBusMenuModel -> m DBusMenuModel
forall a b. (a -> b) -> a -> b
$ do
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeBusName <- case busName of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jBusName -> do
jBusName' <- Text -> IO (Ptr CChar)
textToCString Text
jBusName
return jBusName'
objectPath' <- textToCString objectPath
result <- g_dbus_menu_model_get connection' maybeBusName objectPath'
checkUnexpectedReturnNULL "dBusMenuModelGet" result
result' <- (wrapObject DBusMenuModel) result
touchManagedPtr connection
freeMem maybeBusName
freeMem objectPath'
return result'
#if defined(ENABLE_OVERLOADING)
#endif