{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

The @GBookmarkFile@ structure contains only
private data and should not be directly accessed.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GLib.Structs.BookmarkFile
    (

-- * Exported types
    BookmarkFile(..)                        ,
    noBookmarkFile                          ,


 -- * Methods
-- ** addApplication #method:addApplication#

#if ENABLE_OVERLOADING
    BookmarkFileAddApplicationMethodInfo    ,
#endif
    bookmarkFileAddApplication              ,


-- ** addGroup #method:addGroup#

#if ENABLE_OVERLOADING
    BookmarkFileAddGroupMethodInfo          ,
#endif
    bookmarkFileAddGroup                    ,


-- ** errorQuark #method:errorQuark#

    bookmarkFileErrorQuark                  ,


-- ** free #method:free#

#if ENABLE_OVERLOADING
    BookmarkFileFreeMethodInfo              ,
#endif
    bookmarkFileFree                        ,


-- ** getAdded #method:getAdded#

#if ENABLE_OVERLOADING
    BookmarkFileGetAddedMethodInfo          ,
#endif
    bookmarkFileGetAdded                    ,


-- ** getAppInfo #method:getAppInfo#

#if ENABLE_OVERLOADING
    BookmarkFileGetAppInfoMethodInfo        ,
#endif
    bookmarkFileGetAppInfo                  ,


-- ** getApplications #method:getApplications#

#if ENABLE_OVERLOADING
    BookmarkFileGetApplicationsMethodInfo   ,
#endif
    bookmarkFileGetApplications             ,


-- ** getDescription #method:getDescription#

#if ENABLE_OVERLOADING
    BookmarkFileGetDescriptionMethodInfo    ,
#endif
    bookmarkFileGetDescription              ,


-- ** getGroups #method:getGroups#

#if ENABLE_OVERLOADING
    BookmarkFileGetGroupsMethodInfo         ,
#endif
    bookmarkFileGetGroups                   ,


-- ** getIcon #method:getIcon#

#if ENABLE_OVERLOADING
    BookmarkFileGetIconMethodInfo           ,
#endif
    bookmarkFileGetIcon                     ,


-- ** getIsPrivate #method:getIsPrivate#

#if ENABLE_OVERLOADING
    BookmarkFileGetIsPrivateMethodInfo      ,
#endif
    bookmarkFileGetIsPrivate                ,


-- ** getMimeType #method:getMimeType#

#if ENABLE_OVERLOADING
    BookmarkFileGetMimeTypeMethodInfo       ,
#endif
    bookmarkFileGetMimeType                 ,


-- ** getModified #method:getModified#

#if ENABLE_OVERLOADING
    BookmarkFileGetModifiedMethodInfo       ,
#endif
    bookmarkFileGetModified                 ,


-- ** getSize #method:getSize#

#if ENABLE_OVERLOADING
    BookmarkFileGetSizeMethodInfo           ,
#endif
    bookmarkFileGetSize                     ,


-- ** getTitle #method:getTitle#

#if ENABLE_OVERLOADING
    BookmarkFileGetTitleMethodInfo          ,
#endif
    bookmarkFileGetTitle                    ,


-- ** getUris #method:getUris#

#if ENABLE_OVERLOADING
    BookmarkFileGetUrisMethodInfo           ,
#endif
    bookmarkFileGetUris                     ,


-- ** getVisited #method:getVisited#

#if ENABLE_OVERLOADING
    BookmarkFileGetVisitedMethodInfo        ,
#endif
    bookmarkFileGetVisited                  ,


-- ** hasApplication #method:hasApplication#

#if ENABLE_OVERLOADING
    BookmarkFileHasApplicationMethodInfo    ,
#endif
    bookmarkFileHasApplication              ,


-- ** hasGroup #method:hasGroup#

#if ENABLE_OVERLOADING
    BookmarkFileHasGroupMethodInfo          ,
#endif
    bookmarkFileHasGroup                    ,


-- ** hasItem #method:hasItem#

#if ENABLE_OVERLOADING
    BookmarkFileHasItemMethodInfo           ,
#endif
    bookmarkFileHasItem                     ,


-- ** loadFromData #method:loadFromData#

#if ENABLE_OVERLOADING
    BookmarkFileLoadFromDataMethodInfo      ,
#endif
    bookmarkFileLoadFromData                ,


-- ** loadFromDataDirs #method:loadFromDataDirs#

#if ENABLE_OVERLOADING
    BookmarkFileLoadFromDataDirsMethodInfo  ,
#endif
    bookmarkFileLoadFromDataDirs            ,


-- ** loadFromFile #method:loadFromFile#

#if ENABLE_OVERLOADING
    BookmarkFileLoadFromFileMethodInfo      ,
#endif
    bookmarkFileLoadFromFile                ,


-- ** moveItem #method:moveItem#

#if ENABLE_OVERLOADING
    BookmarkFileMoveItemMethodInfo          ,
#endif
    bookmarkFileMoveItem                    ,


-- ** removeApplication #method:removeApplication#

#if ENABLE_OVERLOADING
    BookmarkFileRemoveApplicationMethodInfo ,
#endif
    bookmarkFileRemoveApplication           ,


-- ** removeGroup #method:removeGroup#

#if ENABLE_OVERLOADING
    BookmarkFileRemoveGroupMethodInfo       ,
#endif
    bookmarkFileRemoveGroup                 ,


-- ** removeItem #method:removeItem#

#if ENABLE_OVERLOADING
    BookmarkFileRemoveItemMethodInfo        ,
#endif
    bookmarkFileRemoveItem                  ,


-- ** setAdded #method:setAdded#

#if ENABLE_OVERLOADING
    BookmarkFileSetAddedMethodInfo          ,
#endif
    bookmarkFileSetAdded                    ,


-- ** setAppInfo #method:setAppInfo#

#if ENABLE_OVERLOADING
    BookmarkFileSetAppInfoMethodInfo        ,
#endif
    bookmarkFileSetAppInfo                  ,


-- ** setDescription #method:setDescription#

#if ENABLE_OVERLOADING
    BookmarkFileSetDescriptionMethodInfo    ,
#endif
    bookmarkFileSetDescription              ,


-- ** setGroups #method:setGroups#

#if ENABLE_OVERLOADING
    BookmarkFileSetGroupsMethodInfo         ,
#endif
    bookmarkFileSetGroups                   ,


-- ** setIcon #method:setIcon#

#if ENABLE_OVERLOADING
    BookmarkFileSetIconMethodInfo           ,
#endif
    bookmarkFileSetIcon                     ,


-- ** setIsPrivate #method:setIsPrivate#

#if ENABLE_OVERLOADING
    BookmarkFileSetIsPrivateMethodInfo      ,
#endif
    bookmarkFileSetIsPrivate                ,


-- ** setMimeType #method:setMimeType#

#if ENABLE_OVERLOADING
    BookmarkFileSetMimeTypeMethodInfo       ,
#endif
    bookmarkFileSetMimeType                 ,


-- ** setModified #method:setModified#

#if ENABLE_OVERLOADING
    BookmarkFileSetModifiedMethodInfo       ,
#endif
    bookmarkFileSetModified                 ,


-- ** setTitle #method:setTitle#

#if ENABLE_OVERLOADING
    BookmarkFileSetTitleMethodInfo          ,
#endif
    bookmarkFileSetTitle                    ,


-- ** setVisited #method:setVisited#

#if ENABLE_OVERLOADING
    BookmarkFileSetVisitedMethodInfo        ,
#endif
    bookmarkFileSetVisited                  ,


-- ** toData #method:toData#

#if ENABLE_OVERLOADING
    BookmarkFileToDataMethodInfo            ,
#endif
    bookmarkFileToData                      ,


-- ** toFile #method:toFile#

#if ENABLE_OVERLOADING
    BookmarkFileToFileMethodInfo            ,
#endif
    bookmarkFileToFile                      ,




    ) 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.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


-- | Memory-managed wrapper type.
newtype BookmarkFile = BookmarkFile (ManagedPtr BookmarkFile)
-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance WrappedPtr BookmarkFile where
    wrappedPtrCalloc = return nullPtr
    wrappedPtrCopy = return
    wrappedPtrFree = Nothing

-- | A convenience alias for `Nothing` :: `Maybe` `BookmarkFile`.
noBookmarkFile :: Maybe BookmarkFile
noBookmarkFile = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList BookmarkFile
type instance O.AttributeList BookmarkFile = BookmarkFileAttributeList
type BookmarkFileAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method BookmarkFile::add_application
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the name of the application registering the bookmark\n  or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "exec", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "command line to be used to launch the bookmark or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_add_application" g_bookmark_file_add_application ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- exec : TBasicType TUTF8
    IO ()

{- |
Adds the application with /@name@/ and /@exec@/ to the list of
applications that have registered a bookmark for /@uri@/ into
/@bookmark@/.

Every bookmark inside a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' must have at least an
application registered.  Each application must provide a name, a
command line useful for launching the bookmark, the number of times
the bookmark has been registered by the application and the last
time the application registered this bookmark.

If /@name@/ is 'Nothing', the name of the application will be the
same returned by 'GI.GLib.Functions.getApplicationName'; if /@exec@/ is 'Nothing', the
command line will be a composition of the program name as
returned by 'GI.GLib.Functions.getPrgname' and the \"%u\" modifier, which will be
expanded to the bookmark\'s URI.

This function will automatically take care of updating the
registrations count and timestamping in case an application
with the same /@name@/ had already registered a bookmark for
/@uri@/ inside /@bookmark@/.

If no bookmark for /@uri@/ is found, one is created.

/Since: 2.12/
-}
bookmarkFileAddApplication ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> Maybe (T.Text)
    {- ^ /@name@/: the name of the application registering the bookmark
  or 'Nothing' -}
    -> Maybe (T.Text)
    {- ^ /@exec@/: command line to be used to launch the bookmark or 'Nothing' -}
    -> m ()
bookmarkFileAddApplication bookmark uri name exec = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    maybeExec <- case exec of
        Nothing -> return nullPtr
        Just jExec -> do
            jExec' <- textToCString jExec
            return jExec'
    g_bookmark_file_add_application bookmark' uri' maybeName maybeExec
    touchManagedPtr bookmark
    freeMem uri'
    freeMem maybeName
    freeMem maybeExec
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileAddApplicationMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> Maybe (T.Text) -> m ()), MonadIO m) => O.MethodInfo BookmarkFileAddApplicationMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileAddApplication

