-- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria #if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__)) #define ENABLE_OVERLOADING #endif module GI.DbusmenuGtk3.Functions ( -- * Methods -- ** gtkParseGetCachedItem #method:gtkParseGetCachedItem# gtkParseGetCachedItem , -- ** gtkParseMenuStructure #method:gtkParseMenuStructure# gtkParseMenuStructure , -- ** menuitemPropertyGetImage #method:menuitemPropertyGetImage# menuitemPropertyGetImage , -- ** menuitemPropertyGetShortcut #method:menuitemPropertyGetShortcut# menuitemPropertyGetShortcut , -- ** menuitemPropertySetImage #method:menuitemPropertySetImage# menuitemPropertySetImage , -- ** menuitemPropertySetShortcut #method:menuitemPropertySetShortcut# menuitemPropertySetShortcut , -- ** menuitemPropertySetShortcutMenuitem #method:menuitemPropertySetShortcutMenuitem# menuitemPropertySetShortcutMenuitem , -- ** menuitemPropertySetShortcutString #method:menuitemPropertySetShortcutString# menuitemPropertySetShortcutString , ) 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.GI.Base.Signals as B.Signals 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.Objects.Menuitem as Dbusmenu.Menuitem import qualified GI.Gdk.Flags as Gdk.Flags import qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf import qualified GI.Gtk.Objects.MenuItem as Gtk.MenuItem import qualified GI.Gtk.Objects.Widget as Gtk.Widget -- function dbusmenu_menuitem_property_set_shortcut_string -- Args: [ Arg -- { argCName = "menuitem" -- , argType = -- TInterface Name { namespace = "Dbusmenu" , name = "Menuitem" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The #DbusmenuMenuitem to set the shortcut on" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "shortcut" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "String describing the shortcut" -- , 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_shortcut_string" :: Ptr Dbusmenu.Menuitem.Menuitem -> -- menuitem : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}) CString -> -- shortcut : TBasicType TUTF8 IO CInt -- | This function takes a GTK shortcut string as defined in -- @/gtk_accelerator_parse/@ and turns that into the information -- required to send it over DBusmenu. menuitemPropertySetShortcutString :: (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a) => a -- ^ /@menuitem@/: The t'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the shortcut on -> T.Text -- ^ /@shortcut@/: String describing the shortcut -> m Bool -- ^ __Returns:__ Whether it was successful at setting the property. menuitem :: a menuitem shortcut :: Text shortcut = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do Ptr Menuitem menuitem' <- a -> IO (Ptr Menuitem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a menuitem CString shortcut' <- Text -> IO CString textToCString Text shortcut CInt result <- Ptr Menuitem -> CString -> IO CInt dbusmenu_menuitem_property_set_shortcut_string Ptr Menuitem menuitem' CString shortcut' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a menuitem CString -> IO () forall a. Ptr a -> IO () freeMem CString shortcut' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function dbusmenu_menuitem_property_set_shortcut_menuitem -- Args: [ Arg -- { argCName = "menuitem" -- , argType = -- TInterface Name { namespace = "Dbusmenu" , name = "Menuitem" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The #DbusmenuMenuitem to set the shortcut on" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "gmi" -- , argType = -- TInterface Name { namespace = "Gtk" , name = "MenuItem" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A menu item to steal the shortcut off of" -- , 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_shortcut_menuitem" :: Ptr Dbusmenu.Menuitem.Menuitem -> -- menuitem : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}) Ptr Gtk.MenuItem.MenuItem -> -- gmi : TInterface (Name {namespace = "Gtk", name = "MenuItem"}) IO CInt -- | Takes the shortcut that is installed on a menu item and calls -- @/dbusmenu_menuitem_property_set_shortcut/@ with it. It also sets -- up listeners to watch it change. menuitemPropertySetShortcutMenuitem :: (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a, Gtk.MenuItem.IsMenuItem b) => a -- ^ /@menuitem@/: The t'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the shortcut on -> b -- ^ /@gmi@/: A menu item to steal the shortcut off of -> m Bool -- ^ __Returns:__ Whether it was successful at setting the property. menuitem :: a menuitem gmi :: b gmi = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do Ptr Menuitem menuitem' <- a -> IO (Ptr Menuitem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a menuitem Ptr MenuItem gmi' <- b -> IO (Ptr MenuItem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr b gmi CInt result <- Ptr Menuitem -> Ptr MenuItem -> IO CInt dbusmenu_menuitem_property_set_shortcut_menuitem Ptr Menuitem menuitem' Ptr MenuItem gmi' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a menuitem b -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr b gmi Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function dbusmenu_menuitem_property_set_shortcut -- Args: [ Arg -- { argCName = "menuitem" -- , argType = -- TInterface Name { namespace = "Dbusmenu" , name = "Menuitem" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The #DbusmenuMenuitem to set the shortcut on" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "key" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The keycode of the key to send" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "modifier" -- , argType = -- TInterface Name { namespace = "Gdk" , name = "ModifierType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "A bitmask of modifiers used to activate the item" -- , 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_shortcut" :: Ptr Dbusmenu.Menuitem.Menuitem -> -- menuitem : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}) Word32 -> -- key : TBasicType TUInt CUInt -> -- modifier : TInterface (Name {namespace = "Gdk", name = "ModifierType"}) IO CInt -- | Takes the modifer described by /@key@/ and /@modifier@/ and places that into -- the format sending across Dbus for shortcuts. menuitemPropertySetShortcut :: (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a) => a -- ^ /@menuitem@/: The t'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the shortcut on -> Word32 -- ^ /@key@/: The keycode of the key to send -> [Gdk.Flags.ModifierType] -- ^ /@modifier@/: A bitmask of modifiers used to activate the item -> m Bool -- ^ __Returns:__ Whether it was successful at setting the property. menuitem :: a menuitem key :: Word32 key modifier :: [ModifierType] modifier = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do Ptr Menuitem menuitem' <- a -> IO (Ptr Menuitem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a menuitem let modifier' :: CUInt modifier' = [ModifierType] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [ModifierType] modifier CInt result <- Ptr Menuitem -> Word32 -> CUInt -> IO CInt dbusmenu_menuitem_property_set_shortcut Ptr Menuitem menuitem' Word32 key CUInt modifier' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a menuitem Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function dbusmenu_menuitem_property_set_image -- Args: [ Arg -- { argCName = "menuitem" -- , 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 = "data" -- , argType = -- TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The image to place on 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_image" :: Ptr Dbusmenu.Menuitem.Menuitem -> -- menuitem : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}) CString -> -- property : TBasicType TUTF8 Ptr GdkPixbuf.Pixbuf.Pixbuf -> -- data : TInterface (Name {namespace = "GdkPixbuf", name = "Pixbuf"}) IO CInt -- | This function takes the pixbuf that is stored in /@data@/ and -- turns it into a base64 encoded PNG so that it can be placed -- onto a standard t'GI.Dbusmenu.Objects.Menuitem.Menuitem' property. menuitemPropertySetImage :: (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a, GdkPixbuf.Pixbuf.IsPixbuf b) => a -- ^ /@menuitem@/: The t'GI.Dbusmenu.Objects.Menuitem.Menuitem' to set the property on. -> T.Text -- ^ /@property@/: Name of the property to set. -> b -- ^ /@data@/: The image to place on the property. -> m Bool -- ^ __Returns:__ Whether the function was able to set the property -- or not. menuitem :: a menuitem property :: Text property data_ :: b data_ = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do Ptr Menuitem menuitem' <- a -> IO (Ptr Menuitem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a menuitem CString property' <- Text -> IO CString textToCString Text property Ptr Pixbuf data_' <- b -> IO (Ptr Pixbuf) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr b data_ CInt result <- Ptr Menuitem -> CString -> Ptr Pixbuf -> IO CInt dbusmenu_menuitem_property_set_image Ptr Menuitem menuitem' CString property' Ptr Pixbuf data_' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a menuitem b -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr b data_ CString -> IO () forall a. Ptr a -> IO () freeMem CString property' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function dbusmenu_menuitem_property_get_shortcut -- Args: [ Arg -- { argCName = "menuitem" -- , argType = -- TInterface Name { namespace = "Dbusmenu" , name = "Menuitem" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The #DbusmenuMenuitem to get the shortcut off" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "key" -- , argType = TBasicType TUInt -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Location to put the key value" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "modifier" -- , argType = -- TInterface Name { namespace = "Gdk" , name = "ModifierType" } -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Location to put the modifier mask" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "dbusmenu_menuitem_property_get_shortcut" :: Ptr Dbusmenu.Menuitem.Menuitem -> -- menuitem : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}) Ptr Word32 -> -- key : TBasicType TUInt Ptr CUInt -> -- modifier : TInterface (Name {namespace = "Gdk", name = "ModifierType"}) IO () -- | This function gets a GTK shortcut as a key and a mask -- for use to set the accelerators. menuitemPropertyGetShortcut :: (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a) => a -- ^ /@menuitem@/: The t'GI.Dbusmenu.Objects.Menuitem.Menuitem' to get the shortcut off -> m ((Word32, [Gdk.Flags.ModifierType])) menuitem :: a menuitem = IO (Word32, [ModifierType]) -> m (Word32, [ModifierType]) forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Word32, [ModifierType]) -> m (Word32, [ModifierType])) -> IO (Word32, [ModifierType]) -> m (Word32, [ModifierType]) forall a b. (a -> b) -> a -> b $ do Ptr Menuitem menuitem' <- a -> IO (Ptr Menuitem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a menuitem Ptr Word32 key <- IO (Ptr Word32) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Word32) Ptr CUInt modifier <- IO (Ptr CUInt) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr CUInt) Ptr Menuitem -> Ptr Word32 -> Ptr CUInt -> IO () dbusmenu_menuitem_property_get_shortcut Ptr Menuitem menuitem' Ptr Word32 key Ptr CUInt modifier Word32 key' <- Ptr Word32 -> IO Word32 forall a. Storable a => Ptr a -> IO a peek Ptr Word32 key CUInt modifier' <- Ptr CUInt -> IO CUInt forall a. Storable a => Ptr a -> IO a peek Ptr CUInt modifier let modifier'' :: [ModifierType] modifier'' = CUInt -> [ModifierType] forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b] wordToGFlags CUInt modifier' a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a menuitem Ptr Word32 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word32 key Ptr CUInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CUInt modifier (Word32, [ModifierType]) -> IO (Word32, [ModifierType]) forall (m :: * -> *) a. Monad m => a -> m a return (Word32 key', [ModifierType] modifier'') -- function dbusmenu_menuitem_property_get_image -- Args: [ Arg -- { argCName = "menuitem" -- , 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 name of the property to look for." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }) -- throws : False -- Skip return : False foreign import ccall "dbusmenu_menuitem_property_get_image" :: Ptr Dbusmenu.Menuitem.Menuitem -> -- menuitem : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}) CString -> -- property : TBasicType TUTF8 IO (Ptr GdkPixbuf.Pixbuf.Pixbuf) -- | This function looks on the menu item for a property by the -- name of /@property@/. If one exists it tries to turn it into -- a t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf'. It assumes that the property is a base64 encoded -- PNG file like the one created by @/dbusmenu_menuite_property_set_image/@. menuitemPropertyGetImage :: (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a) => a -- ^ /@menuitem@/: The t'GI.Dbusmenu.Objects.Menuitem.Menuitem' to look for the property on -> T.Text -- ^ /@property@/: The name of the property to look for. -> m GdkPixbuf.Pixbuf.Pixbuf -- ^ __Returns:__ A pixbuf or @/NULL/@ to signal error. menuitem :: a menuitem property :: Text property = IO Pixbuf -> m Pixbuf forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Pixbuf -> m Pixbuf) -> IO Pixbuf -> m Pixbuf forall a b. (a -> b) -> a -> b $ do Ptr Menuitem menuitem' <- a -> IO (Ptr Menuitem) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a menuitem CString property' <- Text -> IO CString textToCString Text property Ptr Pixbuf result <- Ptr Menuitem -> CString -> IO (Ptr Pixbuf) dbusmenu_menuitem_property_get_image Ptr Menuitem menuitem' CString property' Text -> Ptr Pixbuf -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "menuitemPropertyGetImage" Ptr Pixbuf result Pixbuf result' <- ((ManagedPtr Pixbuf -> Pixbuf) -> Ptr Pixbuf -> IO Pixbuf forall a b. (HasCallStack, GObject a, GObject b) => (ManagedPtr a -> a) -> Ptr b -> IO a wrapObject ManagedPtr Pixbuf -> Pixbuf GdkPixbuf.Pixbuf.Pixbuf) Ptr Pixbuf result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a menuitem CString -> IO () forall a. Ptr a -> IO () freeMem CString property' Pixbuf -> IO Pixbuf forall (m :: * -> *) a. Monad m => a -> m a return Pixbuf result' -- function dbusmenu_gtk_parse_menu_structure -- Args: [ Arg -- { argCName = "widget" -- , argType = TInterface Name { namespace = "Gtk" , name = "Widget" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "A #GtkMenuItem or #GtkMenuShell to turn into a #DbusmenuMenuitem" -- , 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_gtk_parse_menu_structure" :: Ptr Gtk.Widget.Widget -> -- widget : TInterface (Name {namespace = "Gtk", name = "Widget"}) IO (Ptr Dbusmenu.Menuitem.Menuitem) -- | Goes through the GTK structures and turns them into the appropraite -- Dbusmenu structures along with setting up all the relationships -- between the objects. It also stores the dbusmenu items as a cache -- on the GTK items so that they\'ll be reused if necissary. gtkParseMenuStructure :: (B.CallStack.HasCallStack, MonadIO m, Gtk.Widget.IsWidget a) => a -- ^ /@widget@/: A t'GI.Gtk.Objects.MenuItem.MenuItem' or t'GI.Gtk.Objects.MenuShell.MenuShell' to turn into a t'GI.Dbusmenu.Objects.Menuitem.Menuitem' -> m Dbusmenu.Menuitem.Menuitem -- ^ __Returns:__ A dbusmenu item representing the menu structure gtkParseMenuStructure :: a -> m Menuitem gtkParseMenuStructure widget :: a widget = IO Menuitem -> m Menuitem forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Menuitem -> m Menuitem) -> IO Menuitem -> m Menuitem forall a b. (a -> b) -> a -> b $ do Ptr Widget widget' <- a -> IO (Ptr Widget) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a widget Ptr Menuitem result <- Ptr Widget -> IO (Ptr Menuitem) dbusmenu_gtk_parse_menu_structure Ptr Widget widget' Text -> Ptr Menuitem -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "gtkParseMenuStructure" Ptr Menuitem result Menuitem result' <- ((ManagedPtr Menuitem -> Menuitem) -> Ptr Menuitem -> IO Menuitem forall a b. (HasCallStack, GObject a, GObject b) => (ManagedPtr a -> a) -> Ptr b -> IO a wrapObject ManagedPtr Menuitem -> Menuitem Dbusmenu.Menuitem.Menuitem) Ptr Menuitem result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a widget Menuitem -> IO Menuitem forall (m :: * -> *) a. Monad m => a -> m a return Menuitem result' -- function dbusmenu_gtk_parse_get_cached_item -- Args: [ Arg -- { argCName = "widget" -- , argType = TInterface Name { namespace = "Gtk" , name = "Widget" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "A #GtkMenuItem that may have a cached #DbusmenuMenuitem from the parser" -- , 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_gtk_parse_get_cached_item" :: Ptr Gtk.Widget.Widget -> -- widget : TInterface (Name {namespace = "Gtk", name = "Widget"}) IO (Ptr Dbusmenu.Menuitem.Menuitem) -- | The Dbusmenu GTK parser adds cached items on the various -- menu items throughout the tree. Sometimes it can be useful -- to get that cached item to use directly. This function -- will retrieve it for you. gtkParseGetCachedItem :: (B.CallStack.HasCallStack, MonadIO m, Gtk.Widget.IsWidget a) => a -- ^ /@widget@/: A t'GI.Gtk.Objects.MenuItem.MenuItem' that may have a cached t'GI.Dbusmenu.Objects.Menuitem.Menuitem' from the parser -> m Dbusmenu.Menuitem.Menuitem -- ^ __Returns:__ A pointer to the cached item -- or NULL if it isn\'t there. gtkParseGetCachedItem :: a -> m Menuitem gtkParseGetCachedItem widget :: a widget = IO Menuitem -> m Menuitem forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Menuitem -> m Menuitem) -> IO Menuitem -> m Menuitem forall a b. (a -> b) -> a -> b $ do Ptr Widget widget' <- a -> IO (Ptr Widget) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a widget Ptr Menuitem result <- Ptr Widget -> IO (Ptr Menuitem) dbusmenu_gtk_parse_get_cached_item Ptr Widget widget' Text -> Ptr Menuitem -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "gtkParseGetCachedItem" Ptr Menuitem result Menuitem result' <- ((ManagedPtr Menuitem -> Menuitem) -> Ptr Menuitem -> IO Menuitem forall a b. (HasCallStack, GObject a, GObject b) => (ManagedPtr a -> a) -> Ptr b -> IO a newObject ManagedPtr Menuitem -> Menuitem Dbusmenu.Menuitem.Menuitem) Ptr Menuitem result a -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr a widget Menuitem -> IO Menuitem forall (m :: * -> *) a. Monad m => a -> m a return Menuitem result'