gbookmarkfile.h File Reference

__G_BOOKMARK_FILE_H__

G_BOOKMARK_FILE_ERROR

Enum GBookmarkFileError

g_bookmark_file_error_quark ( void )

IMPORT_C GQuarkg_bookmark_file_error_quark(void)

Typedef GBookmarkFile

typedef struct _GBookmarkFileGBookmarkFile

g_bookmark_file_new ( void )

IMPORT_C GBookmarkFile *g_bookmark_file_new(void)

g_bookmark_file_new:

Creates a new empty GBookmarkFile object.

Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data() or g_bookmark_file_load_from_data_dirs() to read an existing bookmark file.

Return value: an empty GBookmarkFile

Since: 2.12

g_bookmark_file_free ( GBookmarkFile * )

IMPORT_C voidg_bookmark_file_free(GBookmarkFile *bookmark)

g_bookmark_file_free: : a GBookmarkFile

Frees a GBookmarkFile.

Since: 2.12

g_bookmark_file_load_from_file ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_load_from_file(GBookmarkFile *bookmark,
const gchar *filename,
GError **error
)

g_bookmark_file_load_from_file: : an empty GBookmarkFile struct : the path of a filename to load, in the GLib file name encoding : return location for a GError, or NULL

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

Return value: TRUE if a desktop bookmark file could be loaded

Since: 2.12

g_bookmark_file_load_from_data ( GBookmarkFile *, const gchar *, gsize, GError ** )

IMPORT_C gbooleang_bookmark_file_load_from_data(GBookmarkFile *bookmark,
const gchar *data,
gsizelength,
GError **error
)

g_bookmark_file_load_from_data: : an empty GBookmarkFile struct : desktop bookmarks loaded in memory : the length of in bytes : return location for a GError, or NULL

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

Return value: TRUE if a desktop bookmark could be loaded.

Since: 2.12

g_bookmark_file_load_from_data_dirs ( GBookmarkFile *, const gchar *, gchar **, GError ** )

IMPORT_C gbooleang_bookmark_file_load_from_data_dirs(GBookmarkFile *bookmark,
const gchar *file,
gchar **full_path,
GError **error
)

g_bookmark_file_to_data ( GBookmarkFile *, gsize *, GError ** )

IMPORT_C gchar *g_bookmark_file_to_data(GBookmarkFile *bookmark,
gsize *length,
GError **error
)

g_bookmark_file_to_data: : a GBookmarkFile : return location for the length of the returned string, or NULL : return location for a GError, or NULL

This function outputs as a string.

Return value: a newly allocated string holding the contents of the GBookmarkFile

Since: 2.12

g_bookmark_file_to_file ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_to_file(GBookmarkFile *bookmark,
const gchar *filename,
GError **error
)

g_bookmark_file_to_file: : a GBookmarkFile : path of the output file : return location for a GError, or NULL

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

Return value: TRUE if the file was successfully written.

Since: 2.12

g_bookmark_file_set_title ( GBookmarkFile *, const gchar *, const gchar * )

IMPORT_C voidg_bookmark_file_set_title(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *title
)

g_bookmark_file_set_title: : a GBookmarkFile : a valid URI or NULL : a UTF-8 encoded string

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

If is NULL, the title of is set.

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

Since: 2.12

