1 /* gbookmarkfile.h: parsing and building desktop bookmarks
3 * Copyright (C) 2005-2006 Emmanuele Bassi
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef __G_BOOKMARK_FILE_H__
20 #define __G_BOOKMARK_FILE_H__
22 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
23 #error "Only <glib.h> can be included directly."
26 #include <glib/gerror.h>
32 * G_BOOKMARK_FILE_ERROR:
34 * Error domain for bookmark file parsing.
35 * Errors in this domain will be from the #GBookmarkFileError
36 * enumeration. See #GError for information on error domains.
38 #define G_BOOKMARK_FILE_ERROR (g_bookmark_file_error_quark ())
43 * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed
44 * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found
45 * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did
46 * not register a bookmark
47 * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found
48 * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed
49 * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was
50 * in an unknown encoding
51 * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing
52 * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found
54 * Error codes returned by bookmark file parsing.
58 G_BOOKMARK_FILE_ERROR_INVALID_URI
,
59 G_BOOKMARK_FILE_ERROR_INVALID_VALUE
,
60 G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED
,
61 G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND
,
62 G_BOOKMARK_FILE_ERROR_READ
,
63 G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING
,
64 G_BOOKMARK_FILE_ERROR_WRITE
,
65 G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
69 GQuark
g_bookmark_file_error_quark (void);
74 * The `GBookmarkFile` structure contains only
75 * private data and should not be directly accessed.
77 typedef struct _GBookmarkFile GBookmarkFile
;
80 GBookmarkFile
*g_bookmark_file_new (void);
82 void g_bookmark_file_free (GBookmarkFile
*bookmark
);
85 gboolean
g_bookmark_file_load_from_file (GBookmarkFile
*bookmark
,
86 const gchar
*filename
,
89 gboolean
g_bookmark_file_load_from_data (GBookmarkFile
*bookmark
,
94 gboolean
g_bookmark_file_load_from_data_dirs (GBookmarkFile
*bookmark
,
99 gchar
* g_bookmark_file_to_data (GBookmarkFile
*bookmark
,
101 GError
**error
) G_GNUC_MALLOC
;
102 GLIB_AVAILABLE_IN_ALL
103 gboolean
g_bookmark_file_to_file (GBookmarkFile
*bookmark
,
104 const gchar
*filename
,
107 GLIB_AVAILABLE_IN_ALL
108 void g_bookmark_file_set_title (GBookmarkFile
*bookmark
,
111 GLIB_AVAILABLE_IN_ALL
112 gchar
* g_bookmark_file_get_title (GBookmarkFile
*bookmark
,
114 GError
**error
) G_GNUC_MALLOC
;
115 GLIB_AVAILABLE_IN_ALL
116 void g_bookmark_file_set_description (GBookmarkFile
*bookmark
,
118 const gchar
*description
);
119 GLIB_AVAILABLE_IN_ALL
120 gchar
* g_bookmark_file_get_description (GBookmarkFile
*bookmark
,
122 GError
**error
) G_GNUC_MALLOC
;
123 GLIB_AVAILABLE_IN_ALL
124 void g_bookmark_file_set_mime_type (GBookmarkFile
*bookmark
,
126 const gchar
*mime_type
);
127 GLIB_AVAILABLE_IN_ALL
128 gchar
* g_bookmark_file_get_mime_type (GBookmarkFile
*bookmark
,
130 GError
**error
) G_GNUC_MALLOC
;
131 GLIB_AVAILABLE_IN_ALL
132 void g_bookmark_file_set_groups (GBookmarkFile
*bookmark
,
134 const gchar
**groups
,
136 GLIB_AVAILABLE_IN_ALL
137 void g_bookmark_file_add_group (GBookmarkFile
*bookmark
,
140 GLIB_AVAILABLE_IN_ALL
141 gboolean
g_bookmark_file_has_group (GBookmarkFile
*bookmark
,
145 GLIB_AVAILABLE_IN_ALL
146 gchar
** g_bookmark_file_get_groups (GBookmarkFile
*bookmark
,
149 GError
**error
) G_GNUC_MALLOC
;
150 GLIB_AVAILABLE_IN_ALL
151 void g_bookmark_file_add_application (GBookmarkFile
*bookmark
,
155 GLIB_AVAILABLE_IN_ALL
156 gboolean
g_bookmark_file_has_application (GBookmarkFile
*bookmark
,
160 GLIB_AVAILABLE_IN_ALL
161 gchar
** g_bookmark_file_get_applications (GBookmarkFile
*bookmark
,
164 GError
**error
) G_GNUC_MALLOC
;
165 GLIB_AVAILABLE_IN_ALL
166 gboolean
g_bookmark_file_set_app_info (GBookmarkFile
*bookmark
,
173 GLIB_AVAILABLE_IN_ALL
174 gboolean
g_bookmark_file_get_app_info (GBookmarkFile
*bookmark
,
181 GLIB_AVAILABLE_IN_ALL
182 void g_bookmark_file_set_is_private (GBookmarkFile
*bookmark
,
184 gboolean is_private
);
185 GLIB_AVAILABLE_IN_ALL
186 gboolean
g_bookmark_file_get_is_private (GBookmarkFile
*bookmark
,
189 GLIB_AVAILABLE_IN_ALL
190 void g_bookmark_file_set_icon (GBookmarkFile
*bookmark
,
193 const gchar
*mime_type
);
194 GLIB_AVAILABLE_IN_ALL
195 gboolean
g_bookmark_file_get_icon (GBookmarkFile
*bookmark
,
200 GLIB_AVAILABLE_IN_ALL
201 void g_bookmark_file_set_added (GBookmarkFile
*bookmark
,
204 GLIB_AVAILABLE_IN_ALL
205 time_t g_bookmark_file_get_added (GBookmarkFile
*bookmark
,
208 GLIB_AVAILABLE_IN_ALL
209 void g_bookmark_file_set_modified (GBookmarkFile
*bookmark
,
212 GLIB_AVAILABLE_IN_ALL
213 time_t g_bookmark_file_get_modified (GBookmarkFile
*bookmark
,
216 GLIB_AVAILABLE_IN_ALL
217 void g_bookmark_file_set_visited (GBookmarkFile
*bookmark
,
220 GLIB_AVAILABLE_IN_ALL
221 time_t g_bookmark_file_get_visited (GBookmarkFile
*bookmark
,
224 GLIB_AVAILABLE_IN_ALL
225 gboolean
g_bookmark_file_has_item (GBookmarkFile
*bookmark
,
227 GLIB_AVAILABLE_IN_ALL
228 gint
g_bookmark_file_get_size (GBookmarkFile
*bookmark
);
229 GLIB_AVAILABLE_IN_ALL
230 gchar
** g_bookmark_file_get_uris (GBookmarkFile
*bookmark
,
231 gsize
*length
) G_GNUC_MALLOC
;
232 GLIB_AVAILABLE_IN_ALL
233 gboolean
g_bookmark_file_remove_group (GBookmarkFile
*bookmark
,
237 GLIB_AVAILABLE_IN_ALL
238 gboolean
g_bookmark_file_remove_application (GBookmarkFile
*bookmark
,
242 GLIB_AVAILABLE_IN_ALL
243 gboolean
g_bookmark_file_remove_item (GBookmarkFile
*bookmark
,
246 GLIB_AVAILABLE_IN_ALL
247 gboolean
g_bookmark_file_move_item (GBookmarkFile
*bookmark
,
248 const gchar
*old_uri
,
249 const gchar
*new_uri
,
254 #endif /* __G_BOOKMARK_FILE_H__ */