Class BookmarkFile
- All Implemented Interfaces:
Proxy
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
addApplication(java.lang.String, java.lang.String, java.lang.String) or setApplicationInfo(java.lang.String, java.lang.String, java.lang.String, int, org.gnome.glib.DateTime).
If a bookmark has no applications then it won't be dumped when creating
the on disk representation, using toData() or
toFile(java.lang.String).
- Since:
- 2.12
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new emptyGBookmarkFileobject.BookmarkFile(MemorySegment address) Create a BookmarkFile proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplication(String uri, @Nullable String name, @Nullable String exec) Adds the application withnameandexecto the list of applications that have registered a bookmark foruriintobookmark.voidAddsgroupto the list of groups to which the bookmark foruribelongs to.copy()Deeply copies a this BookmarkFileGBookmarkFileobject to a new one.static Quarkvoidfree()Frees aGBookmarkFile.longDeprecated.getAddedDateTime(String uri) Gets the time the bookmark foruriwas added to this BookmarkFilebooleangetAppInfo(String uri, String name, @Nullable Out<String> exec, @Nullable Out<Integer> count, @Nullable Out<Long> stamp) Deprecated.Use g_bookmark_file_get_application_info() instead, astime_tis deprecated due to the year 2038 problem.booleangetApplicationInfo(String uri, String name, @Nullable Out<String> exec, @Nullable Out<Integer> count, @Nullable Out<DateTime> stamp) Gets the registration information ofappNamefor the bookmark foruri.See g_bookmark_file_set_application_info() for more information about the returned data.String[]getApplications(String uri) Retrieves the names of the applications that have registered the bookmark foruri.getDescription(String uri) Retrieves the description of the bookmark foruri.String[]Retrieves the list of group names of the bookmark foruri.booleanGets the icon of the bookmark foruri.booleangetIsPrivate(String uri) Gets whether the private flag of the bookmark foruriis set.getMimeType(String uri) Retrieves the MIME type of the resource pointed byuri.longgetModified(String uri) Deprecated.Use g_bookmark_file_get_modified_date_time() instead, astime_tis deprecated due to the year 2038 problem.Gets the time when the bookmark foruriwas last modified.intgetSize()Gets the number of bookmarks insidebookmark.Returns the title of the bookmark foruri.static @Nullable TypegetType()Get the GType of the BookmarkFile classString[]getUris()Returns all URIs of the bookmarks in the bookmark filebookmark.The array of returned URIs will benull-terminated, solengthmay optionally benull.longgetVisited(String uri) Deprecated.Use g_bookmark_file_get_visited_date_time() instead, astime_tis deprecated due to the year 2038 problem.getVisitedDateTime(String uri) Gets the time the bookmark foruriwas last visited.booleanhasApplication(String uri, String name) Checks whether the bookmark foruriinside this BookmarkFile has been registered by applicationname.booleanChecks whethergroupappears in the list of groups to which the bookmark foruribelongs to.booleanLooks whether the desktop bookmark has an item with its URI set touri.booleanloadFromData(@org.jspecify.annotations.Nullable byte @Nullable [] data) Loads a bookmark file from memory into an emptyGBookmarkFilestructure.booleanloadFromDataDirs(String file, @Nullable Out<String> fullPath) This function looks for a desktop bookmark file namedfilein the paths returned from g_get_user_data_dir() and g_get_system_data_dirs(), loads the file into this BookmarkFile and returns the file's full path infullPath.If the file could not be loaded thenerroris set to either aGFileErrororGBookmarkFileError.booleanloadFromFile(String filename) Loads a desktop bookmark file into an emptyGBookmarkFilestructure.booleanChanges the URI of a bookmark item fromoldUritonewUri.Any existing bookmark fornewUriwill be overwritten.booleanremoveApplication(String uri, String name) Removes application registered withnamefrom the list of applications that have registered a bookmark foruriinsidebookmark.booleanremoveGroup(String uri, String group) Removesgroupfrom the list of groups to which the bookmark foruribelongs to.booleanremoveItem(String uri) Removes the bookmark forurifrom the bookmark filebookmark.voidDeprecated.Use g_bookmark_file_set_added_date_time() instead, astime_tis deprecated due to the year 2038 problem.voidsetAddedDateTime(String uri, DateTime added) Sets the time the bookmark foruriwas added intobookmark.booleansetAppInfo(String uri, String name, String exec, int count, long stamp) Deprecated.Use g_bookmark_file_set_application_info() instead, astime_tis deprecated due to the year 2038 problem.booleansetApplicationInfo(String uri, String name, String exec, int count, @Nullable DateTime stamp) Sets the meta-data of applicationnameinside the list of applications that have registered a bookmark foruriinsidebookmark.voidsetDescription(@Nullable String uri, String description) Setsdescriptionas the description of the bookmark foruri.voidSets a list of group names for the item with URIuri.Each previously set group name list is removed.voidSets the icon for the bookmark foruri.Ifhrefisnull, unsets the currently set icon.voidsetIsPrivate(String uri, boolean isPrivate) Sets the private flag of the bookmark foruri.voidsetMimeType(String uri, String mimeType) SetsmimeTypeas the MIME type of the bookmark foruri.voidsetModified(String uri, long modified) Deprecated.Use g_bookmark_file_set_modified_date_time() instead, astime_tis deprecated due to the year 2038 problem.voidsetModifiedDateTime(String uri, DateTime modified) Sets the last time the bookmark foruriwas last modified.voidSetstitleas the title of the bookmark foruriinside the bookmark filebookmark.voidsetVisited(String uri, long visited) Deprecated.Use g_bookmark_file_set_visited_date_time() instead, astime_tis deprecated due to the year 2038 problem.voidsetVisitedDateTime(String uri, DateTime visited) Sets the time the bookmark foruriwas last visited.byte[]toData()This function outputs this BookmarkFile as a string.booleanThis function outputs this BookmarkFile into a file.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
BookmarkFile
Create a BookmarkFile proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
BookmarkFile
public BookmarkFile()Creates a new emptyGBookmarkFileobject.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.
- Since:
- 2.12
-
-
Method Details
-
getType
-
errorQuark
-
addApplication
Adds the application withnameandexecto the list of applications that have registered a bookmark foruriintobookmark.Every bookmark inside a
GBookmarkFilemust 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
nameisnull, the name of the application will be the same returned by g_get_application_name(); ifexecisnull, 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
namehad already registered a bookmark foruriinsidebookmark.If no bookmark for
uriis found, one is created.- Parameters:
uri- a valid URIname- the name of the application registering the bookmark ornullexec- command line to be used to launch the bookmark ornull- Since:
- 2.12
-
addGroup
-
copy
Deeply copies a this BookmarkFileGBookmarkFileobject to a new one.- Returns:
- the copy of
bookmark.Use g_bookmark_free() when finished using it. - Since:
- 2.76
-
free
public void free()Frees aGBookmarkFile.- Since:
- 2.12
-
getAdded
Deprecated.Use g_bookmark_file_get_added_date_time() instead, astime_tis deprecated due to the year 2038 problem.Gets the time the bookmark foruriwas added to this BookmarkFileIn the event the URI cannot be found, -1 is returned and
erroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a timestamp
- Throws:
GErrorException- seeGError- Since:
- 2.12
-
getAddedDateTime
Gets the time the bookmark foruriwas added to this BookmarkFileIn the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a
GDateTime - Throws:
GErrorException- seeGError- Since:
- 2.66
-
getAppInfo
@Deprecated public boolean getAppInfo(String uri, String name, @Nullable Out<String> exec, @Nullable Out<Integer> count, @Nullable Out<Long> stamp) throws GErrorException Deprecated.Use g_bookmark_file_get_application_info() instead, astime_tis deprecated due to the year 2038 problem.Gets the registration information ofappNamefor the bookmark foruri.See g_bookmark_file_set_application_info() for more information about the returned data.The string returned in
appExecmust be freed.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND. In the event that no application with nameappNamehas registered a bookmark foruri,falseis returned and error is set toBookmarkFileError.APP_NOT_REGISTERED. In the event that unquoting the command line fails, an error of theG_SHELL_ERRORdomain is set andfalseis returned.- Parameters:
uri- a valid URIname- an application's nameexec- return location for the command line of the application, ornullcount- return location for the registration count, ornullstamp- return location for the last registration time, ornull- Returns:
trueon success.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
getApplicationInfo
public boolean getApplicationInfo(String uri, String name, @Nullable Out<String> exec, @Nullable Out<Integer> count, @Nullable Out<DateTime> stamp) throws GErrorException Gets the registration information ofappNamefor the bookmark foruri.See g_bookmark_file_set_application_info() for more information about the returned data.The string returned in
appExecmust be freed.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND. In the event that no application with nameappNamehas registered a bookmark foruri,falseis returned and error is set toBookmarkFileError.APP_NOT_REGISTERED. In the event that unquoting the command line fails, an error of theG_SHELL_ERRORdomain is set andfalseis returned.- Parameters:
uri- a valid URIname- an application's nameexec- return location for the command line of the application, ornullcount- return location for the registration count, ornullstamp- return location for the last registration time, ornull- Returns:
trueon success.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
getApplications
Retrieves the names of the applications that have registered the bookmark foruri.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a newly allocated
null-terminated array of strings. Use g_strfreev() to free it. - Throws:
GErrorException- seeGError- Since:
- 2.12
-
getDescription
Retrieves the description of the bookmark foruri.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a newly allocated string or
nullif the specified URI cannot be found. - Throws:
GErrorException- seeGError- Since:
- 2.12
-
getGroups
Retrieves the list of group names of the bookmark foruri.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.The returned array is
nullterminated, solengthmay optionally benull.- Parameters:
uri- a valid URI- Returns:
- a newly allocated
null-terminated array of group names. Use g_strfreev() to free it. - Throws:
GErrorException- seeGError- Since:
- 2.12
-
getIcon
public boolean getIcon(String uri, @Nullable Out<String> href, @Nullable Out<String> mimeType) throws GErrorException Gets the icon of the bookmark foruri.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URIhref- return location for the icon's location ornullmimeType- return location for the icon's MIME type ornull- Returns:
trueif the icon for the bookmark for the URI was found. You should free the returned strings.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
getIsPrivate
Gets whether the private flag of the bookmark foruriis set.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND. In the event that the private flag cannot be found,falseis returned anderroris set toBookmarkFileError.INVALID_VALUE.- Parameters:
uri- a valid URI- Returns:
trueif the private flag is set,falseotherwise.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
getMimeType
Retrieves the MIME type of the resource pointed byuri.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND. In the event that the MIME type cannot be found,nullis returned anderroris set toBookmarkFileError.INVALID_VALUE.- Parameters:
uri- a valid URI- Returns:
- a newly allocated string or
nullif the specified URI cannot be found. - Throws:
GErrorException- seeGError- Since:
- 2.12
-
getModified
Deprecated.Use g_bookmark_file_get_modified_date_time() instead, astime_tis deprecated due to the year 2038 problem.Gets the time when the bookmark foruriwas last modified.In the event the URI cannot be found, -1 is returned and
erroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a timestamp
- Throws:
GErrorException- seeGError- Since:
- 2.12
-
getModifiedDateTime
Gets the time when the bookmark foruriwas last modified.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a
GDateTime - Throws:
GErrorException- seeGError- Since:
- 2.66
-
getSize
public int getSize()Gets the number of bookmarks insidebookmark.- Returns:
- the number of bookmarks
- Since:
- 2.12
-
getTitle
Returns the title of the bookmark foruri.If
uriisnull, the title of this BookmarkFile is returned.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI ornull- Returns:
- a newly allocated string or
nullif the specified URI cannot be found. - Throws:
GErrorException- seeGError- Since:
- 2.12
-
getUris
Returns all URIs of the bookmarks in the bookmark filebookmark.The array of returned URIs will benull-terminated, solengthmay optionally benull.- Returns:
- a newly allocated
null-terminated array of strings. Use g_strfreev() to free it. - Since:
- 2.12
-
getVisited
Deprecated.Use g_bookmark_file_get_visited_date_time() instead, astime_tis deprecated due to the year 2038 problem.Gets the time the bookmark foruriwas last visited.In the event the URI cannot be found, -1 is returned and
erroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a timestamp.
- Throws:
GErrorException- seeGError- Since:
- 2.12
-
getVisitedDateTime
Gets the time the bookmark foruriwas last visited.In the event the URI cannot be found,
nullis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URI- Returns:
- a
GDateTime - Throws:
GErrorException- seeGError- Since:
- 2.66
-
hasApplication
Checks whether the bookmark foruriinside this BookmarkFile has been registered by applicationname.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URIname- the name of the application- Returns:
trueif the applicationnamewas found- Throws:
GErrorException- seeGError- Since:
- 2.12
-
hasGroup
Checks whethergroupappears in the list of groups to which the bookmark foruribelongs to.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
uri- a valid URIgroup- the group name to be searched- Returns:
trueifgroupwas found.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
hasItem
Looks whether the desktop bookmark has an item with its URI set touri.- Parameters:
uri- a valid URI- Returns:
trueifuriis insidebookmark,falseotherwise- Since:
- 2.12
-
loadFromData
public boolean loadFromData(@org.jspecify.annotations.Nullable byte @Nullable [] data) throws GErrorException Loads a bookmark file from memory into an emptyGBookmarkFilestructure. If the object cannot be created thenerroris set to aGBookmarkFileError.- Parameters:
data- desktop bookmarks loaded in memory- Returns:
trueif a desktop bookmark could be loaded.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
loadFromDataDirs
This function looks for a desktop bookmark file namedfilein the paths returned from g_get_user_data_dir() and g_get_system_data_dirs(), loads the file into this BookmarkFile and returns the file's full path infullPath.If the file could not be loaded thenerroris set to either aGFileErrororGBookmarkFileError.- Parameters:
file- a relative path to a filename to open and parsefullPath- return location for a string containing the full path of the file, ornull- Returns:
trueif a key file could be loaded,falseotherwise- Throws:
GErrorException- seeGError- Since:
- 2.12
-
loadFromFile
Loads a desktop bookmark file into an emptyGBookmarkFilestructure. If the file could not be loaded thenerroris set to either aGFileErrororGBookmarkFileError.- Parameters:
filename- the path of a filename to load, in the GLib file name encoding- Returns:
trueif a desktop bookmark file could be loaded- Throws:
GErrorException- seeGError- Since:
- 2.12
-
moveItem
Changes the URI of a bookmark item fromoldUritonewUri.Any existing bookmark fornewUriwill be overwritten. IfnewUriisnull, then the bookmark is removed.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND.- Parameters:
oldUri- a valid URInewUri- a valid URI, ornull- Returns:
trueif the URI was successfully changed- Throws:
GErrorException- seeGError- Since:
- 2.12
-
removeApplication
Removes application registered withnamefrom the list of applications that have registered a bookmark foruriinsidebookmark.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND. In the event that no application with nameappNamehas registered a bookmark foruri,falseis returned and error is set toBookmarkFileError.APP_NOT_REGISTERED.- Parameters:
uri- a valid URIname- the name of the application- Returns:
trueif the application was successfully removed.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
removeGroup
Removesgroupfrom the list of groups to which the bookmark foruribelongs to.In the event the URI cannot be found,
falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND. In the event no group was defined,falseis returned anderroris set toBookmarkFileError.INVALID_VALUE.- Parameters:
uri- a valid URIgroup- the group name to be removed- Returns:
trueifgroupwas successfully removed.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
removeItem
Removes the bookmark forurifrom the bookmark filebookmark.- Parameters:
uri- a valid URI- Returns:
trueif the bookmark was removed successfully.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
setAdded
Deprecated.Use g_bookmark_file_set_added_date_time() instead, astime_tis deprecated due to the year 2038 problem.Sets the time the bookmark foruriwas added intobookmark.If no bookmark for
uriis found then it is created.- Parameters:
uri- a valid URIadded- a timestamp or -1 to use the current time- Since:
- 2.12
-
setAddedDateTime
-
setAppInfo
@Deprecated public boolean setAppInfo(String uri, String name, String exec, int count, long stamp) throws GErrorException Deprecated.Use g_bookmark_file_set_application_info() instead, astime_tis deprecated due to the year 2038 problem.Sets the meta-data of applicationnameinside the list of applications that have registered a bookmark foruriinsidebookmark.You should rarely use this function; use g_bookmark_file_add_application() and g_bookmark_file_remove_application() instead.
namecan be any UTF-8 encoded string used to identify an application.execcan 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.countis 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 withnamewill be removed from the list of registered applications.stampis 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
uriis found,falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND; similarly, in the event that no applicationnamehas registered a bookmark foruri,falseis returned and error is set toBookmarkFileError.APP_NOT_REGISTERED. Otherwise, if no bookmark foruriis found, one is created.- Parameters:
uri- a valid URIname- an application's nameexec- an application's command linecount- the number of registrations done for this applicationstamp- the time of the last registration for this application- Returns:
trueif the application's meta-data was successfully changed.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
setApplicationInfo
public boolean setApplicationInfo(String uri, String name, String exec, int count, @Nullable DateTime stamp) throws GErrorException Sets the meta-data of applicationnameinside the list of applications that have registered a bookmark foruriinsidebookmark.You should rarely use this function; use g_bookmark_file_add_application() and g_bookmark_file_remove_application() instead.
namecan be any UTF-8 encoded string used to identify an application.execcan 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.countis 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 withnamewill be removed from the list of registered applications.stampis 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
uriis found,falseis returned anderroris set toBookmarkFileError.URI_NOT_FOUND; similarly, in the event that no applicationnamehas registered a bookmark foruri,falseis returned and error is set toBookmarkFileError.APP_NOT_REGISTERED. Otherwise, if no bookmark foruriis found, one is created.- Parameters:
uri- a valid URIname- an application's nameexec- an application's command linecount- the number of registrations done for this applicationstamp- the time of the last registration for this application, which may benullifcountis 0- Returns:
trueif the application's meta-data was successfully changed.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
setDescription
Setsdescriptionas the description of the bookmark foruri.If
uriisnull, the description of this BookmarkFile is set.If a bookmark for
uricannot be found then it is created.- Parameters:
uri- a valid URI ornulldescription- a string- Since:
- 2.12
-
setGroups
Sets a list of group names for the item with URIuri.Each previously set group name list is removed.If
uricannot be found then an item for it is created.- Parameters:
uri- an item's URIgroups- an array of group names, ornullto remove all groups- Since:
- 2.12
-
setIcon
Sets the icon for the bookmark foruri.Ifhrefisnull, unsets the currently set icon.hrefcan either be a full URL for the icon file or the icon name following the Icon Naming specification.If no bookmark for
uriis found one is created.- Parameters:
uri- a valid URIhref- the URI of the icon for the bookmark, ornullmimeType- the MIME type of the icon for the bookmark- Since:
- 2.12
-
setIsPrivate
Sets the private flag of the bookmark foruri.If a bookmark for
uricannot be found then it is created.- Parameters:
uri- a valid URIisPrivate-trueif the bookmark should be marked as private- Since:
- 2.12
-
setMimeType
-
setModified
Deprecated.Use g_bookmark_file_set_modified_date_time() instead, astime_tis deprecated due to the year 2038 problem.Sets the last time the bookmark foruriwas last modified.If no bookmark for
uriis found then it is created.The "modified" time should only be set when the bookmark's meta-data was actually changed. Every function of
GBookmarkFilethat modifies a bookmark also changes the modification time, except for g_bookmark_file_set_visited_date_time().- Parameters:
uri- a valid URImodified- a timestamp or -1 to use the current time- Since:
- 2.12
-
setModifiedDateTime
Sets the last time the bookmark foruriwas last modified.If no bookmark for
uriis found then it is created.The "modified" time should only be set when the bookmark's meta-data was actually changed. Every function of
GBookmarkFilethat modifies a bookmark also changes the modification time, except for g_bookmark_file_set_visited_date_time().- Parameters:
uri- a valid URImodified- aGDateTime- Since:
- 2.66
-
setTitle
Setstitleas the title of the bookmark foruriinside the bookmark filebookmark.If
uriisnull, the title of this BookmarkFile is set.If a bookmark for
uricannot be found then it is created.- Parameters:
uri- a valid URI ornulltitle- a UTF-8 encoded string- Since:
- 2.12
-
setVisited
Deprecated.Use g_bookmark_file_set_visited_date_time() instead, astime_tis deprecated due to the year 2038 problem.Sets the time the bookmark foruriwas last visited.If no bookmark for
uriis 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- a valid URIvisited- a timestamp or -1 to use the current time- Since:
- 2.12
-
setVisitedDateTime
Sets the time the bookmark foruriwas last visited.If no bookmark for
uriis 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- a valid URIvisited- aGDateTime- Since:
- 2.66
-
toData
This function outputs this BookmarkFile as a string.- Returns:
- a newly allocated string holding the contents of the
GBookmarkFile - Throws:
GErrorException- seeGError- Since:
- 2.12
-
toFile
This function outputs this BookmarkFile into a file. The write process is guaranteed to be atomic by using g_file_set_contents() internally.- Parameters:
filename- path of the output file- Returns:
trueif the file was successfully written.- Throws:
GErrorException- seeGError- Since:
- 2.12
-
time_tis deprecated due to the year 2038 problem.