#endif

-- method BookmarkFile::add_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the group name to be added", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_add_group" g_bookmark_file_add_group ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- group : TBasicType TUTF8
    IO ()

{- |
Adds /@group@/ to the list of groups to which the bookmark for /@uri@/
belongs to.

If no bookmark for /@uri@/ is found then it is created.

/Since: 2.12/
-}
bookmarkFileAddGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@group@/: the group name to be added -}
    -> m ()
bookmarkFileAddGroup bookmark uri group = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    group' <- textToCString group
    g_bookmark_file_add_group bookmark' uri' group'
    touchManagedPtr bookmark
    freeMem uri'
    freeMem group'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileAddGroupMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileAddGroupMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileAddGroup

#endif

-- method BookmarkFile::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_free" g_bookmark_file_free ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    IO ()

{- |
Frees a 'GI.GLib.Structs.BookmarkFile.BookmarkFile'.

/Since: 2.12/
-}
bookmarkFileFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> m ()
bookmarkFileFree bookmark = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    g_bookmark_file_free bookmark'
    touchManagedPtr bookmark
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo BookmarkFileFreeMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileFree

#endif

-- method BookmarkFile::get_added
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TLong)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_added" g_bookmark_file_get_added ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CLong

{- |
Gets the time the bookmark for /@uri@/ was added to /@bookmark@/

In the event the URI cannot be found, -1 is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetAdded ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m CLong
    {- ^ __Returns:__ a timestamp /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetAdded bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        result <- propagateGError $ g_bookmark_file_get_added bookmark' uri'
        touchManagedPtr bookmark
        freeMem uri'
        return result
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetAddedMethodInfo
instance (signature ~ (T.Text -> m CLong), MonadIO m) => O.MethodInfo BookmarkFileGetAddedMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetAdded

#endif

-- method BookmarkFile::get_app_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an application's name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "exec", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the command line of the application, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "count", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the registration count, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "stamp", argType = TBasicType TLong, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the last registration time, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_app_info" g_bookmark_file_get_app_info ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    Ptr CString ->                          -- exec : TBasicType TUTF8
    Ptr Word32 ->                           -- count : TBasicType TUInt
    Ptr CLong ->                            -- stamp : TBasicType TLong
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Gets the registration information of /@appName@/ for the bookmark for
/@uri@/.  See 'GI.GLib.Structs.BookmarkFile.bookmarkFileSetAppInfo' for more information about
the returned data.

The string returned in /@appExec@/ must be freed.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.  In the
event that no application with name /@appName@/ has registered a bookmark
for /@uri@/,  'False' is returned and error is set to
@/G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED/@. In the event that unquoting
the command line fails, an error of the @/G_SHELL_ERROR/@ domain is
set and 'False' is returned.

/Since: 2.12/
-}
bookmarkFileGetAppInfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@name@/: an application\'s name -}
    -> m ((T.Text, Word32, CLong))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetAppInfo bookmark uri name = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    name' <- textToCString name
    exec <- allocMem :: IO (Ptr CString)
    count <- allocMem :: IO (Ptr Word32)
    stamp <- allocMem :: IO (Ptr CLong)
    onException (do
        _ <- propagateGError $ g_bookmark_file_get_app_info bookmark' uri' name' exec count stamp
        exec' <- peek exec
        exec'' <- cstringToText exec'
        freeMem exec'
        count' <- peek count
        stamp' <- peek stamp
        touchManagedPtr bookmark
        freeMem uri'
        freeMem name'
        freeMem exec
        freeMem count
        freeMem stamp
        return (exec'', count', stamp')
     ) (do
        freeMem uri'
        freeMem name'
        freeMem exec
        freeMem count
        freeMem stamp
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetAppInfoMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ((T.Text, Word32, CLong))), MonadIO m) => O.MethodInfo BookmarkFileGetAppInfoMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetAppInfo

