gi-glib-2.0.23: GLib bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.BookmarkFile

Description

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

Synopsis

Exported types

Methods

Overloaded methods

addApplication

bookmarkFileAddApplication Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Maybe Text

name: the name of the application registering the bookmark or Nothing

-> Maybe Text

exec: command line to be used to launch the bookmark or Nothing

-> m () 

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 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 getApplicationName; if exec is Nothing, the command line will be a composition of the program name as returned by 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

addGroup

bookmarkFileAddGroup Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

group: the group name to be added

-> m () 

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

errorQuark

bookmarkFileErrorQuark :: (HasCallStack, MonadIO m) => m Word32 Source #

No description available in the introspection data.

free

bookmarkFileFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> m () 

Frees a BookmarkFile.

Since: 2.12

getAdded

bookmarkFileGetAdded Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m CLong

Returns: a timestamp (Can throw GError)

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

getAppInfo

bookmarkFileGetAppInfo Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

name: an application's name

-> m (Text, Word32, CLong)

(Can throw GError)

Gets the registration information of appName for the bookmark for uri. See 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

getApplications

bookmarkFileGetApplications Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m [Text]

Returns: a newly allocated Nothing-terminated array of strings. Use strfreev to free it. (Can throw GError)

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

getDescription

bookmarkFileGetDescription Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m Text

Returns: a newly allocated string or Nothing if the specified URI cannot be found. (Can throw GError)

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

getGroups

bookmarkFileGetGroups Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m [Text]

Returns: a newly allocated Nothing-terminated array of group names. Use strfreev to free it. (Can throw GError)

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

getIcon

bookmarkFileGetIcon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m (Text, Text)

(Can throw GError)

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

getIsPrivate

bookmarkFileGetIsPrivate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m ()

(Can throw GError)

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

getMimeType

bookmarkFileGetMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m Text

Returns: a newly allocated string or Nothing if the specified URI cannot be found. (Can throw GError)

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

getModified

bookmarkFileGetModified Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m CLong

Returns: a timestamp (Can throw GError)

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

getSize

bookmarkFileGetSize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> m Int32

Returns: the number of bookmarks

Gets the number of bookmarks inside bookmark.

Since: 2.12

getTitle

bookmarkFileGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Maybe Text

uri: a valid URI or Nothing

-> m Text

Returns: a newly allocated string or Nothing if the specified URI cannot be found. (Can throw GError)

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

getUris

bookmarkFileGetUris Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> m [Text]

Returns: a newly allocated Nothing-terminated array of strings. Use strfreev to free it.

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

getVisited

bookmarkFileGetVisited Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m CLong

Returns: a timestamp. (Can throw GError)

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

hasApplication

bookmarkFileHasApplication Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

name: the name of the application

-> m ()

(Can throw GError)

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

hasGroup

bookmarkFileHasGroup Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

group: the group name to be searched

-> m ()

(Can throw GError)

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

hasItem

bookmarkFileHasItem Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m Bool

Returns: True if uri is inside bookmark, False otherwise

Looks whether the desktop bookmark has an item with its URI set to uri.

Since: 2.12

loadFromData

bookmarkFileLoadFromData Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: an empty BookmarkFile struct

-> ByteString

data: desktop bookmarks loaded in memory

-> m ()

(Can throw GError)

Loads a bookmark file from memory into an empty BookmarkFile structure. If the object cannot be created then error is set to a BookmarkFileError.

Since: 2.12

loadFromDataDirs

bookmarkFileLoadFromDataDirs Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> [Char]

file: a relative path to a filename to open and parse

-> m (Maybe [Char])

(Can throw GError)

This function looks for a desktop bookmark file named file in the paths returned from getUserDataDir and 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 FileError or BookmarkFileError.

Since: 2.12

loadFromFile

bookmarkFileLoadFromFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: an empty BookmarkFile struct

-> [Char]

filename: the path of a filename to load, in the GLib file name encoding

-> m ()

(Can throw GError)

Loads a desktop bookmark file into an empty BookmarkFile structure. If the file could not be loaded then error is set to either a FileError or BookmarkFileError.

Since: 2.12

moveItem

bookmarkFileMoveItem Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

oldUri: a valid URI

-> Maybe Text

newUri: a valid URI, or Nothing

-> m ()

(Can throw GError)

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

removeApplication

bookmarkFileRemoveApplication Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

name: the name of the application

-> m ()

(Can throw GError)

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

removeGroup

bookmarkFileRemoveGroup Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

group: the group name to be removed

-> m ()

(Can throw GError)

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

removeItem

bookmarkFileRemoveItem Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> m ()

(Can throw GError)

Removes the bookmark for uri from the bookmark file bookmark.

Since: 2.12

setAdded

bookmarkFileSetAdded Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> CLong

added: a timestamp or -1 to use the current time

-> m () 

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

setAppInfo

bookmarkFileSetAppInfo Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

name: an application's name

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

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 bookmarkFileAddApplication and 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 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

setDescription

bookmarkFileSetDescription Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Maybe Text

uri: a valid URI or Nothing

-> Text

description: a string

-> m () 

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

setGroups

bookmarkFileSetGroups Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: an item's URI

-> Maybe [Text]

groups: an array of group names, or Nothing to remove all groups

-> m () 

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

setIcon

bookmarkFileSetIcon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Maybe Text

href: the URI of the icon for the bookmark, or Nothing

-> Text

mimeType: the MIME type of the icon for the bookmark

-> m () 

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

setIsPrivate

bookmarkFileSetIsPrivate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Bool

isPrivate: True if the bookmark should be marked as private

-> m () 

Sets the private flag of the bookmark for uri.

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

Since: 2.12

setMimeType

bookmarkFileSetMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> Text

mimeType: a MIME type

-> m () 

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

setModified

bookmarkFileSetModified Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> CLong

modified: a timestamp or -1 to use the current time

-> m () 

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 BookmarkFile that modifies a bookmark also changes the modification time, except for bookmarkFileSetVisited.

Since: 2.12

setTitle

bookmarkFileSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Maybe Text

uri: a valid URI or Nothing

-> Text

title: a UTF-8 encoded string

-> m () 

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

setVisited

bookmarkFileSetVisited Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> Text

uri: a valid URI

-> CLong

visited: a timestamp or -1 to use the current time

-> m () 

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 bookmarkFileGetAppInfo or by the default application for the bookmark's MIME type, retrieved using bookmarkFileGetMimeType. Changing the "visited" time does not affect the "modified" time.

Since: 2.12

toData

bookmarkFileToData Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> m ByteString

Returns: a newly allocated string holding the contents of the BookmarkFile (Can throw GError)

This function outputs bookmark as a string.

Since: 2.12

toFile

bookmarkFileToFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BookmarkFile

bookmark: a BookmarkFile

-> [Char]

filename: path of the output file

-> m ()

(Can throw GError)

This function outputs bookmark into a file. The write process is guaranteed to be atomic by using fileSetContents internally.

Since: 2.12