1 /* gbookmarkfile.h: parsing and building desktop bookmarks
3 * Copyright (C) 2005-2006 Emmanuele Bassi
5 * SPDX-License-Identifier: LGPL-2.1-or-later
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef __G_BOOKMARK_FILE_H__
22 #define __G_BOOKMARK_FILE_H__
24 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
25 #error "Only <glib.h> can be included directly."
28 #include <glib/gdatetime.h>
29 #include <glib/gerror.h>
35 * G_BOOKMARK_FILE_ERROR:
37 * Error domain for bookmark file parsing.
39 * Errors in this domain will be from the #GBookmarkFileError
40 * enumeration. See #GError for information on error domains.
42 #define G_BOOKMARK_FILE_ERROR (g_bookmark_file_error_quark ())
47 * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed
48 * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found
49 * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did
50 * not register a bookmark
51 * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found
52 * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed
53 * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was
54 * in an unknown encoding
55 * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing
56 * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found
58 * Error codes returned by bookmark file parsing.
62 G_BOOKMARK_FILE_ERROR_INVALID_URI,
63 G_BOOKMARK_FILE_ERROR_INVALID_VALUE,
64 G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,
65 G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
66 G_BOOKMARK_FILE_ERROR_READ,
67 G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,
68 G_BOOKMARK_FILE_ERROR_WRITE,
69 G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
73 GQuark g_bookmark_file_error_quark (void);
78 * An opaque data structure representing a set of bookmarks.
80 typedef struct _GBookmarkFile GBookmarkFile;
83 GBookmarkFile *g_bookmark_file_new (void);
85 void g_bookmark_file_free (GBookmarkFile *bookmark);
87 GLIB_AVAILABLE_IN_2_76
88 GBookmarkFile *g_bookmark_file_copy (GBookmarkFile *bookmark);
91 gboolean g_bookmark_file_load_from_file (GBookmarkFile *bookmark,
92 const gchar *filename,
95 gboolean g_bookmark_file_load_from_data (GBookmarkFile *bookmark,
100 gboolean g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark,
104 GLIB_AVAILABLE_IN_ALL
105 gchar * g_bookmark_file_to_data (GBookmarkFile *bookmark,
107 GError **error) G_GNUC_MALLOC;
108 GLIB_AVAILABLE_IN_ALL
109 gboolean g_bookmark_file_to_file (GBookmarkFile *bookmark,
110 const gchar *filename,
113 GLIB_AVAILABLE_IN_ALL
114 void g_bookmark_file_set_title (GBookmarkFile *bookmark,
117 GLIB_AVAILABLE_IN_ALL
118 gchar * g_bookmark_file_get_title (GBookmarkFile *bookmark,
120 GError **error) G_GNUC_MALLOC;
121 GLIB_AVAILABLE_IN_ALL
122 void g_bookmark_file_set_description (GBookmarkFile *bookmark,
124 const gchar *description);
125 GLIB_AVAILABLE_IN_ALL
126 gchar * g_bookmark_file_get_description (GBookmarkFile *bookmark,
128 GError **error) G_GNUC_MALLOC;
129 GLIB_AVAILABLE_IN_ALL
130 void g_bookmark_file_set_mime_type (GBookmarkFile *bookmark,
132 const gchar *mime_type);
133 GLIB_AVAILABLE_IN_ALL
134 gchar * g_bookmark_file_get_mime_type (GBookmarkFile *bookmark,
136 GError **error) G_GNUC_MALLOC;
137 GLIB_AVAILABLE_IN_ALL
138 void g_bookmark_file_set_groups (GBookmarkFile *bookmark,
140 const gchar **groups,
142 GLIB_AVAILABLE_IN_ALL
143 void g_bookmark_file_add_group (GBookmarkFile *bookmark,
146 GLIB_AVAILABLE_IN_ALL
147 gboolean g_bookmark_file_has_group (GBookmarkFile *bookmark,
151 GLIB_AVAILABLE_IN_ALL
152 gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark,
156 GLIB_AVAILABLE_IN_ALL
157 void g_bookmark_file_add_application (GBookmarkFile *bookmark,
161 GLIB_AVAILABLE_IN_ALL
162 gboolean g_bookmark_file_has_application (GBookmarkFile *bookmark,
166 GLIB_AVAILABLE_IN_ALL
167 gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark,
171 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_application_info)
172 gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark,
179 GLIB_AVAILABLE_IN_2_66
180 gboolean g_bookmark_file_set_application_info (GBookmarkFile *bookmark,
187 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_application_info)
188 gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark,
195 GLIB_AVAILABLE_IN_2_66
196 gboolean g_bookmark_file_get_application_info (GBookmarkFile *bookmark,
203 GLIB_AVAILABLE_IN_ALL
204 void g_bookmark_file_set_is_private (GBookmarkFile *bookmark,
206 gboolean is_private);
207 GLIB_AVAILABLE_IN_ALL
208 gboolean g_bookmark_file_get_is_private (GBookmarkFile *bookmark,
211 GLIB_AVAILABLE_IN_ALL
212 void g_bookmark_file_set_icon (GBookmarkFile *bookmark,
215 const gchar *mime_type);
216 GLIB_AVAILABLE_IN_ALL
217 gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark,
222 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_added_date_time)
223 void g_bookmark_file_set_added (GBookmarkFile *bookmark,
226 GLIB_AVAILABLE_IN_2_66
227 void g_bookmark_file_set_added_date_time (GBookmarkFile *bookmark,
230 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_added_date_time)
231 time_t g_bookmark_file_get_added (GBookmarkFile *bookmark,
234 GLIB_AVAILABLE_IN_2_66
235 GDateTime *g_bookmark_file_get_added_date_time (GBookmarkFile *bookmark,
238 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_modified_date_time)
239 void g_bookmark_file_set_modified (GBookmarkFile *bookmark,
242 GLIB_AVAILABLE_IN_2_66
243 void g_bookmark_file_set_modified_date_time (GBookmarkFile *bookmark,
245 GDateTime *modified);
246 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_modified_date_time)
247 time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark,
250 GLIB_AVAILABLE_IN_2_66
251 GDateTime *g_bookmark_file_get_modified_date_time (GBookmarkFile *bookmark,
254 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_visited_date_time)
255 void g_bookmark_file_set_visited (GBookmarkFile *bookmark,
258 GLIB_AVAILABLE_IN_2_66
259 void g_bookmark_file_set_visited_date_time (GBookmarkFile *bookmark,
262 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_visited_date_time)
263 time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark,
266 GLIB_AVAILABLE_IN_2_66
267 GDateTime *g_bookmark_file_get_visited_date_time (GBookmarkFile *bookmark,
270 GLIB_AVAILABLE_IN_ALL
271 gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark,
273 GLIB_AVAILABLE_IN_ALL
274 gint g_bookmark_file_get_size (GBookmarkFile *bookmark);
275 GLIB_AVAILABLE_IN_ALL
276 gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark,
278 GLIB_AVAILABLE_IN_ALL
279 gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark,
283 GLIB_AVAILABLE_IN_ALL
284 gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark,
288 GLIB_AVAILABLE_IN_ALL
289 gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark,
292 GLIB_AVAILABLE_IN_ALL
293 gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark,
294 const gchar *old_uri,
295 const gchar *new_uri,
300 #endif /* __G_BOOKMARK_FILE_H__ */