#endif

-- method BookmarkFile::get_applications
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location of the length of the returned list, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location of the length of the returned list, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 2 (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_applications" g_bookmark_file_get_applications ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

{- |
Retrieves the names of the applications that have registered the
bookmark for /@uri@/.

In the event the URI cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetApplications ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m [T.Text]
    {- ^ __Returns:__ a newly allocated 'Nothing'-terminated array of strings.
  Use 'GI.GLib.Functions.strfreev' to free it. /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetApplications bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_bookmark_file_get_applications bookmark' uri' length_
        length_' <- peek length_
        checkUnexpectedReturnNULL "bookmarkFileGetApplications" result
        result' <- (unpackUTF8CArrayWithLength length_') result
        (mapCArrayWithLength length_') freeMem result
        freeMem result
        touchManagedPtr bookmark
        freeMem uri'
        freeMem length_
        return result'
     ) (do
        freeMem uri'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetApplicationsMethodInfo
instance (signature ~ (T.Text -> m [T.Text]), MonadIO m) => O.MethodInfo BookmarkFileGetApplicationsMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetApplications

#endif

-- method BookmarkFile::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_description" g_bookmark_file_get_description ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Retrieves the description of the bookmark for /@uri@/.

In the event the URI cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string or 'Nothing' if the specified
  URI cannot be found. /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetDescription bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        result <- propagateGError $ g_bookmark_file_get_description bookmark' uri'
        checkUnexpectedReturnNULL "bookmarkFileGetDescription" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr bookmark
        freeMem uri'
        return result'
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetDescriptionMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m) => O.MethodInfo BookmarkFileGetDescriptionMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetDescription

#endif

-- method BookmarkFile::get_groups
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the length of the returned string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the length of the returned string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 2 (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_groups" g_bookmark_file_get_groups ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

{- |
Retrieves the list of group names of the bookmark for /@uri@/.

In the event the URI cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

The returned array is 'Nothing' terminated, so /@length@/ may optionally
be 'Nothing'.

/Since: 2.12/
-}
bookmarkFileGetGroups ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m [T.Text]
    {- ^ __Returns:__ a newly allocated 'Nothing'-terminated array of group names.
  Use 'GI.GLib.Functions.strfreev' to free it. /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetGroups bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_bookmark_file_get_groups bookmark' uri' length_
        length_' <- peek length_
        checkUnexpectedReturnNULL "bookmarkFileGetGroups" result
        result' <- (unpackUTF8CArrayWithLength length_') result
        (mapCArrayWithLength length_') freeMem result
        freeMem result
        touchManagedPtr bookmark
        freeMem uri'
        freeMem length_
        return result'
     ) (do
        freeMem uri'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetGroupsMethodInfo
instance (signature ~ (T.Text -> m [T.Text]), MonadIO m) => O.MethodInfo BookmarkFileGetGroupsMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetGroups

#endif

-- method BookmarkFile::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "href", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the icon's location or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "mime_type", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the icon's MIME type or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_icon" g_bookmark_file_get_icon ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr CString ->                          -- href : TBasicType TUTF8
    Ptr CString ->                          -- mime_type : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Gets the icon of the bookmark for /@uri@/.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetIcon ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m ((T.Text, T.Text))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetIcon bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    href <- allocMem :: IO (Ptr CString)
    mimeType <- allocMem :: IO (Ptr CString)
    onException (do
        _ <- propagateGError $ g_bookmark_file_get_icon bookmark' uri' href mimeType
        href' <- peek href
        href'' <- cstringToText href'
        freeMem href'
        mimeType' <- peek mimeType
        mimeType'' <- cstringToText mimeType'
        freeMem mimeType'
        touchManagedPtr bookmark
        freeMem uri'
        freeMem href
        freeMem mimeType
        return (href'', mimeType'')
     ) (do
        freeMem uri'
        freeMem href
        freeMem mimeType
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetIconMethodInfo
instance (signature ~ (T.Text -> m ((T.Text, T.Text))), MonadIO m) => O.MethodInfo BookmarkFileGetIconMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetIcon

#endif

-- method BookmarkFile::get_is_private
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_is_private" g_bookmark_file_get_is_private ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Gets whether the private flag of the bookmark for /@uri@/ is set.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.  In the
event that the private flag cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.12/
-}
bookmarkFileGetIsPrivate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetIsPrivate bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        _ <- propagateGError $ g_bookmark_file_get_is_private bookmark' uri'
        touchManagedPtr bookmark
        freeMem uri'
        return ()
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetIsPrivateMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileGetIsPrivateMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetIsPrivate

#endif

-- method BookmarkFile::get_mime_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_mime_type" g_bookmark_file_get_mime_type ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Retrieves the MIME type of the resource pointed by /@uri@/.

In the event the URI cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.  In the
event that the MIME type cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.12/
-}
bookmarkFileGetMimeType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string or 'Nothing' if the specified
  URI cannot be found. /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetMimeType bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        result <- propagateGError $ g_bookmark_file_get_mime_type bookmark' uri'
        checkUnexpectedReturnNULL "bookmarkFileGetMimeType" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr bookmark
        freeMem uri'
        return result'
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetMimeTypeMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m) => O.MethodInfo BookmarkFileGetMimeTypeMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetMimeType

#endif

-- method BookmarkFile::get_modified
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TLong)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_modified" g_bookmark_file_get_modified ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CLong

{- |
Gets the time when the bookmark for /@uri@/ was last modified.

In the event the URI cannot be found, -1 is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetModified ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m CLong
    {- ^ __Returns:__ a timestamp /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetModified bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        result <- propagateGError $ g_bookmark_file_get_modified bookmark' uri'
        touchManagedPtr bookmark
        freeMem uri'
        return result
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetModifiedMethodInfo
instance (signature ~ (T.Text -> m CLong), MonadIO m) => O.MethodInfo BookmarkFileGetModifiedMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetModified

#endif

-- method BookmarkFile::get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_get_size" g_bookmark_file_get_size ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    IO Int32

{- |
Gets the number of bookmarks inside /@bookmark@/.

/Since: 2.12/
-}
bookmarkFileGetSize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> m Int32
    {- ^ __Returns:__ the number of bookmarks -}
bookmarkFileGetSize bookmark = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    result <- g_bookmark_file_get_size bookmark'
    touchManagedPtr bookmark
    return result

#if ENABLE_OVERLOADING
data BookmarkFileGetSizeMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo BookmarkFileGetSizeMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetSize

#endif

-- method BookmarkFile::get_title
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a valid URI or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_title" g_bookmark_file_get_title ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Returns the title of the bookmark for /@uri@/.

If /@uri@/ is 'Nothing', the title of /@bookmark@/ is returned.

In the event the URI cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetTitle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> Maybe (T.Text)
    {- ^ /@uri@/: a valid URI or 'Nothing' -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string or 'Nothing' if the specified
  URI cannot be found. /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetTitle bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    maybeUri <- case uri of
        Nothing -> return nullPtr
        Just jUri -> do
            jUri' <- textToCString jUri
            return jUri'
    onException (do
        result <- propagateGError $ g_bookmark_file_get_title bookmark' maybeUri
        checkUnexpectedReturnNULL "bookmarkFileGetTitle" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr bookmark
        freeMem maybeUri
        return result'
     ) (do
        freeMem maybeUri
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetTitleMethodInfo
instance (signature ~ (Maybe (T.Text) -> m T.Text), MonadIO m) => O.MethodInfo BookmarkFileGetTitleMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetTitle

#endif

-- method BookmarkFile::get_uris
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the number of returned URIs, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the number of returned URIs, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 1 (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_get_uris" g_bookmark_file_get_uris ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    IO (Ptr CString)

{- |
Returns all URIs of the bookmarks in the bookmark file /@bookmark@/.
The array of returned URIs will be 'Nothing'-terminated, so /@length@/ may
optionally be 'Nothing'.

/Since: 2.12/
-}
bookmarkFileGetUris ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> m [T.Text]
    {- ^ __Returns:__ a newly allocated 'Nothing'-terminated array of strings.
  Use 'GI.GLib.Functions.strfreev' to free it. -}
bookmarkFileGetUris bookmark = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    length_ <- allocMem :: IO (Ptr Word64)
    result <- g_bookmark_file_get_uris bookmark' length_
    length_' <- peek length_
    checkUnexpectedReturnNULL "bookmarkFileGetUris" result
    result' <- (unpackUTF8CArrayWithLength length_') result
    (mapCArrayWithLength length_') freeMem result
    freeMem result
    touchManagedPtr bookmark
    freeMem length_
    return result'

#if ENABLE_OVERLOADING
data BookmarkFileGetUrisMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m) => O.MethodInfo BookmarkFileGetUrisMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetUris

#endif

-- method BookmarkFile::get_visited
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TLong)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_get_visited" g_bookmark_file_get_visited ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CLong

{- |
Gets the time the bookmark for /@uri@/ was last visited.

In the event the URI cannot be found, -1 is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileGetVisited ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m CLong
    {- ^ __Returns:__ a timestamp. /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileGetVisited bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        result <- propagateGError $ g_bookmark_file_get_visited bookmark' uri'
        touchManagedPtr bookmark
        freeMem uri'
        return result
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileGetVisitedMethodInfo
instance (signature ~ (T.Text -> m CLong), MonadIO m) => O.MethodInfo BookmarkFileGetVisitedMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileGetVisited

#endif

-- method BookmarkFile::has_application
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the application", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_has_application" g_bookmark_file_has_application ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Checks whether the bookmark for /@uri@/ inside /@bookmark@/ has been
registered by application /@name@/.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileHasApplication ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@name@/: the name of the application -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileHasApplication bookmark uri name = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    name' <- textToCString name
    onException (do
        _ <- propagateGError $ g_bookmark_file_has_application bookmark' uri' name'
        touchManagedPtr bookmark
        freeMem uri'
        freeMem name'
        return ()
     ) (do
        freeMem uri'
        freeMem name'
     )

#if ENABLE_OVERLOADING
data BookmarkFileHasApplicationMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileHasApplicationMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileHasApplication

#endif

-- method BookmarkFile::has_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the group name to be searched", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_has_group" g_bookmark_file_has_group ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- group : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Checks whether /@group@/ appears in the list of groups to which
the bookmark for /@uri@/ belongs to.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileHasGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@group@/: the group name to be searched -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileHasGroup bookmark uri group = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    group' <- textToCString group
    onException (do
        _ <- propagateGError $ g_bookmark_file_has_group bookmark' uri' group'
        touchManagedPtr bookmark
        freeMem uri'
        freeMem group'
        return ()
     ) (do
        freeMem uri'
        freeMem group'
     )

#if ENABLE_OVERLOADING
data BookmarkFileHasGroupMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileHasGroupMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileHasGroup

#endif

-- method BookmarkFile::has_item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", 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 "g_bookmark_file_has_item" g_bookmark_file_has_item ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    IO CInt

{- |
Looks whether the desktop bookmark has an item with its URI set to /@uri@/.

/Since: 2.12/
-}
bookmarkFileHasItem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@uri@/ is inside /@bookmark@/, 'False' otherwise -}
bookmarkFileHasItem bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    result <- g_bookmark_file_has_item bookmark' uri'
    let result' = (/= 0) result
    touchManagedPtr bookmark
    freeMem uri'
    return result'

#if ENABLE_OVERLOADING
data BookmarkFileHasItemMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo BookmarkFileHasItemMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileHasItem

#endif

-- method BookmarkFile::load_from_data
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GBookmarkFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "desktop bookmarks\n   loaded in memory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @data in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @data in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_load_from_data" g_bookmark_file_load_from_data ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    Ptr Word8 ->                            -- data : TCArray False (-1) 2 (TBasicType TUInt8)
    Word64 ->                               -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Loads a bookmark file from memory into an empty 'GI.GLib.Structs.BookmarkFile.BookmarkFile'
structure.  If the object cannot be created then /@error@/ is set to a
'GI.GLib.Enums.BookmarkFileError'.

/Since: 2.12/
-}
bookmarkFileLoadFromData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: an empty 'GI.GLib.Structs.BookmarkFile.BookmarkFile' struct -}
    -> ByteString
    {- ^ /@data@/: desktop bookmarks
   loaded in memory -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileLoadFromData bookmark data_ = liftIO $ do
    let length_ = fromIntegral $ B.length data_
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    data_' <- packByteString data_
    onException (do
        _ <- propagateGError $ g_bookmark_file_load_from_data bookmark' data_' length_
        touchManagedPtr bookmark
        freeMem data_'
        return ()
     ) (do
        freeMem data_'
     )

#if ENABLE_OVERLOADING
data BookmarkFileLoadFromDataMethodInfo
instance (signature ~ (ByteString -> m ()), MonadIO m) => O.MethodInfo BookmarkFileLoadFromDataMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileLoadFromData

#endif

-- method BookmarkFile::load_from_data_dirs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a relative path to a filename to open and parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "full_path", argType = TBasicType TFileName, direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "return location for a string\n   containing the full path of the file, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_load_from_data_dirs" g_bookmark_file_load_from_data_dirs ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- file : TBasicType TFileName
    Ptr CString ->                          -- full_path : TBasicType TFileName
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
This function looks for a desktop bookmark file named /@file@/ in the
paths returned from 'GI.GLib.Functions.getUserDataDir' and 'GI.GLib.Functions.getSystemDataDirs',
loads the file into /@bookmark@/ and returns the file\'s full path in
/@fullPath@/.  If the file could not be loaded then /@error@/ is
set to either a 'GI.GLib.Enums.FileError' or 'GI.GLib.Enums.BookmarkFileError'.

/Since: 2.12/
-}
bookmarkFileLoadFromDataDirs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> [Char]
    {- ^ /@file@/: a relative path to a filename to open and parse -}
    -> m ((Maybe [Char]))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileLoadFromDataDirs bookmark file = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    file' <- stringToCString file
    fullPath <- allocMem :: IO (Ptr CString)
    onException (do
        _ <- propagateGError $ g_bookmark_file_load_from_data_dirs bookmark' file' fullPath
        fullPath' <- peek fullPath
        maybeFullPath' <- convertIfNonNull fullPath' $ \fullPath'' -> do
            fullPath''' <- cstringToString fullPath''
            return fullPath'''
        freeMem fullPath'
        touchManagedPtr bookmark
        freeMem file'
        freeMem fullPath
        return maybeFullPath'
     ) (do
        freeMem file'
        freeMem fullPath
     )

#if ENABLE_OVERLOADING
data BookmarkFileLoadFromDataDirsMethodInfo
instance (signature ~ ([Char] -> m ((Maybe [Char]))), MonadIO m) => O.MethodInfo BookmarkFileLoadFromDataDirsMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileLoadFromDataDirs

#endif

-- method BookmarkFile::load_from_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GBookmarkFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filename", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the path of a filename to load, in the\n    GLib file name encoding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_load_from_file" g_bookmark_file_load_from_file ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- filename : TBasicType TFileName
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Loads a desktop bookmark file into an empty 'GI.GLib.Structs.BookmarkFile.BookmarkFile' structure.
If the file could not be loaded then /@error@/ is set to either a 'GI.GLib.Enums.FileError'
or 'GI.GLib.Enums.BookmarkFileError'.

/Since: 2.12/
-}
bookmarkFileLoadFromFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: an empty 'GI.GLib.Structs.BookmarkFile.BookmarkFile' struct -}
    -> [Char]
    {- ^ /@filename@/: the path of a filename to load, in the
    GLib file name encoding -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileLoadFromFile bookmark filename = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    filename' <- stringToCString filename
    onException (do
        _ <- propagateGError $ g_bookmark_file_load_from_file bookmark' filename'
        touchManagedPtr bookmark
        freeMem filename'
        return ()
     ) (do
        freeMem filename'
     )

#if ENABLE_OVERLOADING
data BookmarkFileLoadFromFileMethodInfo
instance (signature ~ ([Char] -> m ()), MonadIO m) => O.MethodInfo BookmarkFileLoadFromFileMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileLoadFromFile

#endif

-- method BookmarkFile::move_item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "old_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "new_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a valid URI, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_move_item" g_bookmark_file_move_item ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- old_uri : TBasicType TUTF8
    CString ->                              -- new_uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Changes the URI of a bookmark item from /@oldUri@/ to /@newUri@/.  Any
existing bookmark for /@newUri@/ will be overwritten.  If /@newUri@/ is
'Nothing', then the bookmark is removed.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.

/Since: 2.12/
-}
bookmarkFileMoveItem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@oldUri@/: a valid URI -}
    -> Maybe (T.Text)
    {- ^ /@newUri@/: a valid URI, or 'Nothing' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileMoveItem bookmark oldUri newUri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    oldUri' <- textToCString oldUri
    maybeNewUri <- case newUri of
        Nothing -> return nullPtr
        Just jNewUri -> do
            jNewUri' <- textToCString jNewUri
            return jNewUri'
    onException (do
        _ <- propagateGError $ g_bookmark_file_move_item bookmark' oldUri' maybeNewUri
        touchManagedPtr bookmark
        freeMem oldUri'
        freeMem maybeNewUri
        return ()
     ) (do
        freeMem oldUri'
        freeMem maybeNewUri
     )

#if ENABLE_OVERLOADING
data BookmarkFileMoveItemMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> m ()), MonadIO m) => O.MethodInfo BookmarkFileMoveItemMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileMoveItem

#endif

-- method BookmarkFile::remove_application
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the application", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_remove_application" g_bookmark_file_remove_application ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Removes application registered with /@name@/ from the list of applications
that have registered a bookmark for /@uri@/ inside /@bookmark@/.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.
In the event that no application with name /@appName@/ has registered
a bookmark for /@uri@/,  'False' is returned and error is set to
@/G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED/@.

/Since: 2.12/
-}
bookmarkFileRemoveApplication ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@name@/: the name of the application -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileRemoveApplication bookmark uri name = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    name' <- textToCString name
    onException (do
        _ <- propagateGError $ g_bookmark_file_remove_application bookmark' uri' name'
        touchManagedPtr bookmark
        freeMem uri'
        freeMem name'
        return ()
     ) (do
        freeMem uri'
        freeMem name'
     )

#if ENABLE_OVERLOADING
data BookmarkFileRemoveApplicationMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileRemoveApplicationMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileRemoveApplication

#endif

-- method BookmarkFile::remove_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the group name to be removed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_remove_group" g_bookmark_file_remove_group ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- group : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Removes /@group@/ from the list of groups to which the bookmark
for /@uri@/ belongs to.

In the event the URI cannot be found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@.
In the event no group was defined, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.12/
-}
bookmarkFileRemoveGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@group@/: the group name to be removed -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileRemoveGroup bookmark uri group = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    group' <- textToCString group
    onException (do
        _ <- propagateGError $ g_bookmark_file_remove_group bookmark' uri' group'
        touchManagedPtr bookmark
        freeMem uri'
        freeMem group'
        return ()
     ) (do
        freeMem uri'
        freeMem group'
     )