g_bookmark_file_get_title ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gchar *g_bookmark_file_get_title(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_title: : a GBookmarkFile : a valid URI or NULL : return location for a GError, or NULL

Returns the title of the bookmark for .

If is NULL, the title of is returned.

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

Return value: a newly allocated string or NULL if the specified URI cannot be found.

Since: 2.12

g_bookmark_file_set_description ( GBookmarkFile *, const gchar *, const gchar * )

IMPORT_C voidg_bookmark_file_set_description(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *description
)

g_bookmark_file_set_description: : a GBookmarkFile : a valid URI or NULL : a string

Sets as the description of the bookmark for .

If is NULL, the description of is set.

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

Since: 2.12

g_bookmark_file_get_description ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gchar *g_bookmark_file_get_description(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_description: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

Retrieves the description of the bookmark for .

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

Return value: a newly allocated string or NULL if the specified URI cannot be found.

Since: 2.12

g_bookmark_file_set_mime_type ( GBookmarkFile *, const gchar *, const gchar * )

IMPORT_C voidg_bookmark_file_set_mime_type(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *mime_type
)

g_bookmark_file_set_mime_type: : a GBookmarkFile : a valid URI : a MIME type

Sets as the MIME type of the bookmark for .

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

Since: 2.12

g_bookmark_file_get_mime_type ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gchar *g_bookmark_file_get_mime_type(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_mime_type: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

Retrieves the MIME type of the resource pointed by .

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

Return value: a newly allocated string or NULL if the specified URI cannot be found.

Since: 2.12

g_bookmark_file_set_groups ( GBookmarkFile *, const gchar *, const gchar **, gsize )

IMPORT_C voidg_bookmark_file_set_groups(GBookmarkFile *bookmark,
const gchar *uri,
const gchar **groups,
gsizelength
)

g_bookmark_file_set_groups: : a GBookmarkFile : an item's URI : an array of group names, or NULL to remove all groups : number of group name values in

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

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

Since: 2.12

g_bookmark_file_add_group ( GBookmarkFile *, const gchar *, const gchar * )

IMPORT_C voidg_bookmark_file_add_group(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *group
)

g_bookmark_file_add_group: : a GBookmarkFile : a valid URI : the group name to be added

Adds to the list of groups to which the bookmark for belongs to.

If no bookmark for is found then it is created.

Since: 2.12

g_bookmark_file_has_group ( GBookmarkFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_has_group(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *group,
GError **error
)

g_bookmark_file_has_group: : a GBookmarkFile : a valid URI : the group name to be searched : return location for a GError, or NULL

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

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

Return value: TRUE if was found.

Since: 2.12

g_bookmark_file_get_groups ( GBookmarkFile *, const gchar *, gsize *, GError ** )

IMPORT_C gchar **g_bookmark_file_get_groups(GBookmarkFile *bookmark,
const gchar *uri,
gsize *length,
GError **error
)

g_bookmark_file_get_groups: : a GBookmarkFile : a valid URI : return location for the length of the returned string, or NULL : return location for a GError, or NULL

Retrieves the list of group names of the bookmark for .

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

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

Return value: a newly allocated NULL-terminated array of group names. Use g_strfreev() to free it.

Since: 2.12

g_bookmark_file_add_application ( GBookmarkFile *, const gchar *, const gchar *, const gchar * )

IMPORT_C voidg_bookmark_file_add_application(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *name,
const gchar *exec
)

g_bookmark_file_has_application ( GBookmarkFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_has_application(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *name,
GError **error
)

g_bookmark_file_get_applications ( GBookmarkFile *, const gchar *, gsize *, GError ** )

IMPORT_C gchar **g_bookmark_file_get_applications(GBookmarkFile *bookmark,
const gchar *uri,
gsize *length,
GError **error
)

g_bookmark_file_get_applications: : a GBookmarkFile : a valid URI : return location of the length of the returned list, or NULL : return location for a GError, or NULL

Retrieves the names of the applications that have registered the bookmark for .

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

Return value: a newly allocated NULL-terminated array of strings. Use g_strfreev() to free it.

Since: 2.12

g_bookmark_file_set_app_info ( GBookmarkFile *, const gchar *, const gchar *, const gchar *, gint, time_t, GError ** )

IMPORT_C gbooleang_bookmark_file_set_app_info(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *name,
const gchar *exec,
gintcount,
time_tstamp,
GError **error
)

g_bookmark_file_get_app_info ( GBookmarkFile *, const gchar *, const gchar *, gchar **, guint *, time_t *, GError ** )

IMPORT_C gbooleang_bookmark_file_get_app_info(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *name,
gchar **exec,
guint *count,
time_t *stamp,
GError **error
)

g_bookmark_file_set_is_private ( GBookmarkFile *, const gchar *, gboolean )

IMPORT_C voidg_bookmark_file_set_is_private(GBookmarkFile *bookmark,
const gchar *uri,
gbooleanis_private
)

g_bookmark_file_set_is_private: : a GBookmarkFile : a valid URI : TRUE if the bookmark should be marked as private

Sets the private flag of the bookmark for .

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

Since: 2.12

g_bookmark_file_get_is_private ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_get_is_private(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_is_private: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

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

In the event the URI cannot be found, FALSE is returned and is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event that the private flag cannot be found, FALSE is returned and is set to G_BOOKMARK_FILE_ERROR_INVALID_VALUE.

Return value: TRUE if the private flag is set, FALSE otherwise.

Since: 2.12

g_bookmark_file_set_icon ( GBookmarkFile *, const gchar *, const gchar *, const gchar * )

IMPORT_C voidg_bookmark_file_set_icon(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *href,
const gchar *mime_type
)

g_bookmark_file_set_icon: : a GBookmarkFile : a valid URI : the URI of the icon for the bookmark, or NULL : the MIME type of the icon for the bookmark

Sets the icon for the bookmark for . If is NULL, unsets the currently set icon. can either be a full URL for the icon file or the icon name following the Icon Naming specification.

If no bookmark for is found one is created.

Since: 2.12

g_bookmark_file_get_icon ( GBookmarkFile *, const gchar *, gchar **, gchar **, GError ** )

IMPORT_C gbooleang_bookmark_file_get_icon(GBookmarkFile *bookmark,
const gchar *uri,
gchar **href,
gchar **mime_type,
GError **error
)

g_bookmark_file_get_icon: : a GBookmarkFile : a valid URI : return location for the icon's location or NULL : return location for the icon's MIME type or NULL : return location for a GError or NULL

Gets the icon of the bookmark for .

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

Return value: TRUE if the icon for the bookmark for the URI was found. You should free the returned strings.

Since: 2.12

g_bookmark_file_set_added ( GBookmarkFile *, const gchar *, time_t )

IMPORT_C voidg_bookmark_file_set_added(GBookmarkFile *bookmark,
const gchar *uri,
time_tadded
)

g_bookmark_file_set_added: : a GBookmarkFile : a valid URI : a timestamp or -1 to use the current time

Sets the time the bookmark for was added into .

If no bookmark for is found then it is created.

Since: 2.12

g_bookmark_file_get_added ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C time_tg_bookmark_file_get_added(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_added: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

Gets the time the bookmark for was added to

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

Return value: a timestamp

Since: 2.12

g_bookmark_file_set_modified ( GBookmarkFile *, const gchar *, time_t )

IMPORT_C voidg_bookmark_file_set_modified(GBookmarkFile *bookmark,
const gchar *uri,
time_tmodified
)

g_bookmark_file_set_modified: : a GBookmarkFile : a valid URI : a timestamp or -1 to use the current time

Sets the last time the bookmark for was last modified.

If no bookmark for 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().

Since: 2.12

g_bookmark_file_get_modified ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C time_tg_bookmark_file_get_modified(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_modified: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

Gets the time when the bookmark for was last modified.

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

Return value: a timestamp

Since: 2.12

g_bookmark_file_set_visited ( GBookmarkFile *, const gchar *, time_t )

IMPORT_C voidg_bookmark_file_set_visited(GBookmarkFile *bookmark,
const gchar *uri,
time_tvisited
)

g_bookmark_file_set_visited: : a GBookmarkFile : a valid URI : a timestamp or -1 to use the current time

Sets the time the bookmark for was last visited.

If no bookmark for 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_app_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.

Since: 2.12

g_bookmark_file_get_visited ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C time_tg_bookmark_file_get_visited(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_get_visited: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

Gets the time the bookmark for was last visited.

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

Return value: a timestamp.

Since: 2.12

g_bookmark_file_has_item ( GBookmarkFile *, const gchar * )

IMPORT_C gbooleang_bookmark_file_has_item(GBookmarkFile *bookmark,
const gchar *uri
)

g_bookmark_file_has_item: : a GBookmarkFile : a valid URI

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

Return value: TRUE if is inside , FALSE otherwise

Since: 2.12

g_bookmark_file_get_size ( GBookmarkFile * )

IMPORT_C gintg_bookmark_file_get_size(GBookmarkFile *bookmark)

g_bookmark_file_get_size: : a GBookmarkFile

Gets the number of bookmarks inside .

Return value: the number of bookmarks

Since: 2.12

g_bookmark_file_get_uris ( GBookmarkFile *, gsize * )

IMPORT_C gchar **g_bookmark_file_get_uris(GBookmarkFile *bookmark,
gsize *length
)

g_bookmark_file_get_uris: : a GBookmarkFile : return location for the number of returned URIs, or NULL

Returns all URIs of the bookmarks in the bookmark file . The array of returned URIs will be NULL-terminated, so may optionally be NULL.

Return value: a newly allocated NULL-terminated array of strings. Use g_strfreev() to free it.

Since: 2.12

g_bookmark_file_remove_group ( GBookmarkFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_remove_group(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *group,
GError **error
)

g_bookmark_file_remove_group: : a GBookmarkFile : a valid URI : the group name to be removed : return location for a GError, or NULL

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

In the event the URI cannot be found, FALSE is returned and is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event no group was defined, FALSE is returned and is set to G_BOOKMARK_FILE_ERROR_INVALID_VALUE.

Return value: TRUE if was successfully removed.

Since: 2.12

g_bookmark_file_remove_application ( GBookmarkFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_remove_application(GBookmarkFile *bookmark,
const gchar *uri,
const gchar *name,
GError **error
)

g_bookmark_file_remove_item ( GBookmarkFile *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_remove_item(GBookmarkFile *bookmark,
const gchar *uri,
GError **error
)

g_bookmark_file_remove_item: : a GBookmarkFile : a valid URI : return location for a GError, or NULL

Removes the bookmark for from the bookmark file .

Return value: TRUE if the bookmark was removed successfully.

Since: 2.12

g_bookmark_file_move_item ( GBookmarkFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_bookmark_file_move_item(GBookmarkFile *bookmark,
const gchar *old_uri,
const gchar *new_uri,
GError **error
)

g_bookmark_file_move_item: : a GBookmarkFile : a valid URI : a valid URI, or NULL : return location for a GError or NULL

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

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

Return value: TRUE if the URI was successfully changed

Since: 2.12