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

module GI.Gio.Objects.DBusMenuModel
    ( 

-- * Exported types
    DBusMenuModel(..)                       ,
    DBusMenuModelK                          ,
    toDBusMenuModel                         ,
    noDBusMenuModel                         ,


 -- * Methods
-- ** dBusMenuModelGet
    dBusMenuModelGet                        ,




    ) where

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

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

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

newtype DBusMenuModel = DBusMenuModel (ForeignPtr DBusMenuModel)
foreign import ccall "g_dbus_menu_model_get_type"
    c_g_dbus_menu_model_get_type :: IO GType

type instance ParentTypes DBusMenuModel = DBusMenuModelParentTypes
type DBusMenuModelParentTypes = '[MenuModel, GObject.Object]

instance GObject DBusMenuModel where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_dbus_menu_model_get_type
    

class GObject o => DBusMenuModelK o
instance (GObject o, IsDescendantOf DBusMenuModel o) => DBusMenuModelK o

toDBusMenuModel :: DBusMenuModelK o => o -> IO DBusMenuModel
toDBusMenuModel = unsafeCastTo DBusMenuModel

noDBusMenuModel :: Maybe DBusMenuModel
noDBusMenuModel = Nothing

type instance AttributeList DBusMenuModel = DBusMenuModelAttributeList
type DBusMenuModelAttributeList = ('[ ] :: [(Symbol, *)])

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

-- method DBusMenuModel::get
-- method type : MemberFunction
-- Args : [Arg {argName = "connection", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "connection", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusMenuModel"
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_menu_model_get" g_dbus_menu_model_get :: 
    Ptr DBusConnection ->                   -- connection : TInterface "Gio" "DBusConnection"
    CString ->                              -- bus_name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    IO (Ptr DBusMenuModel)


dBusMenuModelGet ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- connection
    T.Text ->                               -- bus_name
    T.Text ->                               -- object_path
    m DBusMenuModel
dBusMenuModelGet connection bus_name object_path = liftIO $ do
    let connection' = unsafeManagedPtrCastPtr connection
    bus_name' <- textToCString bus_name
    object_path' <- textToCString object_path
    result <- g_dbus_menu_model_get connection' bus_name' object_path'
    checkUnexpectedReturnNULL "g_dbus_menu_model_get" result
    result' <- (wrapObject DBusMenuModel) result
    touchManagedPtr connection
    freeMem bus_name'
    freeMem object_path'
    return result'