#if ENABLE_OVERLOADING
data BookmarkFileRemoveGroupMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileRemoveGroupMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileRemoveGroup

#endif

-- method BookmarkFile::remove_item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_remove_item" g_bookmark_file_remove_item ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Removes the bookmark for /@uri@/ from the bookmark file /@bookmark@/.

/Since: 2.12/
-}
bookmarkFileRemoveItem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileRemoveItem bookmark uri = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    onException (do
        _ <- propagateGError $ g_bookmark_file_remove_item bookmark' uri'
        touchManagedPtr bookmark
        freeMem uri'
        return ()
     ) (do
        freeMem uri'
     )

#if ENABLE_OVERLOADING
data BookmarkFileRemoveItemMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileRemoveItemMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileRemoveItem

#endif

-- method BookmarkFile::set_added
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "added", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a timestamp or -1 to use the current time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_added" g_bookmark_file_set_added ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CLong ->                                -- added : TBasicType TLong
    IO ()

{- |
Sets the time the bookmark for /@uri@/ was added into /@bookmark@/.

If no bookmark for /@uri@/ is found then it is created.

/Since: 2.12/
-}
bookmarkFileSetAdded ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> CLong
    {- ^ /@added@/: a timestamp or -1 to use the current time -}
    -> m ()
