Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:41:59

0001 /* gbookmarkfile.h: parsing and building desktop bookmarks
0002  *
0003  * Copyright (C) 2005-2006 Emmanuele Bassi
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public License
0018  * along with this library; if not, see <http://www.gnu.org/licenses/>.
0019  */
0020 
0021 #ifndef __G_BOOKMARK_FILE_H__
0022 #define __G_BOOKMARK_FILE_H__
0023 
0024 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0025 #error "Only <glib.h> can be included directly."
0026 #endif
0027 
0028 #include <glib/gdatetime.h>
0029 #include <glib/gerror.h>
0030 #include <time.h>
0031 
0032 G_BEGIN_DECLS
0033 
0034 /**
0035  * G_BOOKMARK_FILE_ERROR:
0036  *
0037  * Error domain for bookmark file parsing.
0038  *
0039  * Errors in this domain will be from the #GBookmarkFileError
0040  * enumeration. See #GError for information on error domains.
0041  */
0042 #define G_BOOKMARK_FILE_ERROR   (g_bookmark_file_error_quark ())
0043 
0044 
0045 /**
0046  * GBookmarkFileError:
0047  * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed
0048  * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found
0049  * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did
0050  *     not register a bookmark
0051  * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found
0052  * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed
0053  * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was
0054  *     in an unknown encoding
0055  * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing
0056  * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found
0057  *
0058  * Error codes returned by bookmark file parsing.
0059  */
0060 typedef enum
0061 {
0062   G_BOOKMARK_FILE_ERROR_INVALID_URI,
0063   G_BOOKMARK_FILE_ERROR_INVALID_VALUE,
0064   G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,
0065   G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
0066   G_BOOKMARK_FILE_ERROR_READ,
0067   G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,
0068   G_BOOKMARK_FILE_ERROR_WRITE,
0069   G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
0070 } GBookmarkFileError;
0071 
0072 GLIB_AVAILABLE_IN_ALL
0073 GQuark g_bookmark_file_error_quark (void);
0074 
0075 /**
0076  * GBookmarkFile:
0077  *
0078  * An opaque data structure representing a set of bookmarks.
0079  */
0080 typedef struct _GBookmarkFile GBookmarkFile;
0081 
0082 GLIB_AVAILABLE_IN_ALL
0083 GBookmarkFile *g_bookmark_file_new                 (void);
0084 GLIB_AVAILABLE_IN_ALL
0085 void           g_bookmark_file_free                (GBookmarkFile  *bookmark);
0086 
0087 GLIB_AVAILABLE_IN_2_76
0088 GBookmarkFile *g_bookmark_file_copy                (GBookmarkFile  *bookmark);
0089 
0090 GLIB_AVAILABLE_IN_ALL
0091 gboolean       g_bookmark_file_load_from_file      (GBookmarkFile  *bookmark,
0092                             const gchar    *filename,
0093                             GError        **error);
0094 GLIB_AVAILABLE_IN_ALL
0095 gboolean       g_bookmark_file_load_from_data      (GBookmarkFile  *bookmark,
0096                             const gchar    *data,
0097                             gsize           length,
0098                             GError        **error);
0099 GLIB_AVAILABLE_IN_ALL
0100 gboolean       g_bookmark_file_load_from_data_dirs (GBookmarkFile  *bookmark,
0101                             const gchar    *file,
0102                             gchar         **full_path,
0103                             GError        **error);
0104 GLIB_AVAILABLE_IN_ALL
0105 gchar *        g_bookmark_file_to_data             (GBookmarkFile  *bookmark,
0106                             gsize          *length,
0107                             GError        **error) G_GNUC_MALLOC;
0108 GLIB_AVAILABLE_IN_ALL
0109 gboolean       g_bookmark_file_to_file             (GBookmarkFile  *bookmark,
0110                             const gchar    *filename,
0111                             GError        **error);
0112 
0113 GLIB_AVAILABLE_IN_ALL
0114 void           g_bookmark_file_set_title           (GBookmarkFile  *bookmark,
0115                             const gchar    *uri,
0116                             const gchar    *title);
0117 GLIB_AVAILABLE_IN_ALL
0118 gchar *        g_bookmark_file_get_title           (GBookmarkFile  *bookmark,
0119                             const gchar    *uri,
0120                             GError        **error) G_GNUC_MALLOC;
0121 GLIB_AVAILABLE_IN_ALL
0122 void           g_bookmark_file_set_description     (GBookmarkFile  *bookmark,
0123                             const gchar    *uri,
0124                             const gchar    *description);
0125 GLIB_AVAILABLE_IN_ALL
0126 gchar *        g_bookmark_file_get_description     (GBookmarkFile  *bookmark,
0127                             const gchar    *uri,
0128                             GError        **error) G_GNUC_MALLOC;
0129 GLIB_AVAILABLE_IN_ALL
0130 void           g_bookmark_file_set_mime_type       (GBookmarkFile  *bookmark,
0131                             const gchar    *uri,
0132                             const gchar    *mime_type);
0133 GLIB_AVAILABLE_IN_ALL
0134 gchar *        g_bookmark_file_get_mime_type       (GBookmarkFile  *bookmark,
0135                             const gchar    *uri,
0136                             GError        **error) G_GNUC_MALLOC;
0137 GLIB_AVAILABLE_IN_ALL
0138 void           g_bookmark_file_set_groups          (GBookmarkFile  *bookmark,
0139                             const gchar    *uri,
0140                             const gchar   **groups,
0141                             gsize           length);
0142 GLIB_AVAILABLE_IN_ALL
0143 void           g_bookmark_file_add_group           (GBookmarkFile  *bookmark,
0144                             const gchar    *uri,
0145                             const gchar    *group);
0146 GLIB_AVAILABLE_IN_ALL
0147 gboolean       g_bookmark_file_has_group           (GBookmarkFile  *bookmark,
0148                             const gchar    *uri,
0149                             const gchar    *group,
0150                             GError        **error);
0151 GLIB_AVAILABLE_IN_ALL
0152 gchar **       g_bookmark_file_get_groups          (GBookmarkFile  *bookmark,
0153                             const gchar    *uri,
0154                             gsize          *length,
0155                             GError        **error);
0156 GLIB_AVAILABLE_IN_ALL
0157 void           g_bookmark_file_add_application     (GBookmarkFile  *bookmark,
0158                             const gchar    *uri,
0159                             const gchar    *name,
0160                             const gchar    *exec);
0161 GLIB_AVAILABLE_IN_ALL
0162 gboolean       g_bookmark_file_has_application     (GBookmarkFile  *bookmark,
0163                             const gchar    *uri,
0164                             const gchar    *name,
0165                             GError        **error);
0166 GLIB_AVAILABLE_IN_ALL
0167 gchar **       g_bookmark_file_get_applications    (GBookmarkFile  *bookmark,
0168                             const gchar    *uri,
0169                             gsize          *length,
0170                             GError        **error);
0171 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_application_info)
0172 gboolean       g_bookmark_file_set_app_info        (GBookmarkFile  *bookmark,
0173                             const gchar    *uri,
0174                             const gchar    *name,
0175                             const gchar    *exec,
0176                             gint            count,
0177                             time_t          stamp,
0178                             GError        **error);
0179 GLIB_AVAILABLE_IN_2_66
0180 gboolean       g_bookmark_file_set_application_info (GBookmarkFile  *bookmark,
0181                                                      const char     *uri,
0182                                                      const char     *name,
0183                                                      const char     *exec,
0184                                                      int             count,
0185                                                      GDateTime      *stamp,
0186                                                      GError        **error);
0187 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_application_info)
0188 gboolean       g_bookmark_file_get_app_info        (GBookmarkFile  *bookmark,
0189                             const gchar    *uri,
0190                             const gchar    *name,
0191                             gchar         **exec,
0192                             guint          *count,
0193                             time_t         *stamp,
0194                             GError        **error);
0195 GLIB_AVAILABLE_IN_2_66
0196 gboolean       g_bookmark_file_get_application_info (GBookmarkFile  *bookmark,
0197                                                      const char     *uri,
0198                                                      const char     *name,
0199                                                      char          **exec,
0200                                                      unsigned int   *count,
0201                                                      GDateTime     **stamp,
0202                                                      GError        **error);
0203 GLIB_AVAILABLE_IN_ALL
0204 void           g_bookmark_file_set_is_private      (GBookmarkFile  *bookmark,
0205                             const gchar    *uri,
0206                             gboolean        is_private);
0207 GLIB_AVAILABLE_IN_ALL
0208 gboolean       g_bookmark_file_get_is_private      (GBookmarkFile  *bookmark,
0209                             const gchar    *uri,
0210                             GError        **error);
0211 GLIB_AVAILABLE_IN_ALL
0212 void           g_bookmark_file_set_icon            (GBookmarkFile  *bookmark,
0213                             const gchar    *uri,
0214                             const gchar    *href,
0215                             const gchar    *mime_type);
0216 GLIB_AVAILABLE_IN_ALL
0217 gboolean       g_bookmark_file_get_icon            (GBookmarkFile  *bookmark,
0218                             const gchar    *uri,
0219                             gchar         **href,
0220                             gchar         **mime_type,
0221                             GError        **error);
0222 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_added_date_time)
0223 void           g_bookmark_file_set_added           (GBookmarkFile  *bookmark,
0224                             const gchar    *uri,
0225                             time_t          added);
0226 GLIB_AVAILABLE_IN_2_66
0227 void           g_bookmark_file_set_added_date_time (GBookmarkFile  *bookmark,
0228                                                     const char     *uri,
0229                                                     GDateTime      *added);
0230 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_added_date_time)
0231 time_t         g_bookmark_file_get_added           (GBookmarkFile  *bookmark,
0232                             const gchar    *uri,
0233                             GError        **error);
0234 GLIB_AVAILABLE_IN_2_66
0235 GDateTime     *g_bookmark_file_get_added_date_time (GBookmarkFile  *bookmark,
0236                                                     const char     *uri,
0237                                                     GError        **error);
0238 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_modified_date_time)
0239 void           g_bookmark_file_set_modified        (GBookmarkFile  *bookmark,
0240                             const gchar    *uri,
0241                             time_t          modified);
0242 GLIB_AVAILABLE_IN_2_66
0243 void           g_bookmark_file_set_modified_date_time (GBookmarkFile  *bookmark,
0244                                                        const char     *uri,
0245                                                        GDateTime      *modified);
0246 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_modified_date_time)
0247 time_t         g_bookmark_file_get_modified        (GBookmarkFile  *bookmark,
0248                             const gchar    *uri,
0249                             GError        **error);
0250 GLIB_AVAILABLE_IN_2_66
0251 GDateTime     *g_bookmark_file_get_modified_date_time (GBookmarkFile  *bookmark,
0252                                                        const char     *uri,
0253                                                        GError        **error);
0254 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_visited_date_time)
0255 void           g_bookmark_file_set_visited         (GBookmarkFile  *bookmark,
0256                             const gchar    *uri,
0257                             time_t          visited);
0258 GLIB_AVAILABLE_IN_2_66
0259 void           g_bookmark_file_set_visited_date_time (GBookmarkFile  *bookmark,
0260                                                       const char     *uri,
0261                                                       GDateTime      *visited);
0262 GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_visited_date_time)
0263 time_t         g_bookmark_file_get_visited         (GBookmarkFile  *bookmark,
0264                             const gchar    *uri, 
0265                             GError        **error);
0266 GLIB_AVAILABLE_IN_2_66
0267 GDateTime     *g_bookmark_file_get_visited_date_time (GBookmarkFile  *bookmark,
0268                                                       const char     *uri,
0269                                                       GError        **error);
0270 GLIB_AVAILABLE_IN_ALL
0271 gboolean       g_bookmark_file_has_item            (GBookmarkFile  *bookmark,
0272                             const gchar    *uri);
0273 GLIB_AVAILABLE_IN_ALL
0274 gint           g_bookmark_file_get_size            (GBookmarkFile  *bookmark);
0275 GLIB_AVAILABLE_IN_ALL
0276 gchar **       g_bookmark_file_get_uris            (GBookmarkFile  *bookmark,
0277                             gsize          *length);
0278 GLIB_AVAILABLE_IN_ALL
0279 gboolean       g_bookmark_file_remove_group        (GBookmarkFile  *bookmark,
0280                             const gchar    *uri,
0281                             const gchar    *group,
0282                             GError        **error);
0283 GLIB_AVAILABLE_IN_ALL
0284 gboolean       g_bookmark_file_remove_application  (GBookmarkFile  *bookmark,
0285                             const gchar    *uri,
0286                             const gchar    *name,
0287                             GError        **error);
0288 GLIB_AVAILABLE_IN_ALL
0289 gboolean       g_bookmark_file_remove_item         (GBookmarkFile  *bookmark,
0290                             const gchar    *uri,
0291                             GError        **error);
0292 GLIB_AVAILABLE_IN_ALL
0293 gboolean       g_bookmark_file_move_item           (GBookmarkFile  *bookmark,
0294                             const gchar    *old_uri,
0295                             const gchar    *new_uri,
0296                             GError        **error);
0297 
0298 G_END_DECLS
0299 
0300 #endif /* __G_BOOKMARK_FILE_H__ */