Gjsify LogoGjsify Logo

An opaque data structure representing a set of bookmarks.

record

Hierarchy

  • BookmarkFile

Index

Constructors

Properties

name: string

Methods

  • add_application(uri: string, name: string, exec: string): void
  • 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 #GBookmarkFile 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 %NULL, the name of the application will be the same returned by g_get_application_name(); if exec is %NULL, the command line will be a composition of the program name as returned by g_get_prgname() 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.

    Parameters

    • uri: string

      a valid URI

    • name: string

      the name of the application registering the bookmark or %NULL

    • exec: string

      command line to be used to launch the bookmark or %NULL

    Returns void

  • add_group(uri: string, group: string): void
  • 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.

    Parameters

    • uri: string

      a valid URI

    • group: string

      the group name to be added

    Returns void

  • free(): void
  • get_added(uri: string): number
  • 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.

    Parameters

    • uri: string

      a valid URI

    Returns number

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

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • uri: string

      a valid URI

    Returns GLib.DateTime

  • get_app_info(uri: string, name: string): [boolean, string, number, number]
  • Gets the registration information of app_name for the bookmark for uri. See g_bookmark_file_set_application_info() for more information about the returned data.

    The string returned in app_exec 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 app_name 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.

    Parameters

    • uri: string

      a valid URI

    • name: string

      an application's name

    Returns [boolean, string, number, number]

  • get_application_info(uri: string, name: string): [boolean, string, number, GLib.DateTime]
  • Gets the registration information of app_name for the bookmark for uri. See g_bookmark_file_set_application_info() for more information about the returned data.

    The string returned in app_exec 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 app_name 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.

    Parameters

    • uri: string

      a valid URI

    • name: string

      an application's name

    Returns [boolean, string, number, GLib.DateTime]

  • get_applications(uri: string): string[]
  • Retrieves the names of the applications that have registered the bookmark for uri.

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • uri: string

      a valid URI

    Returns string[]

  • get_description(uri: string): string
  • Retrieves the description of the bookmark for uri.

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • uri: string

      a valid URI

    Returns string

  • get_groups(uri: string): string[]
  • Retrieves the list of group names of the bookmark for uri.

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    The returned array is %NULL terminated, so length may optionally be %NULL.

    Parameters

    • uri: string

      a valid URI

    Returns string[]

  • get_icon(uri: string): [boolean, string, string]
  • 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.

    Parameters

    • uri: string

      a valid URI

    Returns [boolean, string, string]

  • get_is_private(uri: string): boolean
  • 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.

    Parameters

    • uri: string

      a valid URI

    Returns boolean

  • get_mime_type(uri: string): string
  • Retrieves the MIME type of the resource pointed by uri.

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event that the MIME type cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_INVALID_VALUE.

    Parameters

    • uri: string

      a valid URI

    Returns string

  • get_modified(uri: string): number
  • 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.

    Parameters

    • uri: string

      a valid URI

    Returns number

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

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • uri: string

      a valid URI

    Returns GLib.DateTime

  • get_size(): number
  • get_title(uri: string): string
  • Returns the title of the bookmark for uri.

    If uri is %NULL, the title of bookmark is returned.

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • uri: string

      a valid URI or %NULL

    Returns string

  • get_uris(): string[]
  • Returns all URIs of the bookmarks in the bookmark file bookmark. The array of returned URIs will be %NULL-terminated, so length may optionally be %NULL.

    Returns string[]

  • get_visited(uri: string): number
  • 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.

    Parameters

    • uri: string

      a valid URI

    Returns number

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

    In the event the URI cannot be found, %NULL is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • uri: string

      a valid URI

    Returns GLib.DateTime

  • has_application(uri: string, name: string): boolean
  • 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.

    Parameters

    • uri: string

      a valid URI

    • name: string

      the name of the application

    Returns boolean

  • has_group(uri: string, group: string): boolean
  • 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.

    Parameters

    • uri: string

      a valid URI

    • group: string

      the group name to be searched

    Returns boolean

  • has_item(uri: string): boolean
  • Looks whether the desktop bookmark has an item with its URI set to uri.

    Parameters

    • uri: string

      a valid URI

    Returns boolean

  • load_from_data(data: Uint8Array): boolean
  • Loads a bookmark file from memory into an empty #GBookmarkFile structure. If the object cannot be created then error is set to a #GBookmarkFileError.

    Parameters

    • data: Uint8Array

      desktop bookmarks loaded in memory

    Returns boolean

  • load_from_data_dirs(file: string): [boolean, string]
  • This function looks for a desktop bookmark file named file in the paths returned from g_get_user_data_dir() and g_get_system_data_dirs(), loads the file into bookmark and returns the file's full path in full_path. If the file could not be loaded then error is set to either a #GFileError or #GBookmarkFileError.

    Parameters

    • file: string

      a relative path to a filename to open and parse

    Returns [boolean, string]

  • load_from_file(filename: string): 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.

    Parameters

    • filename: string

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

    Returns boolean

  • move_item(old_uri: string, new_uri: string): 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.

    In the event the URI cannot be found, %FALSE is returned and error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.

    Parameters

    • old_uri: string

      a valid URI

    • new_uri: string

      a valid URI, or %NULL

    Returns boolean

  • remove_application(uri: string, name: string): boolean
  • 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 app_name has registered a bookmark for uri, %FALSE is returned and error is set to %G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.

    Parameters

    • uri: string

      a valid URI

    • name: string

      the name of the application

    Returns boolean

  • remove_group(uri: string, group: string): boolean
  • 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.

    Parameters

    • uri: string

      a valid URI

    • group: string

      the group name to be removed

    Returns boolean

  • remove_item(uri: string): boolean
  • Removes the bookmark for uri from the bookmark file bookmark.

    Parameters

    • uri: string

      a valid URI

    Returns boolean

  • set_added(uri: string, added: number): void
  • Sets the time the bookmark for uri was added into bookmark.

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

    Parameters

    • uri: string

      a valid URI

    • added: number

      a timestamp or -1 to use the current time

    Returns void

  • set_added_date_time(uri: string, added: GLib.DateTime): void
  • Sets the time the bookmark for uri was added into bookmark.

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

    Parameters

    Returns void

  • set_app_info(uri: string, name: string, exec: string, count: number, stamp: number): boolean
  • 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 g_bookmark_file_add_application() and g_bookmark_file_remove_application() 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 g_bookmark_file_get_application_info() 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.

    Parameters

    • uri: string

      a valid URI

    • name: string

      an application's name

    • exec: string

      an application's command line

    • count: number

      the number of registrations done for this application

    • stamp: number

      the time of the last registration for this application

    Returns boolean

  • set_application_info(uri: string, name: string, exec: string, count: number, stamp: GLib.DateTime): boolean
  • 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 g_bookmark_file_add_application() and g_bookmark_file_remove_application() 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 g_bookmark_file_get_application_info() 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 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.

    Parameters

    • uri: string

      a valid URI

    • name: string

      an application's name

    • exec: string

      an application's command line

    • count: number

      the number of registrations done for this application

    • stamp: GLib.DateTime

      the time of the last registration for this application, which may be %NULL if count is 0

    Returns boolean

  • set_description(uri: string, description: string): void
  • Sets description as the description of the bookmark for uri.

    If uri is %NULL, the description of bookmark is set.

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

    Parameters

    • uri: string

      a valid URI or %NULL

    • description: string

      a string

    Returns void

  • set_groups(uri: string, groups: string[]): void
  • 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.

    Parameters

    • uri: string

      an item's URI

    • groups: string[]

      an array of group names, or %NULL to remove all groups

    Returns void

  • set_icon(uri: string, href: string, mime_type: string): void
  • 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.

    If no bookmark for uri is found one is created.

    Parameters

    • uri: string

      a valid URI

    • href: string

      the URI of the icon for the bookmark, or %NULL

    • mime_type: string

      the MIME type of the icon for the bookmark

    Returns void

  • set_is_private(uri: string, is_private: boolean): void
  • Sets the private flag of the bookmark for uri.

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

    Parameters

    • uri: string

      a valid URI

    • is_private: boolean

      %TRUE if the bookmark should be marked as private

    Returns void

  • set_mime_type(uri: string, mime_type: string): void
  • Sets mime_type as the MIME type of the bookmark for uri.

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

    Parameters

    • uri: string

      a valid URI

    • mime_type: string

      a MIME type

    Returns void

  • set_modified(uri: string, modified: number): void
  • 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 #GBookmarkFile that modifies a bookmark also changes the modification time, except for g_bookmark_file_set_visited_date_time().

    Parameters

    • uri: string

      a valid URI

    • modified: number

      a timestamp or -1 to use the current time

    Returns void

  • set_modified_date_time(uri: string, modified: GLib.DateTime): void
  • 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 #GBookmarkFile that modifies a bookmark also changes the modification time, except for g_bookmark_file_set_visited_date_time().

    Parameters

    • uri: string

      a valid URI

    • modified: GLib.DateTime

      a #GDateTime

    Returns void

  • set_title(uri: string, title: string): void
  • Sets title as the title of the bookmark for uri inside the bookmark file bookmark.

    If uri is %NULL, the title of bookmark is set.

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

    Parameters

    • uri: string

      a valid URI or %NULL

    • title: string

      a UTF-8 encoded string

    Returns void

  • set_visited(uri: string, visited: number): void
  • 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 g_bookmark_file_get_application_info() or by the default application for the bookmark's MIME type, retrieved using g_bookmark_file_get_mime_type(). Changing the "visited" time does not affect the "modified" time.

    Parameters

    • uri: string

      a valid URI

    • visited: number

      a timestamp or -1 to use the current time

    Returns void

  • set_visited_date_time(uri: string, visited: GLib.DateTime): void
  • 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 g_bookmark_file_get_application_info() or by the default application for the bookmark's MIME type, retrieved using g_bookmark_file_get_mime_type(). Changing the "visited" time does not affect the "modified" time.

    Parameters

    • uri: string

      a valid URI

    • visited: GLib.DateTime

      a #GDateTime

    Returns void

  • to_data(): Uint8Array
  • to_file(filename: string): boolean
  • This function outputs bookmark into a file. The write process is guaranteed to be atomic by using g_file_set_contents() internally.

    Parameters

    • filename: string

      path of the output file

    Returns boolean

  • error_quark(): number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method