{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.MenuItem
(
MenuItem(..) ,
IsMenuItem ,
toMenuItem ,
#if defined(ENABLE_OVERLOADING)
ResolveMenuItemMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
MenuItemGetAttributeValueMethodInfo ,
#endif
menuItemGetAttributeValue ,
#if defined(ENABLE_OVERLOADING)
MenuItemGetLinkMethodInfo ,
#endif
menuItemGetLink ,
menuItemNew ,
menuItemNewFromModel ,
menuItemNewSection ,
menuItemNewSubmenu ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetActionAndTargetValueMethodInfo,
#endif
menuItemSetActionAndTargetValue ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetAttributeValueMethodInfo ,
#endif
menuItemSetAttributeValue ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetDetailedActionMethodInfo ,
#endif
menuItemSetDetailedAction ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetIconMethodInfo ,
#endif
menuItemSetIcon ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetLabelMethodInfo ,
#endif
menuItemSetLabel ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetLinkMethodInfo ,
#endif
menuItemSetLink ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetSectionMethodInfo ,
#endif
menuItemSetSection ,
#if defined(ENABLE_OVERLOADING)
MenuItemSetSubmenuMethodInfo ,
#endif
menuItemSetSubmenu ,
) 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.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 Control.Monad.IO.Class as MIO
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.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuModel as Gio.MenuModel
newtype = (SP.ManagedPtr MenuItem)
deriving (MenuItem -> MenuItem -> Bool
(MenuItem -> MenuItem -> Bool)
-> (MenuItem -> MenuItem -> Bool) -> Eq MenuItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MenuItem -> MenuItem -> Bool
$c/= :: MenuItem -> MenuItem -> Bool
== :: MenuItem -> MenuItem -> Bool
$c== :: MenuItem -> MenuItem -> Bool
Eq)
instance SP.ManagedPtrNewtype MenuItem where
toManagedPtr :: MenuItem -> ManagedPtr MenuItem
toManagedPtr (MenuItem ManagedPtr MenuItem
p) = ManagedPtr MenuItem
p
foreign import ccall "g_menu_item_get_type"
:: IO B.Types.GType
instance B.Types.TypedObject MenuItem where
glibType :: IO GType
glibType = IO GType
c_g_menu_item_get_type
instance B.Types.GObject MenuItem
instance B.GValue.IsGValue MenuItem where
toGValue :: MenuItem -> IO GValue
toGValue MenuItem
o = do
GType
gtype <- IO GType
c_g_menu_item_get_type
MenuItem -> (Ptr MenuItem -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr MenuItem
o (GType
-> (GValue -> Ptr MenuItem -> IO ()) -> Ptr MenuItem -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr MenuItem -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO MenuItem
fromGValue GValue
gv = do
Ptr MenuItem
ptr <- GValue -> IO (Ptr MenuItem)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr MenuItem)
(ManagedPtr MenuItem -> MenuItem) -> Ptr MenuItem -> IO MenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr MenuItem -> MenuItem
MenuItem Ptr MenuItem
ptr
class (SP.GObject o, O.IsDescendantOf MenuItem o) => o
instance (SP.GObject o, O.IsDescendantOf MenuItem o) => IsMenuItem o
instance O.HasParentTypes MenuItem
type instance O.ParentTypes MenuItem = '[GObject.Object.Object]
toMenuItem :: (MonadIO m, IsMenuItem o) => o -> m MenuItem
= IO MenuItem -> m MenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MenuItem -> m MenuItem)
-> (o -> IO MenuItem) -> o -> m MenuItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr MenuItem -> MenuItem) -> o -> IO MenuItem
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr MenuItem -> MenuItem
MenuItem
#if defined(ENABLE_OVERLOADING)
type family ResolveMenuItemMethod (t :: Symbol) (o :: *) :: * where
ResolveMenuItemMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMenuItemMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMenuItemMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMenuItemMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMenuItemMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMenuItemMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMenuItemMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMenuItemMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMenuItemMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMenuItemMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMenuItemMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMenuItemMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMenuItemMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMenuItemMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMenuItemMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMenuItemMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMenuItemMethod "getAttributeValue" o = MenuItemGetAttributeValueMethodInfo
ResolveMenuItemMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMenuItemMethod "getLink" o = MenuItemGetLinkMethodInfo
ResolveMenuItemMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMenuItemMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMenuItemMethod "setActionAndTargetValue" o = MenuItemSetActionAndTargetValueMethodInfo
ResolveMenuItemMethod "setAttributeValue" o = MenuItemSetAttributeValueMethodInfo
ResolveMenuItemMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMenuItemMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveMenuItemMethod "setDetailedAction" o = MenuItemSetDetailedActionMethodInfo
ResolveMenuItemMethod "setIcon" o = MenuItemSetIconMethodInfo
ResolveMenuItemMethod "setLabel" o = MenuItemSetLabelMethodInfo
ResolveMenuItemMethod "setLink" o = MenuItemSetLinkMethodInfo
ResolveMenuItemMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMenuItemMethod "setSection" o = MenuItemSetSectionMethodInfo
ResolveMenuItemMethod "setSubmenu" o = MenuItemSetSubmenuMethodInfo
ResolveMenuItemMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMenuItemMethod t MenuItem, O.MethodInfo info MenuItem p) => OL.IsLabel t (MenuItem -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList MenuItem
type instance O.AttributeList MenuItem = MenuItemAttributeList
type MenuItemAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList MenuItem = MenuItemSignalList
type MenuItemSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_menu_item_new" ::
CString ->
CString ->
IO (Ptr MenuItem)
menuItemNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> Maybe (T.Text)
-> m MenuItem
Maybe Text
label Maybe Text
detailedAction = 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 CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr CChar
maybeDetailedAction <- case Maybe Text
detailedAction of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jDetailedAction -> do
Ptr CChar
jDetailedAction' <- Text -> IO (Ptr CChar)
textToCString Text
jDetailedAction
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jDetailedAction'
Ptr MenuItem
result <- Ptr CChar -> Ptr CChar -> IO (Ptr MenuItem)
g_menu_item_new Ptr CChar
maybeLabel Ptr CChar
maybeDetailedAction
Text -> Ptr MenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuItemNew" 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
MenuItem) Ptr MenuItem
result
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeDetailedAction
MenuItem -> IO MenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return MenuItem
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_menu_item_new_from_model" ::
Ptr Gio.MenuModel.MenuModel ->
Int32 ->
IO (Ptr MenuItem)
menuItemNewFromModel ::
(B.CallStack.HasCallStack, MonadIO m, Gio.MenuModel.IsMenuModel a) =>
a
-> Int32
-> m MenuItem
a
model Int32
itemIndex = 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 MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
Ptr MenuItem
result <- Ptr MenuModel -> Int32 -> IO (Ptr MenuItem)
g_menu_item_new_from_model Ptr MenuModel
model' Int32
itemIndex
Text -> Ptr MenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuItemNewFromModel" 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
MenuItem) Ptr MenuItem
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
MenuItem -> IO MenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return MenuItem
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_menu_item_new_section" ::
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO (Ptr MenuItem)
menuItemNewSection ::
(B.CallStack.HasCallStack, MonadIO m, Gio.MenuModel.IsMenuModel a) =>
Maybe (T.Text)
-> a
-> m MenuItem
Maybe Text
label a
section = 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 CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
section' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
section
Ptr MenuItem
result <- Ptr CChar -> Ptr MenuModel -> IO (Ptr MenuItem)
g_menu_item_new_section Ptr CChar
maybeLabel Ptr MenuModel
section'
Text -> Ptr MenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuItemNewSection" 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
MenuItem) Ptr MenuItem
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
section
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
MenuItem -> IO MenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return MenuItem
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_menu_item_new_submenu" ::
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO (Ptr MenuItem)
menuItemNewSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, Gio.MenuModel.IsMenuModel a) =>
Maybe (T.Text)
-> a
-> m MenuItem
Maybe Text
label a
submenu = 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 CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
submenu' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
submenu
Ptr MenuItem
result <- Ptr CChar -> Ptr MenuModel -> IO (Ptr MenuItem)
g_menu_item_new_submenu Ptr CChar
maybeLabel Ptr MenuModel
submenu'
Text -> Ptr MenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuItemNewSubmenu" 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
MenuItem) Ptr MenuItem
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
submenu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
MenuItem -> IO MenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return MenuItem
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_menu_item_get_attribute_value" ::
Ptr MenuItem ->
CString ->
Ptr GLib.VariantType.VariantType ->
IO (Ptr GVariant)
menuItemGetAttributeValue ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a) =>
a
-> T.Text
-> Maybe (GLib.VariantType.VariantType)
-> m GVariant
a
menuItem Text
attribute Maybe VariantType
expectedType = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
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 CChar
attribute' <- Text -> IO (Ptr CChar)
textToCString Text
attribute
Ptr VariantType
maybeExpectedType <- case Maybe VariantType
expectedType of
Maybe VariantType
Nothing -> Ptr VariantType -> IO (Ptr VariantType)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr VariantType
forall a. Ptr a
nullPtr
Just VariantType
jExpectedType -> do
Ptr VariantType
jExpectedType' <- VariantType -> IO (Ptr VariantType)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantType
jExpectedType
Ptr VariantType -> IO (Ptr VariantType)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr VariantType
jExpectedType'
Ptr GVariant
result <- Ptr MenuItem -> Ptr CChar -> Ptr VariantType -> IO (Ptr GVariant)
g_menu_item_get_attribute_value Ptr MenuItem
menuItem' Ptr CChar
attribute' Ptr VariantType
maybeExpectedType
Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuItemGetAttributeValue" Ptr GVariant
result
GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Maybe VariantType -> (VariantType -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe VariantType
expectedType VariantType -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
attribute'
GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'
#if defined(ENABLE_OVERLOADING)
data MenuItemGetAttributeValueMethodInfo
instance (signature ~ (T.Text -> Maybe (GLib.VariantType.VariantType) -> m GVariant), MonadIO m, IsMenuItem a) => O.MethodInfo MenuItemGetAttributeValueMethodInfo a signature where
overloadedMethod = menuItemGetAttributeValue
#endif
foreign import ccall "g_menu_item_get_link" ::
Ptr MenuItem ->
CString ->
IO (Ptr Gio.MenuModel.MenuModel)
menuItemGetLink ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a) =>
a
-> T.Text
-> m Gio.MenuModel.MenuModel
a
menuItem Text
link = IO MenuModel -> m MenuModel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MenuModel -> m MenuModel) -> IO MenuModel -> m MenuModel
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 CChar
link' <- Text -> IO (Ptr CChar)
textToCString Text
link
Ptr MenuModel
result <- Ptr MenuItem -> Ptr CChar -> IO (Ptr MenuModel)
g_menu_item_get_link Ptr MenuItem
menuItem' Ptr CChar
link'
Text -> Ptr MenuModel -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuItemGetLink" Ptr MenuModel
result
MenuModel
result' <- ((ManagedPtr MenuModel -> MenuModel)
-> Ptr MenuModel -> IO MenuModel
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr MenuModel -> MenuModel
Gio.MenuModel.MenuModel) Ptr MenuModel
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
link'
MenuModel -> IO MenuModel
forall (m :: * -> *) a. Monad m => a -> m a
return MenuModel
result'
#if defined(ENABLE_OVERLOADING)
data MenuItemGetLinkMethodInfo
instance (signature ~ (T.Text -> m Gio.MenuModel.MenuModel), MonadIO m, IsMenuItem a) => O.MethodInfo MenuItemGetLinkMethodInfo a signature where
overloadedMethod = menuItemGetLink
#endif
foreign import ccall "g_menu_item_set_action_and_target_value" g_menu_item_set_action_and_target_value ::
Ptr MenuItem ->
CString ->
Ptr GVariant ->
IO ()
menuItemSetActionAndTargetValue ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a) =>
a
-> Maybe (T.Text)
-> Maybe (GVariant)
-> m ()
menuItemSetActionAndTargetValue :: a -> Maybe Text -> Maybe GVariant -> m ()
menuItemSetActionAndTargetValue a
menuItem Maybe Text
action Maybe GVariant
targetValue = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 CChar
maybeAction <- case Maybe Text
action of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jAction -> do
Ptr CChar
jAction' <- Text -> IO (Ptr CChar)
textToCString Text
jAction
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jAction'
Ptr GVariant
maybeTargetValue <- case Maybe GVariant
targetValue of
Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
Just GVariant
jTargetValue -> do
Ptr GVariant
jTargetValue' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jTargetValue
Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jTargetValue'
Ptr MenuItem -> Ptr CChar -> Ptr GVariant -> IO ()
g_menu_item_set_action_and_target_value Ptr MenuItem
menuItem' Ptr CChar
maybeAction Ptr GVariant
maybeTargetValue
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
targetValue GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeAction
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetActionAndTargetValueMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (GVariant) -> m ()), MonadIO m, IsMenuItem a) => O.MethodInfo MenuItemSetActionAndTargetValueMethodInfo a signature where
overloadedMethod = menuItemSetActionAndTargetValue
#endif
foreign import ccall "g_menu_item_set_attribute_value" ::
Ptr MenuItem ->
CString ->
Ptr GVariant ->
IO ()
menuItemSetAttributeValue ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a) =>
a
-> T.Text
-> Maybe (GVariant)
-> m ()
a
menuItem Text
attribute Maybe GVariant
value = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 CChar
attribute' <- Text -> IO (Ptr CChar)
textToCString Text
attribute
Ptr GVariant
maybeValue <- case Maybe GVariant
value of
Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
Just GVariant
jValue -> do
Ptr GVariant
jValue' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jValue
Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jValue'
Ptr MenuItem -> Ptr CChar -> Ptr GVariant -> IO ()
g_menu_item_set_attribute_value Ptr MenuItem
menuItem' Ptr CChar
attribute' Ptr GVariant
maybeValue
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
value GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
attribute'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetAttributeValueMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> m ()), MonadIO m, IsMenuItem a) => O.MethodInfo MenuItemSetAttributeValueMethodInfo a signature where
overloadedMethod = menuItemSetAttributeValue
#endif
foreign import ccall "g_menu_item_set_detailed_action" ::
Ptr MenuItem ->
CString ->
IO ()
menuItemSetDetailedAction ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a) =>
a
-> T.Text
-> m ()
a
menuItem Text
detailedAction = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 CChar
detailedAction' <- Text -> IO (Ptr CChar)
textToCString Text
detailedAction
Ptr MenuItem -> Ptr CChar -> IO ()
g_menu_item_set_detailed_action Ptr MenuItem
menuItem' Ptr CChar
detailedAction'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
detailedAction'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetDetailedActionMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsMenuItem a) => O.MethodInfo MenuItemSetDetailedActionMethodInfo a signature where
overloadedMethod = menuItemSetDetailedAction
#endif
foreign import ccall "g_menu_item_set_icon" ::
Ptr MenuItem ->
Ptr Gio.Icon.Icon ->
IO ()
menuItemSetIcon ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a, Gio.Icon.IsIcon b) =>
a
-> b
-> m ()
a
menuItem b
icon = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 Icon
icon' <- b -> IO (Ptr Icon)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
icon
Ptr MenuItem -> Ptr Icon -> IO ()
g_menu_item_set_icon Ptr MenuItem
menuItem' Ptr Icon
icon'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
icon
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetIconMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMenuItem a, Gio.Icon.IsIcon b) => O.MethodInfo MenuItemSetIconMethodInfo a signature where
overloadedMethod = menuItemSetIcon
#endif
foreign import ccall "g_menu_item_set_label" ::
Ptr MenuItem ->
CString ->
IO ()
menuItemSetLabel ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a) =>
a
-> Maybe (T.Text)
-> m ()
a
menuItem Maybe Text
label = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuItem -> Ptr CChar -> IO ()
g_menu_item_set_label Ptr MenuItem
menuItem' Ptr CChar
maybeLabel
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetLabelMethodInfo
instance (signature ~ (Maybe (T.Text) -> m ()), MonadIO m, IsMenuItem a) => O.MethodInfo MenuItemSetLabelMethodInfo a signature where
overloadedMethod = menuItemSetLabel
#endif
foreign import ccall "g_menu_item_set_link" ::
Ptr MenuItem ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuItemSetLink ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a, Gio.MenuModel.IsMenuModel b) =>
a
-> T.Text
-> Maybe (b)
-> m ()
a
menuItem Text
link Maybe b
model = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 CChar
link' <- Text -> IO (Ptr CChar)
textToCString Text
link
Ptr MenuModel
maybeModel <- case Maybe b
model of
Maybe b
Nothing -> Ptr MenuModel -> IO (Ptr MenuModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MenuModel
forall a. Ptr a
nullPtr
Just b
jModel -> do
Ptr MenuModel
jModel' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jModel
Ptr MenuModel -> IO (Ptr MenuModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MenuModel
jModel'
Ptr MenuItem -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_item_set_link Ptr MenuItem
menuItem' Ptr CChar
link' Ptr MenuModel
maybeModel
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
model b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
link'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetLinkMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m ()), MonadIO m, IsMenuItem a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuItemSetLinkMethodInfo a signature where
overloadedMethod = menuItemSetLink
#endif
foreign import ccall "g_menu_item_set_section" ::
Ptr MenuItem ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuItemSetSection ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a, Gio.MenuModel.IsMenuModel b) =>
a
-> Maybe (b)
-> m ()
a
menuItem Maybe b
section = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 MenuModel
maybeSection <- case Maybe b
section of
Maybe b
Nothing -> Ptr MenuModel -> IO (Ptr MenuModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MenuModel
forall a. Ptr a
nullPtr
Just b
jSection -> do
Ptr MenuModel
jSection' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSection
Ptr MenuModel -> IO (Ptr MenuModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MenuModel
jSection'
Ptr MenuItem -> Ptr MenuModel -> IO ()
g_menu_item_set_section Ptr MenuItem
menuItem' Ptr MenuModel
maybeSection
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
section b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetSectionMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsMenuItem a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuItemSetSectionMethodInfo a signature where
overloadedMethod = menuItemSetSection
#endif
foreign import ccall "g_menu_item_set_submenu" ::
Ptr MenuItem ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuItemSetSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsMenuItem a, Gio.MenuModel.IsMenuModel b) =>
a
-> Maybe (b)
-> m ()
a
menuItem Maybe b
submenu = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
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 MenuModel
maybeSubmenu <- case Maybe b
submenu of
Maybe b
Nothing -> Ptr MenuModel -> IO (Ptr MenuModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MenuModel
forall a. Ptr a
nullPtr
Just b
jSubmenu -> do
Ptr MenuModel
jSubmenu' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSubmenu
Ptr MenuModel -> IO (Ptr MenuModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MenuModel
jSubmenu'
Ptr MenuItem -> Ptr MenuModel -> IO ()
g_menu_item_set_submenu Ptr MenuItem
menuItem' Ptr MenuModel
maybeSubmenu
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menuItem
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
submenu b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuItemSetSubmenuMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsMenuItem a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuItemSetSubmenuMethodInfo a signature where
overloadedMethod = menuItemSetSubmenu
#endif