bookmarkFileSetAdded bookmark uri added = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    g_bookmark_file_set_added bookmark' uri' added
    touchManagedPtr bookmark
    freeMem uri'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetAddedMethodInfo
instance (signature ~ (T.Text -> CLong -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetAddedMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetAdded

#endif

-- method BookmarkFile::set_app_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an application's name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "exec", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an application's command line", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "count", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of registrations done for this application", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stamp", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time of the last registration for this application", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_set_app_info" g_bookmark_file_set_app_info ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- exec : TBasicType TUTF8
    Int32 ->                                -- count : TBasicType TInt
    CLong ->                                -- stamp : TBasicType TLong
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Sets the meta-data of application /@name@/ inside the list of
applications that have registered a bookmark for /@uri@/ inside
/@bookmark@/.

You should rarely use this function; use 'GI.GLib.Structs.BookmarkFile.bookmarkFileAddApplication'
and 'GI.GLib.Structs.BookmarkFile.bookmarkFileRemoveApplication' instead.

/@name@/ can be any UTF-8 encoded string used to identify an
application.
/@exec@/ can have one of these two modifiers: \"%f\", which will
be expanded as the local file name retrieved from the bookmark\'s
URI; \"%u\", which will be expanded as the bookmark\'s URI.
The expansion is done automatically when retrieving the stored
command line using the 'GI.GLib.Structs.BookmarkFile.bookmarkFileGetAppInfo' function.
/@count@/ is the number of times the application has registered the
bookmark; if is \< 0, the current registration count will be increased
by one, if is 0, the application with /@name@/ will be removed from
the list of registered applications.
/@stamp@/ is the Unix time of the last registration; if it is -1, the
current time will be used.

If you try to remove an application by setting its registration count to
zero, and no bookmark for /@uri@/ is found, 'False' is returned and
/@error@/ is set to @/G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND/@; similarly,
in the event that no application /@name@/ has registered a bookmark
for /@uri@/,  'False' is returned and error is set to
@/G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED/@.  Otherwise, if no bookmark
for /@uri@/ is found, one is created.

/Since: 2.12/
-}
bookmarkFileSetAppInfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@name@/: an application\'s name -}
    -> T.Text
    {- ^ /@exec@/: an application\'s command line -}
    -> Int32
    {- ^ /@count@/: the number of registrations done for this application -}
    -> CLong
    {- ^ /@stamp@/: the time of the last registration for this application -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileSetAppInfo bookmark uri name exec count stamp = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    name' <- textToCString name
    exec' <- textToCString exec
    onException (do
        _ <- propagateGError $ g_bookmark_file_set_app_info bookmark' uri' name' exec' count stamp
        touchManagedPtr bookmark
        freeMem uri'
        freeMem name'
        freeMem exec'
        return ()
     ) (do
        freeMem uri'
        freeMem name'
        freeMem exec'
     )

#if ENABLE_OVERLOADING
data BookmarkFileSetAppInfoMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> Int32 -> CLong -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetAppInfoMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetAppInfo

#endif

-- method BookmarkFile::set_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a valid URI or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_description" g_bookmark_file_set_description ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- description : TBasicType TUTF8
    IO ()

{- |
Sets /@description@/ as the description of the bookmark for /@uri@/.

If /@uri@/ is 'Nothing', the description of /@bookmark@/ is set.

If a bookmark for /@uri@/ cannot be found then it is created.

/Since: 2.12/
-}
bookmarkFileSetDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> Maybe (T.Text)
    {- ^ /@uri@/: a valid URI or 'Nothing' -}
    -> T.Text
    {- ^ /@description@/: a string -}
    -> m ()
bookmarkFileSetDescription bookmark uri description = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    maybeUri <- case uri of
        Nothing -> return nullPtr
        Just jUri -> do
            jUri' <- textToCString jUri
            return jUri'
    description' <- textToCString description
    g_bookmark_file_set_description bookmark' maybeUri description'
    touchManagedPtr bookmark
    freeMem maybeUri
    freeMem description'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetDescriptionMethodInfo
instance (signature ~ (Maybe (T.Text) -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetDescriptionMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetDescription

#endif

-- method BookmarkFile::set_groups
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an item's URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "groups", argType = TCArray False (-1) 3 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "an array of\n   group names, or %NULL to remove all groups", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of group name values in @groups", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of group name values in @groups", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_groups" g_bookmark_file_set_groups ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr CString ->                          -- groups : TCArray False (-1) 3 (TBasicType TUTF8)
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

{- |
Sets a list of group names for the item with URI /@uri@/.  Each previously
set group name list is removed.

If /@uri@/ cannot be found then an item for it is created.

/Since: 2.12/
-}
bookmarkFileSetGroups ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: an item\'s URI -}
    -> Maybe ([T.Text])
    {- ^ /@groups@/: an array of
   group names, or 'Nothing' to remove all groups -}
    -> m ()
bookmarkFileSetGroups bookmark uri groups = liftIO $ do
    let length_ = case groups of
            Nothing -> 0
            Just jGroups -> fromIntegral $ length jGroups
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    maybeGroups <- case groups of
        Nothing -> return nullPtr
        Just jGroups -> do
            jGroups' <- packUTF8CArray jGroups
            return jGroups'
    g_bookmark_file_set_groups bookmark' uri' maybeGroups length_
    touchManagedPtr bookmark
    freeMem uri'
    (mapCArrayWithLength length_) freeMem maybeGroups
    freeMem maybeGroups
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetGroupsMethodInfo
instance (signature ~ (T.Text -> Maybe ([T.Text]) -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetGroupsMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetGroups

#endif

-- method BookmarkFile::set_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "href", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the URI of the icon for the bookmark, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the MIME type of the icon for the bookmark", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_icon" g_bookmark_file_set_icon ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- href : TBasicType TUTF8
    CString ->                              -- mime_type : TBasicType TUTF8
    IO ()

{- |
Sets the icon for the bookmark for /@uri@/. If /@href@/ is 'Nothing', unsets
the currently set icon. /@href@/ can either be a full URL for the icon
file or the icon name following the Icon Naming specification.

If no bookmark for /@uri@/ is found one is created.

/Since: 2.12/
-}
bookmarkFileSetIcon ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> Maybe (T.Text)
    {- ^ /@href@/: the URI of the icon for the bookmark, or 'Nothing' -}
    -> T.Text
    {- ^ /@mimeType@/: the MIME type of the icon for the bookmark -}
    -> m ()
bookmarkFileSetIcon bookmark uri href mimeType = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    maybeHref <- case href of
        Nothing -> return nullPtr
        Just jHref -> do
            jHref' <- textToCString jHref
            return jHref'
    mimeType' <- textToCString mimeType
    g_bookmark_file_set_icon bookmark' uri' maybeHref mimeType'
    touchManagedPtr bookmark
    freeMem uri'
    freeMem maybeHref
    freeMem mimeType'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetIconMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetIconMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetIcon

#endif

-- method BookmarkFile::set_is_private
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "is_private", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if the bookmark should be marked as private", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_is_private" g_bookmark_file_set_is_private ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CInt ->                                 -- is_private : TBasicType TBoolean
    IO ()

{- |
Sets the private flag of the bookmark for /@uri@/.

If a bookmark for /@uri@/ cannot be found then it is created.

/Since: 2.12/
-}
bookmarkFileSetIsPrivate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> Bool
    {- ^ /@isPrivate@/: 'True' if the bookmark should be marked as private -}
    -> m ()
bookmarkFileSetIsPrivate bookmark uri isPrivate = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    let isPrivate' = (fromIntegral . fromEnum) isPrivate
    g_bookmark_file_set_is_private bookmark' uri' isPrivate'
    touchManagedPtr bookmark
    freeMem uri'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetIsPrivateMethodInfo
instance (signature ~ (T.Text -> Bool -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetIsPrivateMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetIsPrivate

#endif

-- method BookmarkFile::set_mime_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a MIME type", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_mime_type" g_bookmark_file_set_mime_type ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- mime_type : TBasicType TUTF8
    IO ()

{- |
Sets /@mimeType@/ as the MIME type of the bookmark for /@uri@/.

If a bookmark for /@uri@/ cannot be found then it is created.

/Since: 2.12/
-}
bookmarkFileSetMimeType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> T.Text
    {- ^ /@mimeType@/: a MIME type -}
    -> m ()
bookmarkFileSetMimeType bookmark uri mimeType = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    mimeType' <- textToCString mimeType
    g_bookmark_file_set_mime_type bookmark' uri' mimeType'
    touchManagedPtr bookmark
    freeMem uri'
    freeMem mimeType'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetMimeTypeMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetMimeTypeMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetMimeType

#endif

-- method BookmarkFile::set_modified
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "modified", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a timestamp or -1 to use the current time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_modified" g_bookmark_file_set_modified ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CLong ->                                -- modified : TBasicType TLong
    IO ()

{- |
Sets the last time the bookmark for /@uri@/ was last modified.

If no bookmark for /@uri@/ is found then it is created.

The \"modified\" time should only be set when the bookmark\'s meta-data
was actually changed.  Every function of 'GI.GLib.Structs.BookmarkFile.BookmarkFile' that
modifies a bookmark also changes the modification time, except for
'GI.GLib.Structs.BookmarkFile.bookmarkFileSetVisited'.

/Since: 2.12/
-}
bookmarkFileSetModified ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> CLong
    {- ^ /@modified@/: a timestamp or -1 to use the current time -}
    -> m ()
bookmarkFileSetModified bookmark uri modified = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    g_bookmark_file_set_modified bookmark' uri' modified
    touchManagedPtr bookmark
    freeMem uri'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetModifiedMethodInfo
instance (signature ~ (T.Text -> CLong -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetModifiedMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetModified

#endif

-- method BookmarkFile::set_title
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a valid URI or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "title", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_title" g_bookmark_file_set_title ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- title : TBasicType TUTF8
    IO ()

{- |
Sets /@title@/ as the title of the bookmark for /@uri@/ inside the
bookmark file /@bookmark@/.

If /@uri@/ is 'Nothing', the title of /@bookmark@/ is set.

If a bookmark for /@uri@/ cannot be found then it is created.

/Since: 2.12/
-}
bookmarkFileSetTitle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> Maybe (T.Text)
    {- ^ /@uri@/: a valid URI or 'Nothing' -}
    -> T.Text
    {- ^ /@title@/: a UTF-8 encoded string -}
    -> m ()
bookmarkFileSetTitle bookmark uri title = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    maybeUri <- case uri of
        Nothing -> return nullPtr
        Just jUri -> do
            jUri' <- textToCString jUri
            return jUri'
    title' <- textToCString title
    g_bookmark_file_set_title bookmark' maybeUri title'
    touchManagedPtr bookmark
    freeMem maybeUri
    freeMem title'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetTitleMethodInfo
instance (signature ~ (Maybe (T.Text) -> T.Text -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetTitleMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetTitle

#endif

-- method BookmarkFile::set_visited
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "visited", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a timestamp or -1 to use the current time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_set_visited" g_bookmark_file_set_visited ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- uri : TBasicType TUTF8
    CLong ->                                -- visited : TBasicType TLong
    IO ()

{- |
Sets the time the bookmark for /@uri@/ was last visited.

If no bookmark for /@uri@/ is found then it is created.

The \"visited\" time should only be set if the bookmark was launched,
either using the command line retrieved by 'GI.GLib.Structs.BookmarkFile.bookmarkFileGetAppInfo'
or by the default application for the bookmark\'s MIME type, retrieved
using 'GI.GLib.Structs.BookmarkFile.bookmarkFileGetMimeType'.  Changing the \"visited\" time
does not affect the \"modified\" time.

/Since: 2.12/
-}
bookmarkFileSetVisited ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> T.Text
    {- ^ /@uri@/: a valid URI -}
    -> CLong
    {- ^ /@visited@/: a timestamp or -1 to use the current time -}
    -> m ()
bookmarkFileSetVisited bookmark uri visited = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    uri' <- textToCString uri
    g_bookmark_file_set_visited bookmark' uri' visited
    touchManagedPtr bookmark
    freeMem uri'
    return ()

#if ENABLE_OVERLOADING
data BookmarkFileSetVisitedMethodInfo
instance (signature ~ (T.Text -> CLong -> m ()), MonadIO m) => O.MethodInfo BookmarkFileSetVisitedMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileSetVisited

#endif

-- method BookmarkFile::to_data
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the length of the returned string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the length of the returned string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 1 (TBasicType TUInt8))
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_to_data" g_bookmark_file_to_data ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Word8)

{- |
This function outputs /@bookmark@/ as a string.

/Since: 2.12/
-}
bookmarkFileToData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> m ByteString
    {- ^ __Returns:__ 
  a newly allocated string holding the contents of the 'GI.GLib.Structs.BookmarkFile.BookmarkFile' /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileToData bookmark = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_bookmark_file_to_data bookmark' length_
        length_' <- peek length_
        checkUnexpectedReturnNULL "bookmarkFileToData" result
        result' <- (unpackByteStringWithLength length_') result
        freeMem result
        touchManagedPtr bookmark
        freeMem length_
        return result'
     ) (do
        freeMem length_
     )

#if ENABLE_OVERLOADING
data BookmarkFileToDataMethodInfo
instance (signature ~ (m ByteString), MonadIO m) => O.MethodInfo BookmarkFileToDataMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileToData

#endif

-- method BookmarkFile::to_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bookmark", argType = TInterface (Name {namespace = "GLib", name = "BookmarkFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBookmarkFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filename", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "path of the output file", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_bookmark_file_to_file" g_bookmark_file_to_file ::
    Ptr BookmarkFile ->                     -- bookmark : TInterface (Name {namespace = "GLib", name = "BookmarkFile"})
    CString ->                              -- filename : TBasicType TFileName
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
This function outputs /@bookmark@/ into a file.  The write process is
guaranteed to be atomic by using 'GI.GLib.Functions.fileSetContents' internally.

/Since: 2.12/
-}
bookmarkFileToFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BookmarkFile
    {- ^ /@bookmark@/: a 'GI.GLib.Structs.BookmarkFile.BookmarkFile' -}
    -> [Char]
    {- ^ /@filename@/: path of the output file -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bookmarkFileToFile bookmark filename = liftIO $ do
    bookmark' <- unsafeManagedPtrGetPtr bookmark
    filename' <- stringToCString filename
    onException (do
        _ <- propagateGError $ g_bookmark_file_to_file bookmark' filename'
        touchManagedPtr bookmark
        freeMem filename'
        return ()
     ) (do
        freeMem filename'
     )

#if ENABLE_OVERLOADING
data BookmarkFileToFileMethodInfo
instance (signature ~ ([Char] -> m ()), MonadIO m) => O.MethodInfo BookmarkFileToFileMethodInfo BookmarkFile signature where
    overloadedMethod _ = bookmarkFileToFile

#endif

-- method BookmarkFile::error_quark
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_bookmark_file_error_quark" g_bookmark_file_error_quark ::
    IO Word32

{- |
/No description available in the introspection data./
-}
bookmarkFileErrorQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
bookmarkFileErrorQuark  = liftIO $ do
    result <- g_bookmark_file_error_quark
    return result

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveBookmarkFileMethod (t :: Symbol) (o :: *) :: * where
    ResolveBookmarkFileMethod "addApplication" o = BookmarkFileAddApplicationMethodInfo
    ResolveBookmarkFileMethod "addGroup" o = BookmarkFileAddGroupMethodInfo
    ResolveBookmarkFileMethod "free" o = BookmarkFileFreeMethodInfo
    ResolveBookmarkFileMethod "hasApplication" o = BookmarkFileHasApplicationMethodInfo
    ResolveBookmarkFileMethod "hasGroup" o = BookmarkFileHasGroupMethodInfo
    ResolveBookmarkFileMethod "hasItem" o = BookmarkFileHasItemMethodInfo
    ResolveBookmarkFileMethod "loadFromData" o = BookmarkFileLoadFromDataMethodInfo
    ResolveBookmarkFileMethod "loadFromDataDirs" o = BookmarkFileLoadFromDataDirsMethodInfo
    ResolveBookmarkFileMethod "loadFromFile" o = BookmarkFileLoadFromFileMethodInfo
    ResolveBookmarkFileMethod "moveItem" o = BookmarkFileMoveItemMethodInfo
    ResolveBookmarkFileMethod "removeApplication" o = BookmarkFileRemoveApplicationMethodInfo
    ResolveBookmarkFileMethod "removeGroup" o = BookmarkFileRemoveGroupMethodInfo
    ResolveBookmarkFileMethod "removeItem" o = BookmarkFileRemoveItemMethodInfo
    ResolveBookmarkFileMethod "toData" o = BookmarkFileToDataMethodInfo
    ResolveBookmarkFileMethod "toFile" o = BookmarkFileToFileMethodInfo
    ResolveBookmarkFileMethod "getAdded" o = BookmarkFileGetAddedMethodInfo
    ResolveBookmarkFileMethod "getAppInfo" o = BookmarkFileGetAppInfoMethodInfo
    ResolveBookmarkFileMethod "getApplications" o = BookmarkFileGetApplicationsMethodInfo
    ResolveBookmarkFileMethod "getDescription" o = BookmarkFileGetDescriptionMethodInfo
    ResolveBookmarkFileMethod "getGroups" o = BookmarkFileGetGroupsMethodInfo
    ResolveBookmarkFileMethod "getIcon" o = BookmarkFileGetIconMethodInfo
    ResolveBookmarkFileMethod "getIsPrivate" o = BookmarkFileGetIsPrivateMethodInfo
    ResolveBookmarkFileMethod "getMimeType" o = BookmarkFileGetMimeTypeMethodInfo
    ResolveBookmarkFileMethod "getModified" o = BookmarkFileGetModifiedMethodInfo
    ResolveBookmarkFileMethod "getSize" o = BookmarkFileGetSizeMethodInfo
    ResolveBookmarkFileMethod "getTitle" o = BookmarkFileGetTitleMethodInfo
    ResolveBookmarkFileMethod "getUris" o = BookmarkFileGetUrisMethodInfo
    ResolveBookmarkFileMethod "getVisited" o = BookmarkFileGetVisitedMethodInfo
    ResolveBookmarkFileMethod "setAdded" o = BookmarkFileSetAddedMethodInfo
    ResolveBookmarkFileMethod "setAppInfo" o = BookmarkFileSetAppInfoMethodInfo
    ResolveBookmarkFileMethod "setDescription" o = BookmarkFileSetDescriptionMethodInfo
    ResolveBookmarkFileMethod "setGroups" o = BookmarkFileSetGroupsMethodInfo
    ResolveBookmarkFileMethod "setIcon" o = BookmarkFileSetIconMethodInfo
    ResolveBookmarkFileMethod "setIsPrivate" o = BookmarkFileSetIsPrivateMethodInfo
    ResolveBookmarkFileMethod "setMimeType" o = BookmarkFileSetMimeTypeMethodInfo
    ResolveBookmarkFileMethod "setModified" o = BookmarkFileSetModifiedMethodInfo
    ResolveBookmarkFileMethod "setTitle" o = BookmarkFileSetTitleMethodInfo
    ResolveBookmarkFileMethod "setVisited" o = BookmarkFileSetVisitedMethodInfo
    ResolveBookmarkFileMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBookmarkFileMethod t BookmarkFile, O.MethodInfo info BookmarkFile p) => OL.IsLabel t (BookmarkFile -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif