{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) 'GI.Gio.Objects.ListStore.ListStore' is a simple implementation of 'GI.Gio.Interfaces.ListModel.ListModel' that stores all items in memory. It provides insertions, deletions, and lookups in logarithmic time with a fast path for the common case of iterating the list linearly. -} module GI.Gio.Objects.ListStore ( -- * Exported types ListStore(..) , IsListStore , toListStore , noListStore , -- * Methods -- ** append #method:append# ListStoreAppendMethodInfo , listStoreAppend , -- ** insert #method:insert# ListStoreInsertMethodInfo , listStoreInsert , -- ** insertSorted #method:insertSorted# ListStoreInsertSortedMethodInfo , listStoreInsertSorted , -- ** new #method:new# listStoreNew , -- ** remove #method:remove# ListStoreRemoveMethodInfo , listStoreRemove , -- ** removeAll #method:removeAll# ListStoreRemoveAllMethodInfo , listStoreRemoveAll , -- ** sort #method:sort# ListStoreSortMethodInfo , listStoreSort , -- ** splice #method:splice# ListStoreSpliceMethodInfo , listStoreSplice , -- * Properties -- ** itemType #attr:itemType# ListStoreItemTypePropertyInfo , constructListStoreItemType , getListStoreItemType , listStoreItemType , ) 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.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack 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 GI.GLib.Callbacks as GLib.Callbacks import qualified GI.GObject.Objects.Object as GObject.Object import {-# SOURCE #-} qualified GI.Gio.Interfaces.ListModel as Gio.ListModel newtype ListStore = ListStore (ManagedPtr ListStore) foreign import ccall "g_list_store_get_type" c_g_list_store_get_type :: IO GType instance GObject ListStore where gobjectType _ = c_g_list_store_get_type class GObject o => IsListStore o #if MIN_VERSION_base(4,9,0) instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError ListStore a) => IsListStore a #endif instance IsListStore ListStore instance GObject.Object.IsObject ListStore instance Gio.ListModel.IsListModel ListStore toListStore :: IsListStore o => o -> IO ListStore toListStore = unsafeCastTo ListStore noListStore :: Maybe ListStore noListStore = Nothing type family ResolveListStoreMethod (t :: Symbol) (o :: *) :: * where ResolveListStoreMethod "append" o = ListStoreAppendMethodInfo ResolveListStoreMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveListStoreMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveListStoreMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveListStoreMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveListStoreMethod "insert" o = ListStoreInsertMethodInfo ResolveListStoreMethod "insertSorted" o = ListStoreInsertSortedMethodInfo ResolveListStoreMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveListStoreMethod "itemsChanged" o = Gio.ListModel.ListModelItemsChangedMethodInfo ResolveListStoreMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveListStoreMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveListStoreMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveListStoreMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveListStoreMethod "remove" o = ListStoreRemoveMethodInfo ResolveListStoreMethod "removeAll" o = ListStoreRemoveAllMethodInfo ResolveListStoreMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo ResolveListStoreMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo ResolveListStoreMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveListStoreMethod "sort" o = ListStoreSortMethodInfo ResolveListStoreMethod "splice" o = ListStoreSpliceMethodInfo ResolveListStoreMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveListStoreMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveListStoreMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveListStoreMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveListStoreMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveListStoreMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveListStoreMethod "getItem" o = Gio.ListModel.ListModelGetItemMethodInfo ResolveListStoreMethod "getItemType" o = Gio.ListModel.ListModelGetItemTypeMethodInfo ResolveListStoreMethod "getNItems" o = Gio.ListModel.ListModelGetNItemsMethodInfo ResolveListStoreMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveListStoreMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveListStoreMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveListStoreMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveListStoreMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveListStoreMethod t ListStore, O.MethodInfo info ListStore p) => O.IsLabelProxy t (ListStore -> p) where fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveListStoreMethod t ListStore, O.MethodInfo info ListStore p) => O.IsLabel t (ListStore -> p) where fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif -- VVV Prop "item-type" -- Type: TBasicType TGType -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Nothing,Nothing) getListStoreItemType :: (MonadIO m, IsListStore o) => o -> m GType getListStoreItemType obj = liftIO $ getObjectPropertyGType obj "item-type" constructListStoreItemType :: (IsListStore o) => GType -> IO (GValueConstruct o) constructListStoreItemType val = constructObjectPropertyGType "item-type" val data ListStoreItemTypePropertyInfo instance AttrInfo ListStoreItemTypePropertyInfo where type AttrAllowedOps ListStoreItemTypePropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ListStoreItemTypePropertyInfo = (~) GType type AttrBaseTypeConstraint ListStoreItemTypePropertyInfo = IsListStore type AttrGetType ListStoreItemTypePropertyInfo = GType type AttrLabel ListStoreItemTypePropertyInfo = "item-type" type AttrOrigin ListStoreItemTypePropertyInfo = ListStore attrGet _ = getListStoreItemType attrSet _ = undefined attrConstruct _ = constructListStoreItemType attrClear _ = undefined instance O.HasAttributeList ListStore type instance O.AttributeList ListStore = ListStoreAttributeList type ListStoreAttributeList = ('[ '("itemType", ListStoreItemTypePropertyInfo)] :: [(Symbol, *)]) listStoreItemType :: AttrLabelProxy "itemType" listStoreItemType = AttrLabelProxy type instance O.SignalList ListStore = ListStoreSignalList type ListStoreSignalList = ('[ '("itemsChanged", Gio.ListModel.ListModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method ListStore::new -- method type : Constructor -- Args : [Arg {argCName = "item_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of items in the list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gio", name = "ListStore"})) -- throws : False -- Skip return : False foreign import ccall "g_list_store_new" g_list_store_new :: CGType -> -- item_type : TBasicType TGType IO (Ptr ListStore) {- | Creates a new 'GI.Gio.Objects.ListStore.ListStore' with items of type /@itemType@/. /@itemType@/ must be a subclass of 'GI.GObject.Objects.Object.Object'. @since 2.44 -} listStoreNew :: (B.CallStack.HasCallStack, MonadIO m) => GType {- ^ /@itemType@/: the 'GType' of items in the list -} -> m ListStore {- ^ __Returns:__ a new 'GI.Gio.Objects.ListStore.ListStore' -} listStoreNew itemType = liftIO $ do let itemType' = gtypeToCGType itemType result <- g_list_store_new itemType' checkUnexpectedReturnNULL "listStoreNew" result result' <- (wrapObject ListStore) result return result' -- method ListStore::append -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new item", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "g_list_store_append" g_list_store_append :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) Ptr GObject.Object.Object -> -- item : TInterface (Name {namespace = "GObject", name = "Object"}) IO () {- | Appends /@item@/ to /@store@/. /@item@/ must be of type 'GI.Gio.Objects.ListStore.ListStore':@/item-type/@. This function takes a ref on /@item@/. Use 'GI.Gio.Objects.ListStore.listStoreSplice' to append multiple items at the same time efficiently. @since 2.44 -} listStoreAppend :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a, GObject.Object.IsObject b) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> b {- ^ /@item@/: the new item -} -> m () listStoreAppend store item = liftIO $ do store' <- unsafeManagedPtrCastPtr store item' <- unsafeManagedPtrCastPtr item g_list_store_append store' item' touchManagedPtr store touchManagedPtr item return () data ListStoreAppendMethodInfo instance (signature ~ (b -> m ()), MonadIO m, IsListStore a, GObject.Object.IsObject b) => O.MethodInfo ListStoreAppendMethodInfo a signature where overloadedMethod _ = listStoreAppend -- method ListStore::insert -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position at which to insert the new item", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new item", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "g_list_store_insert" g_list_store_insert :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) Word32 -> -- position : TBasicType TUInt Ptr GObject.Object.Object -> -- item : TInterface (Name {namespace = "GObject", name = "Object"}) IO () {- | Inserts /@item@/ into /@store@/ at /@position@/. /@item@/ must be of type 'GI.Gio.Objects.ListStore.ListStore':@/item-type/@ or derived from it. /@position@/ must be smaller than the length of the list, or equal to it to append. This function takes a ref on /@item@/. Use 'GI.Gio.Objects.ListStore.listStoreSplice' to insert multiple items at the same time efficiently. @since 2.44 -} listStoreInsert :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a, GObject.Object.IsObject b) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> Word32 {- ^ /@position@/: the position at which to insert the new item -} -> b {- ^ /@item@/: the new item -} -> m () listStoreInsert store position item = liftIO $ do store' <- unsafeManagedPtrCastPtr store item' <- unsafeManagedPtrCastPtr item g_list_store_insert store' position item' touchManagedPtr store touchManagedPtr item return () data ListStoreInsertMethodInfo instance (signature ~ (Word32 -> b -> m ()), MonadIO m, IsListStore a, GObject.Object.IsObject b) => O.MethodInfo ListStoreInsertMethodInfo a signature where overloadedMethod _ = listStoreInsert -- method ListStore::insert_sorted -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new item", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compare_func", argType = TInterface (Name {namespace = "GLib", name = "CompareDataFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pairwise comparison function for sorting", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data for @compare_func", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_list_store_insert_sorted" g_list_store_insert_sorted :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) Ptr GObject.Object.Object -> -- item : TInterface (Name {namespace = "GObject", name = "Object"}) FunPtr GLib.Callbacks.C_CompareDataFunc -> -- compare_func : TInterface (Name {namespace = "GLib", name = "CompareDataFunc"}) Ptr () -> -- user_data : TBasicType TPtr IO Word32 {- | Inserts /@item@/ into /@store@/ at a position to be determined by the /@compareFunc@/. The list must already be sorted before calling this function or the result is undefined. Usually you would approach this by only ever inserting items by way of this function. This function takes a ref on /@item@/. @since 2.44 -} listStoreInsertSorted :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a, GObject.Object.IsObject b) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> b {- ^ /@item@/: the new item -} -> GLib.Callbacks.CompareDataFunc {- ^ /@compareFunc@/: pairwise comparison function for sorting -} -> m Word32 {- ^ __Returns:__ the position at which /@item@/ was inserted -} listStoreInsertSorted store item compareFunc = liftIO $ do store' <- unsafeManagedPtrCastPtr store item' <- unsafeManagedPtrCastPtr item compareFunc' <- GLib.Callbacks.mk_CompareDataFunc (GLib.Callbacks.wrap_CompareDataFunc Nothing (GLib.Callbacks.drop_closures_CompareDataFunc compareFunc)) let userData = nullPtr result <- g_list_store_insert_sorted store' item' compareFunc' userData safeFreeFunPtr $ castFunPtrToPtr compareFunc' touchManagedPtr store touchManagedPtr item return result data ListStoreInsertSortedMethodInfo instance (signature ~ (b -> GLib.Callbacks.CompareDataFunc -> m Word32), MonadIO m, IsListStore a, GObject.Object.IsObject b) => O.MethodInfo ListStoreInsertSortedMethodInfo a signature where overloadedMethod _ = listStoreInsertSorted -- method ListStore::remove -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position of the item that is to be removed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "g_list_store_remove" g_list_store_remove :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) Word32 -> -- position : TBasicType TUInt IO () {- | Removes the item from /@store@/ that is at /@position@/. /@position@/ must be smaller than the current length of the list. Use 'GI.Gio.Objects.ListStore.listStoreSplice' to remove multiple items at the same time efficiently. @since 2.44 -} listStoreRemove :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> Word32 {- ^ /@position@/: the position of the item that is to be removed -} -> m () listStoreRemove store position = liftIO $ do store' <- unsafeManagedPtrCastPtr store g_list_store_remove store' position touchManagedPtr store return () data ListStoreRemoveMethodInfo instance (signature ~ (Word32 -> m ()), MonadIO m, IsListStore a) => O.MethodInfo ListStoreRemoveMethodInfo a signature where overloadedMethod _ = listStoreRemove -- method ListStore::remove_all -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "g_list_store_remove_all" g_list_store_remove_all :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) IO () {- | Removes all items from /@store@/. @since 2.44 -} listStoreRemoveAll :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> m () listStoreRemoveAll store = liftIO $ do store' <- unsafeManagedPtrCastPtr store g_list_store_remove_all store' touchManagedPtr store return () data ListStoreRemoveAllMethodInfo instance (signature ~ (m ()), MonadIO m, IsListStore a) => O.MethodInfo ListStoreRemoveAllMethodInfo a signature where overloadedMethod _ = listStoreRemoveAll -- method ListStore::sort -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compare_func", argType = TInterface (Name {namespace = "GLib", name = "CompareDataFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pairwise comparison function for sorting", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data for @compare_func", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "g_list_store_sort" g_list_store_sort :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) FunPtr GLib.Callbacks.C_CompareDataFunc -> -- compare_func : TInterface (Name {namespace = "GLib", name = "CompareDataFunc"}) Ptr () -> -- user_data : TBasicType TPtr IO () {- | Sort the items in /@store@/ according to /@compareFunc@/. @since 2.46 -} listStoreSort :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> GLib.Callbacks.CompareDataFunc {- ^ /@compareFunc@/: pairwise comparison function for sorting -} -> m () listStoreSort store compareFunc = liftIO $ do store' <- unsafeManagedPtrCastPtr store compareFunc' <- GLib.Callbacks.mk_CompareDataFunc (GLib.Callbacks.wrap_CompareDataFunc Nothing (GLib.Callbacks.drop_closures_CompareDataFunc compareFunc)) let userData = nullPtr g_list_store_sort store' compareFunc' userData safeFreeFunPtr $ castFunPtrToPtr compareFunc' touchManagedPtr store return () data ListStoreSortMethodInfo instance (signature ~ (GLib.Callbacks.CompareDataFunc -> m ()), MonadIO m, IsListStore a) => O.MethodInfo ListStoreSortMethodInfo a signature where overloadedMethod _ = listStoreSort -- method ListStore::splice -- method type : OrdinaryMethod -- Args : [Arg {argCName = "store", argType = TInterface (Name {namespace = "Gio", name = "ListStore"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GListStore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position at which to make the change", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_removals", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of items to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "additions", argType = TCArray False (-1) 4 (TInterface (Name {namespace = "GObject", name = "Object"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the items to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_additions", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of items to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [Arg {argCName = "n_additions", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of items to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "g_list_store_splice" g_list_store_splice :: Ptr ListStore -> -- store : TInterface (Name {namespace = "Gio", name = "ListStore"}) Word32 -> -- position : TBasicType TUInt Word32 -> -- n_removals : TBasicType TUInt Ptr (Ptr GObject.Object.Object) -> -- additions : TCArray False (-1) 4 (TInterface (Name {namespace = "GObject", name = "Object"})) Word32 -> -- n_additions : TBasicType TUInt IO () {- | Changes /@store@/ by removing /@nRemovals@/ items and adding /@nAdditions@/ items to it. /@additions@/ must contain /@nAdditions@/ items of type 'GI.Gio.Objects.ListStore.ListStore':@/item-type/@. 'Nothing' is not permitted. This function is more efficient than 'GI.Gio.Objects.ListStore.listStoreInsert' and 'GI.Gio.Objects.ListStore.listStoreRemove', because it only emits 'GI.Gio.Interfaces.ListModel.ListModel'::@/items-changed/@ once for the change. This function takes a ref on each item in /@additions@/. The parameters /@position@/ and /@nRemovals@/ must be correct (ie: /@position@/ + /@nRemovals@/ must be less than or equal to the length of the list at the time this function is called). @since 2.44 -} listStoreSplice :: (B.CallStack.HasCallStack, MonadIO m, IsListStore a) => a {- ^ /@store@/: a 'GI.Gio.Objects.ListStore.ListStore' -} -> Word32 {- ^ /@position@/: the position at which to make the change -} -> Word32 {- ^ /@nRemovals@/: the number of items to remove -} -> [GObject.Object.Object] {- ^ /@additions@/: the items to add -} -> m () listStoreSplice store position nRemovals additions = liftIO $ do let nAdditions = fromIntegral $ length additions store' <- unsafeManagedPtrCastPtr store additions' <- mapM unsafeManagedPtrCastPtr additions additions'' <- packPtrArray additions' g_list_store_splice store' position nRemovals additions'' nAdditions touchManagedPtr store mapM_ touchManagedPtr additions freeMem additions'' return () data ListStoreSpliceMethodInfo instance (signature ~ (Word32 -> Word32 -> [GObject.Object.Object] -> m ()), MonadIO m, IsListStore a) => O.MethodInfo ListStoreSpliceMethodInfo a signature where overloadedMethod _ = listStoreSplice