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 Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 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 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 #ifndef __G_BOOKMARK_FILE_H__
21 #define __G_BOOKMARK_FILE_H__
23 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
24 #error "Only <glib.h> can be included directly."
27 #include <glib/gerror.h>
33 * G_BOOKMARK_FILE_ERROR:
35 * Error domain for bookmark file parsing.
36 * Errors in this domain will be from the #GBookmarkFileError
37 * enumeration. See #GError for information on error domains.
39 #define G_BOOKMARK_FILE_ERROR (g_bookmark_file_error_quark ())
44 * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed
45 * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found
46 * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did
47 * not register a bookmark
48 * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found
49 * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed
50 * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was
51 * in an unknown encoding
52 * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing
53 * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found
55 * Error codes returned by bookmark file parsing.
59 G_BOOKMARK_FILE_ERROR_INVALID_URI,
60 G_BOOKMARK_FILE_ERROR_INVALID_VALUE,
61 G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,
62 G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
63 G_BOOKMARK_FILE_ERROR_READ,
64 G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,
65 G_BOOKMARK_FILE_ERROR_WRITE,
66 G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
70 GQuark g_bookmark_file_error_quark (void);
75 * The <structname>GBookmarkFile</structname> struct contains only
76 * private data and should not be directly accessed.
78 typedef struct _GBookmarkFile GBookmarkFile;
81 GBookmarkFile *g_bookmark_file_new (void);
83 void g_bookmark_file_free (GBookmarkFile *bookmark);
86 gboolean g_bookmark_file_load_from_file (GBookmarkFile *bookmark,
87 const gchar *filename,
90 gboolean g_bookmark_file_load_from_data (GBookmarkFile *bookmark,
95 gboolean g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark,
100 gchar * g_bookmark_file_to_data (GBookmarkFile *bookmark,
102 GError **error) G_GNUC_MALLOC;
103 GLIB_AVAILABLE_IN_ALL
104 gboolean g_bookmark_file_to_file (GBookmarkFile *bookmark,
105 const gchar *filename,
108 GLIB_AVAILABLE_IN_ALL
109 void g_bookmark_file_set_title (GBookmarkFile *bookmark,
112 GLIB_AVAILABLE_IN_ALL
113 gchar * g_bookmark_file_get_title (GBookmarkFile *bookmark,
115 GError **error) G_GNUC_MALLOC;
116 GLIB_AVAILABLE_IN_ALL
117 void g_bookmark_file_set_description (GBookmarkFile *bookmark,
119 const gchar *description);
120 GLIB_AVAILABLE_IN_ALL
121 gchar * g_bookmark_file_get_description (GBookmarkFile *bookmark,
123 GError **error) G_GNUC_MALLOC;
124 GLIB_AVAILABLE_IN_ALL
125 void g_bookmark_file_set_mime_type (GBookmarkFile *bookmark,
127 const gchar *mime_type);
128 GLIB_AVAILABLE_IN_ALL
129 gchar * g_bookmark_file_get_mime_type (GBookmarkFile *bookmark,
131 GError **error) G_GNUC_MALLOC;
132 GLIB_AVAILABLE_IN_ALL
133 void g_bookmark_file_set_groups (GBookmarkFile *bookmark,
135 const gchar **groups,
137 GLIB_AVAILABLE_IN_ALL
138 void g_bookmark_file_add_group (GBookmarkFile *bookmark,
141 GLIB_AVAILABLE_IN_ALL
142 gboolean g_bookmark_file_has_group (GBookmarkFile *bookmark,
146 GLIB_AVAILABLE_IN_ALL
147 gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark,
150 GError **error) G_GNUC_MALLOC;
151 GLIB_AVAILABLE_IN_ALL
152 void g_bookmark_file_add_application (GBookmarkFile *bookmark,
156 GLIB_AVAILABLE_IN_ALL
157 gboolean g_bookmark_file_has_application (GBookmarkFile *bookmark,
161 GLIB_AVAILABLE_IN_ALL
162 gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark,
165 GError **error) G_GNUC_MALLOC;
166 GLIB_AVAILABLE_IN_ALL
167 gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark,
174 GLIB_AVAILABLE_IN_ALL
175 gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark,
182 GLIB_AVAILABLE_IN_ALL
183 void g_bookmark_file_set_is_private (GBookmarkFile *bookmark,
185 gboolean is_private);
186 GLIB_AVAILABLE_IN_ALL
187 gboolean g_bookmark_file_get_is_private (GBookmarkFile *bookmark,
190 GLIB_AVAILABLE_IN_ALL
191 void g_bookmark_file_set_icon (GBookmarkFile *bookmark,
194 const gchar *mime_type);
195 GLIB_AVAILABLE_IN_ALL
196 gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark,
201 GLIB_AVAILABLE_IN_ALL
202 void g_bookmark_file_set_added (GBookmarkFile *bookmark,
205 GLIB_AVAILABLE_IN_ALL
206 time_t g_bookmark_file_get_added (GBookmarkFile *bookmark,
209 GLIB_AVAILABLE_IN_ALL
210 void g_bookmark_file_set_modified (GBookmarkFile *bookmark,
213 GLIB_AVAILABLE_IN_ALL
214 time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark,
217 GLIB_AVAILABLE_IN_ALL
218 void g_bookmark_file_set_visited (GBookmarkFile *bookmark,
221 GLIB_AVAILABLE_IN_ALL
222 time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark,
225 GLIB_AVAILABLE_IN_ALL
226 gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark,
228 GLIB_AVAILABLE_IN_ALL
229 gint g_bookmark_file_get_size (GBookmarkFile *bookmark);
230 GLIB_AVAILABLE_IN_ALL
231 gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark,
232 gsize *length) G_GNUC_MALLOC;
233 GLIB_AVAILABLE_IN_ALL
234 gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark,
238 GLIB_AVAILABLE_IN_ALL
239 gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark,
243 GLIB_AVAILABLE_IN_ALL
244 gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark,
247 GLIB_AVAILABLE_IN_ALL
248 gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark,
249 const gchar *old_uri,
250 const gchar *new_uri,
255 #endif /* __G_BOOKMARK_FILE_H__ */