BookmarkFile

class BookmarkFile(pointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance

GBookmarkFile lets you parse, edit or create files containing bookmarks.

Bookmarks refer to a URI, along with some meta-data about the resource pointed by the URI like its MIME type, the application that is registering the bookmark and the icon that should be used to represent the bookmark. The data is stored using the Desktop Bookmark Specification.

The syntax of the bookmark files is described in detail inside the Desktop Bookmark Specification, here is a quick summary: bookmark files use a sub-class of the XML Bookmark Exchange Language specification, consisting of valid UTF-8 encoded XML, under the <xbel> root element; each bookmark is stored inside a <bookmark> element, using its URI: no relative paths can be used inside a bookmark file. The bookmark may have a user defined title and description, to be used instead of the URI. Under the <metadata> element, with its owner attribute set to http://freedesktop.org, is stored the meta-data about a resource pointed by its URI. The meta-data consists of the resource's MIME type; the applications that have registered a bookmark; the groups to which a bookmark belongs to; a visibility flag, used to set the bookmark as "private" to the applications and groups that has it registered; the URI and MIME type of an icon, to be used when displaying the bookmark inside a GUI.

Here is an example of a bookmark file: bookmarks.xbel

A bookmark file might contain more than one bookmark; each bookmark is accessed through its URI.

The important caveat of bookmark files is that when you add a new bookmark you must also add the application that is registering it, using method@GLib.BookmarkFile.add_application or method@GLib.BookmarkFile.set_application_info. If a bookmark has no applications then it won't be dumped when creating the on disk representation, using method@GLib.BookmarkFile.to_data or method@GLib.BookmarkFile.to_file.

Skipped during bindings generation

  • method get_added: Return type time_t is unsupported

  • parameter exec: exec: Out parameter is not supported

  • parameter exec: exec: Out parameter is not supported

  • parameter length: length: Out parameter is not supported

  • parameter length: length: Out parameter is not supported

  • parameter href: href: Out parameter is not supported

  • method get_modified: Return type time_t is unsupported

  • parameter length: length: Out parameter is not supported

  • method get_visited: Return type time_t is unsupported

  • parameter data: Array parameter of type guint8 is not supported

  • parameter full_path: full_path: Out parameter is not supported

  • parameter added: time_t

  • parameter stamp: time_t

  • parameter modified: time_t

  • parameter visited: time_t

  • parameter length: length: Out parameter is not supported

Since

2.12

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val glibBookmarkFilePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>?

Functions

Link copied to clipboard
fun addApplication(uri: String, name: String? = null, exec: String? = null)

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

Link copied to clipboard
fun addGroup(uri: String, group: String)

Adds @group to the list of groups to which the bookmark for @uri belongs to.

Link copied to clipboard

Deeply copies a @bookmark #GBookmarkFile object to a new one.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard
fun free()

Frees a #GBookmarkFile.

Link copied to clipboard
fun getAddedDateTime(uri: String): <Error class: unknown class><DateTime>

Gets the time the bookmark for @uri was added to @bookmark

Link copied to clipboard
fun getDescription(uri: String): <Error class: unknown class><String>

Retrieves the description of the bookmark for @uri.

Link copied to clipboard
fun getIsPrivate(uri: String): <Error class: unknown class><Boolean>

Gets whether the private flag of the bookmark for @uri is set.

Link copied to clipboard
fun getMimeType(uri: String): <Error class: unknown class><String>

Retrieves the MIME type of the resource pointed by @uri.

Link copied to clipboard
fun getModifiedDateTime(uri: String): <Error class: unknown class><DateTime>

Gets the time when the bookmark for @uri was last modified.

Link copied to clipboard
fun getSize(): <Error class: unknown class>

Gets the number of bookmarks inside @bookmark.

Link copied to clipboard
fun getTitle(uri: String? = null): <Error class: unknown class><String>

Returns the title of the bookmark for @uri.

Link copied to clipboard
fun getVisitedDateTime(uri: String): <Error class: unknown class><DateTime>

Gets the time the bookmark for @uri was last visited.

Link copied to clipboard
fun hasApplication(uri: String, name: String): <Error class: unknown class><Boolean>

Checks whether the bookmark for @uri inside @bookmark has been registered by application @name.

Link copied to clipboard
fun hasGroup(uri: String, group: String): <Error class: unknown class><Boolean>

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

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

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

Link copied to clipboard
fun loadFromFile(filename: String): <Error class: unknown class><Boolean>

Loads a desktop bookmark file into an empty #GBookmarkFile structure. If the file could not be loaded then @error is set to either a #GFileError or #GBookmarkFileError.

Link copied to clipboard
fun moveItem(oldUri: String, newUri: String? = null): <Error class: unknown class><Boolean>

Changes the URI of a bookmark item from @old_uri to @new_uri. Any existing bookmark for @new_uri will be overwritten. If @new_uri is null, then the bookmark is removed.

Link copied to clipboard
fun removeApplication(uri: String, name: String): <Error class: unknown class><Boolean>

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

Link copied to clipboard
fun removeGroup(uri: String, group: String): <Error class: unknown class><Boolean>

Removes @group from the list of groups to which the bookmark for @uri belongs to.

Link copied to clipboard
fun removeItem(uri: String): <Error class: unknown class><Boolean>

Removes the bookmark for @uri from the bookmark file @bookmark.

Link copied to clipboard
fun setAddedDateTime(uri: String, added: DateTime)

Sets the time the bookmark for @uri was added into @bookmark.

Link copied to clipboard
fun setApplicationInfo(uri: String, name: String, exec: String, count: <Error class: unknown class>, stamp: DateTime? = null): <Error class: unknown class><Boolean>

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

Link copied to clipboard
fun setDescription(uri: String? = null, description: String)

Sets @description as the description of the bookmark for @uri.

Link copied to clipboard
fun setGroups(uri: String, groups: List<String>? = null, length: <Error class: unknown class>)

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

Link copied to clipboard
fun setIcon(uri: String, href: String? = null, mimeType: String)

Sets the icon for the bookmark for @uri. If @href is null, 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.

Link copied to clipboard
fun setIsPrivate(uri: String, isPrivate: Boolean)

Sets the private flag of the bookmark for @uri.

Link copied to clipboard
fun setMimeType(uri: String, mimeType: String)

Sets @mime_type as the MIME type of the bookmark for @uri.

Link copied to clipboard
fun setModifiedDateTime(uri: String, modified: DateTime)

Sets the last time the bookmark for @uri was last modified.

Link copied to clipboard
fun setTitle(uri: String? = null, title: String)

Sets @title as the title of the bookmark for @uri inside the bookmark file @bookmark.

Link copied to clipboard
fun setVisitedDateTime(uri: String, visited: DateTime)

Sets the time the bookmark for @uri was last visited.

Link copied to clipboard
fun toFile(filename: String): <Error class: unknown class><Boolean>

This function outputs @bookmark into a file. The write process is guaranteed to be atomic by using g_file_set_contents() internally.