GApplication: parse command line options
[platform/upstream/glib.git] / glib / gbookmarkfile.h
1 /* gbookmarkfile.h: parsing and building desktop bookmarks
2  *
3  * Copyright (C) 2005-2006 Emmanuele Bassi
4  *
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.
9  *
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.
14  *
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,
18  */
19
20 #ifndef __G_BOOKMARK_FILE_H__
21 #define __G_BOOKMARK_FILE_H__
22
23 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
24 #error "Only <glib.h> can be included directly."
25 #endif
26
27 #include <glib/gerror.h>
28 #include <time.h>
29
30 G_BEGIN_DECLS
31
32 /**
33  * G_BOOKMARK_FILE_ERROR:
34  *
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.
38  */
39 #define G_BOOKMARK_FILE_ERROR   (g_bookmark_file_error_quark ())
40
41
42 /**
43  * GBookmarkFileError:
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
54  *
55  * Error codes returned by bookmark file parsing.
56  */
57 typedef enum
58 {
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
67 } GBookmarkFileError;
68
69 GLIB_AVAILABLE_IN_ALL
70 GQuark g_bookmark_file_error_quark (void);
71
72 /**
73  * GBookmarkFile:
74  *
75  * The <structname>GBookmarkFile</structname> struct contains only
76  * private data and should not be directly accessed.
77  */
78 typedef struct _GBookmarkFile GBookmarkFile;
79
80 GLIB_AVAILABLE_IN_ALL
81 GBookmarkFile *g_bookmark_file_new                 (void);
82 GLIB_AVAILABLE_IN_ALL
83 void           g_bookmark_file_free                (GBookmarkFile  *bookmark);
84
85 GLIB_AVAILABLE_IN_ALL
86 gboolean       g_bookmark_file_load_from_file      (GBookmarkFile  *bookmark,
87                                                     const gchar    *filename,
88                                                     GError        **error);
89 GLIB_AVAILABLE_IN_ALL
90 gboolean       g_bookmark_file_load_from_data      (GBookmarkFile  *bookmark,
91                                                     const gchar    *data,
92                                                     gsize           length,
93                                                     GError        **error);
94 GLIB_AVAILABLE_IN_ALL
95 gboolean       g_bookmark_file_load_from_data_dirs (GBookmarkFile  *bookmark,
96                                                     const gchar    *file,
97                                                     gchar         **full_path,
98                                                     GError        **error);
99 GLIB_AVAILABLE_IN_ALL
100 gchar *        g_bookmark_file_to_data             (GBookmarkFile  *bookmark,
101                                                     gsize          *length,
102                                                     GError        **error) G_GNUC_MALLOC;
103 GLIB_AVAILABLE_IN_ALL
104 gboolean       g_bookmark_file_to_file             (GBookmarkFile  *bookmark,
105                                                     const gchar    *filename,
106                                                     GError        **error);
107
108 GLIB_AVAILABLE_IN_ALL
109 void           g_bookmark_file_set_title           (GBookmarkFile  *bookmark,
110                                                     const gchar    *uri,
111                                                     const gchar    *title);
112 GLIB_AVAILABLE_IN_ALL
113 gchar *        g_bookmark_file_get_title           (GBookmarkFile  *bookmark,
114                                                     const gchar    *uri,
115                                                     GError        **error) G_GNUC_MALLOC;
116 GLIB_AVAILABLE_IN_ALL
117 void           g_bookmark_file_set_description     (GBookmarkFile  *bookmark,
118                                                     const gchar    *uri,
119                                                     const gchar    *description);
120 GLIB_AVAILABLE_IN_ALL
121 gchar *        g_bookmark_file_get_description     (GBookmarkFile  *bookmark,
122                                                     const gchar    *uri,
123                                                     GError        **error) G_GNUC_MALLOC;
124 GLIB_AVAILABLE_IN_ALL
125 void           g_bookmark_file_set_mime_type       (GBookmarkFile  *bookmark,
126                                                     const gchar    *uri,
127                                                     const gchar    *mime_type);
128 GLIB_AVAILABLE_IN_ALL
129 gchar *        g_bookmark_file_get_mime_type       (GBookmarkFile  *bookmark,
130                                                     const gchar    *uri,
131                                                     GError        **error) G_GNUC_MALLOC;
132 GLIB_AVAILABLE_IN_ALL
133 void           g_bookmark_file_set_groups          (GBookmarkFile  *bookmark,
134                                                     const gchar    *uri,
135                                                     const gchar   **groups,
136                                                     gsize           length);
137 GLIB_AVAILABLE_IN_ALL
138 void           g_bookmark_file_add_group           (GBookmarkFile  *bookmark,
139                                                     const gchar    *uri,
140                                                     const gchar    *group);
141 GLIB_AVAILABLE_IN_ALL
142 gboolean       g_bookmark_file_has_group           (GBookmarkFile  *bookmark,
143                                                     const gchar    *uri,
144                                                     const gchar    *group,
145                                                     GError        **error);
146 GLIB_AVAILABLE_IN_ALL
147 gchar **       g_bookmark_file_get_groups          (GBookmarkFile  *bookmark,
148                                                     const gchar    *uri,
149                                                     gsize          *length,
150                                                     GError        **error) G_GNUC_MALLOC;
151 GLIB_AVAILABLE_IN_ALL
152 void           g_bookmark_file_add_application     (GBookmarkFile  *bookmark,
153                                                     const gchar    *uri,
154                                                     const gchar    *name,
155                                                     const gchar    *exec);
156 GLIB_AVAILABLE_IN_ALL
157 gboolean       g_bookmark_file_has_application     (GBookmarkFile  *bookmark,
158                                                     const gchar    *uri,
159                                                     const gchar    *name,
160                                                     GError        **error);
161 GLIB_AVAILABLE_IN_ALL
162 gchar **       g_bookmark_file_get_applications    (GBookmarkFile  *bookmark,
163                                                     const gchar    *uri,
164                                                     gsize          *length,
165                                                     GError        **error) G_GNUC_MALLOC;
166 GLIB_AVAILABLE_IN_ALL
167 gboolean       g_bookmark_file_set_app_info        (GBookmarkFile  *bookmark,
168                                                     const gchar    *uri,
169                                                     const gchar    *name,
170                                                     const gchar    *exec,
171                                                     gint            count,
172                                                     time_t          stamp,
173                                                     GError        **error);
174 GLIB_AVAILABLE_IN_ALL
175 gboolean       g_bookmark_file_get_app_info        (GBookmarkFile  *bookmark,
176                                                     const gchar    *uri,
177                                                     const gchar    *name,
178                                                     gchar         **exec,
179                                                     guint          *count,
180                                                     time_t         *stamp,
181                                                     GError        **error);
182 GLIB_AVAILABLE_IN_ALL
183 void           g_bookmark_file_set_is_private      (GBookmarkFile  *bookmark,
184                                                     const gchar    *uri,
185                                                     gboolean        is_private);
186 GLIB_AVAILABLE_IN_ALL
187 gboolean       g_bookmark_file_get_is_private      (GBookmarkFile  *bookmark,
188                                                     const gchar    *uri,
189                                                     GError        **error);
190 GLIB_AVAILABLE_IN_ALL
191 void           g_bookmark_file_set_icon            (GBookmarkFile  *bookmark,
192                                                     const gchar    *uri,
193                                                     const gchar    *href,
194                                                     const gchar    *mime_type);
195 GLIB_AVAILABLE_IN_ALL
196 gboolean       g_bookmark_file_get_icon            (GBookmarkFile  *bookmark,
197                                                     const gchar    *uri,
198                                                     gchar         **href,
199                                                     gchar         **mime_type,
200                                                     GError        **error);
201 GLIB_AVAILABLE_IN_ALL
202 void           g_bookmark_file_set_added           (GBookmarkFile  *bookmark,
203                                                     const gchar    *uri,
204                                                     time_t          added);
205 GLIB_AVAILABLE_IN_ALL
206 time_t         g_bookmark_file_get_added           (GBookmarkFile  *bookmark,
207                                                     const gchar    *uri,
208                                                     GError        **error);
209 GLIB_AVAILABLE_IN_ALL
210 void           g_bookmark_file_set_modified        (GBookmarkFile  *bookmark,
211                                                     const gchar    *uri,
212                                                     time_t          modified);
213 GLIB_AVAILABLE_IN_ALL
214 time_t         g_bookmark_file_get_modified        (GBookmarkFile  *bookmark,
215                                                     const gchar    *uri,
216                                                     GError        **error);
217 GLIB_AVAILABLE_IN_ALL
218 void           g_bookmark_file_set_visited         (GBookmarkFile  *bookmark,
219                                                     const gchar    *uri,
220                                                     time_t          visited);
221 GLIB_AVAILABLE_IN_ALL
222 time_t         g_bookmark_file_get_visited         (GBookmarkFile  *bookmark,
223                                                     const gchar    *uri, 
224                                                     GError        **error);
225 GLIB_AVAILABLE_IN_ALL
226 gboolean       g_bookmark_file_has_item            (GBookmarkFile  *bookmark,
227                                                     const gchar    *uri);
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,
235                                                     const gchar    *uri,
236                                                     const gchar    *group,
237                                                     GError        **error);
238 GLIB_AVAILABLE_IN_ALL
239 gboolean       g_bookmark_file_remove_application  (GBookmarkFile  *bookmark,
240                                                     const gchar    *uri,
241                                                     const gchar    *name,
242                                                     GError        **error);
243 GLIB_AVAILABLE_IN_ALL
244 gboolean       g_bookmark_file_remove_item         (GBookmarkFile  *bookmark,
245                                                     const gchar    *uri,
246                                                     GError        **error);
247 GLIB_AVAILABLE_IN_ALL
248 gboolean       g_bookmark_file_move_item           (GBookmarkFile  *bookmark,
249                                                     const gchar    *old_uri,
250                                                     const gchar    *new_uri,
251                                                     GError        **error);
252
253 G_END_DECLS
254
255 #endif /* __G_BOOKMARK_FILE_H__ */