| 
sl@0
 | 
     1  | 
/* gbookmarkfile.h: parsing and building desktop bookmarks
  | 
| 
sl@0
 | 
     2  | 
 *
  | 
| 
sl@0
 | 
     3  | 
 * Copyright (C) 2005-2006 Emmanuele Bassi
  | 
| 
sl@0
 | 
     4  | 
 * Portions copyright (c) 2009 Nokia Corporation.  All rights reserved.
  | 
| 
sl@0
 | 
     5  | 
 * This library is free software; you can redistribute it and/or
  | 
| 
sl@0
 | 
     6  | 
 * modify it under the terms of the GNU Library General Public
  | 
| 
sl@0
 | 
     7  | 
 * License as published by the Free Software Foundation; either
  | 
| 
sl@0
 | 
     8  | 
 * version 2 of the License, or (at your option) any later version.
  | 
| 
sl@0
 | 
     9  | 
 *
  | 
| 
sl@0
 | 
    10  | 
 * This library is distributed in the hope that it will be useful,
  | 
| 
sl@0
 | 
    11  | 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
| 
sl@0
 | 
    12  | 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  | 
| 
sl@0
 | 
    13  | 
 * Library General Public License for more details.
  | 
| 
sl@0
 | 
    14  | 
 *
  | 
| 
sl@0
 | 
    15  | 
 * You should have received a copy of the GNU Library General Public
  | 
| 
sl@0
 | 
    16  | 
 * License along with this library; if not, write to the
  | 
| 
sl@0
 | 
    17  | 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  | 
| 
sl@0
 | 
    18  | 
 */
  | 
| 
sl@0
 | 
    19  | 
  | 
| 
sl@0
 | 
    20  | 
#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  | 
| 
sl@0
 | 
    21  | 
#error "Only <glib.h> can be included directly."
  | 
| 
sl@0
 | 
    22  | 
#endif
  | 
| 
sl@0
 | 
    23  | 
  | 
| 
sl@0
 | 
    24  | 
#ifndef __G_BOOKMARK_FILE_H__
  | 
| 
sl@0
 | 
    25  | 
#define __G_BOOKMARK_FILE_H__
  | 
| 
sl@0
 | 
    26  | 
  | 
| 
sl@0
 | 
    27  | 
#include <glib/gerror.h>
  | 
| 
sl@0
 | 
    28  | 
#include <time.h>
  | 
| 
sl@0
 | 
    29  | 
  | 
| 
sl@0
 | 
    30  | 
G_BEGIN_DECLS
  | 
| 
sl@0
 | 
    31  | 
  | 
| 
sl@0
 | 
    32  | 
/* GError enumeration
  | 
| 
sl@0
 | 
    33  | 
 */
  | 
| 
sl@0
 | 
    34  | 
#define G_BOOKMARK_FILE_ERROR	(g_bookmark_file_error_quark ())
  | 
| 
sl@0
 | 
    35  | 
  | 
| 
sl@0
 | 
    36  | 
typedef enum
  | 
| 
sl@0
 | 
    37  | 
{
 | 
| 
sl@0
 | 
    38  | 
  G_BOOKMARK_FILE_ERROR_INVALID_URI,
  | 
| 
sl@0
 | 
    39  | 
  G_BOOKMARK_FILE_ERROR_INVALID_VALUE,
  | 
| 
sl@0
 | 
    40  | 
  G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,
  | 
| 
sl@0
 | 
    41  | 
  G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
  | 
| 
sl@0
 | 
    42  | 
  G_BOOKMARK_FILE_ERROR_READ,
  | 
| 
sl@0
 | 
    43  | 
  G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,
  | 
| 
sl@0
 | 
    44  | 
  G_BOOKMARK_FILE_ERROR_WRITE,
  | 
| 
sl@0
 | 
    45  | 
  G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
  | 
| 
sl@0
 | 
    46  | 
} GBookmarkFileError;
  | 
| 
sl@0
 | 
    47  | 
  | 
| 
sl@0
 | 
    48  | 
IMPORT_C GQuark g_bookmark_file_error_quark (void);
  | 
| 
sl@0
 | 
    49  | 
  | 
| 
sl@0
 | 
    50  | 
/*
  | 
| 
sl@0
 | 
    51  | 
 * GBookmarkFile
  | 
| 
sl@0
 | 
    52  | 
 */
  | 
| 
sl@0
 | 
    53  | 
typedef struct _GBookmarkFile GBookmarkFile;
  | 
| 
sl@0
 | 
    54  | 
  | 
| 
sl@0
 | 
    55  | 
IMPORT_C GBookmarkFile *g_bookmark_file_new                 (void);
  | 
| 
sl@0
 | 
    56  | 
IMPORT_C void           g_bookmark_file_free                (GBookmarkFile  *bookmark);
  | 
| 
sl@0
 | 
    57  | 
  | 
| 
sl@0
 | 
    58  | 
IMPORT_C gboolean       g_bookmark_file_load_from_file      (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    59  | 
						    const gchar    *filename,
  | 
| 
sl@0
 | 
    60  | 
						    GError        **error);
  | 
| 
sl@0
 | 
    61  | 
IMPORT_C gboolean       g_bookmark_file_load_from_data      (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    62  | 
						    const gchar    *data,
  | 
| 
sl@0
 | 
    63  | 
						    gsize           length,
  | 
| 
sl@0
 | 
    64  | 
						    GError        **error);
  | 
| 
sl@0
 | 
    65  | 
IMPORT_C gboolean       g_bookmark_file_load_from_data_dirs (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    66  | 
						    const gchar    *file,
  | 
| 
sl@0
 | 
    67  | 
						    gchar         **full_path,
  | 
| 
sl@0
 | 
    68  | 
						    GError        **error);
  | 
| 
sl@0
 | 
    69  | 
IMPORT_C gchar *        g_bookmark_file_to_data             (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    70  | 
						    gsize          *length,
  | 
| 
sl@0
 | 
    71  | 
						    GError        **error) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
    72  | 
IMPORT_C gboolean       g_bookmark_file_to_file             (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    73  | 
						    const gchar    *filename,
  | 
| 
sl@0
 | 
    74  | 
						    GError        **error);
  | 
| 
sl@0
 | 
    75  | 
  | 
| 
sl@0
 | 
    76  | 
IMPORT_C void           g_bookmark_file_set_title           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    77  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    78  | 
						    const gchar    *title);
  | 
| 
sl@0
 | 
    79  | 
IMPORT_C gchar *        g_bookmark_file_get_title           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    80  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    81  | 
						    GError        **error) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
    82  | 
IMPORT_C void           g_bookmark_file_set_description     (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    83  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    84  | 
						    const gchar    *description);
  | 
| 
sl@0
 | 
    85  | 
IMPORT_C gchar *        g_bookmark_file_get_description     (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    86  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    87  | 
						    GError        **error) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
    88  | 
IMPORT_C void           g_bookmark_file_set_mime_type       (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    89  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    90  | 
						    const gchar    *mime_type);
  | 
| 
sl@0
 | 
    91  | 
IMPORT_C gchar *        g_bookmark_file_get_mime_type       (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    92  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    93  | 
						    GError        **error) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
    94  | 
IMPORT_C void           g_bookmark_file_set_groups          (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    95  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
    96  | 
						    const gchar   **groups,
  | 
| 
sl@0
 | 
    97  | 
						    gsize           length);
  | 
| 
sl@0
 | 
    98  | 
IMPORT_C void           g_bookmark_file_add_group           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
    99  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   100  | 
						    const gchar    *group);
  | 
| 
sl@0
 | 
   101  | 
IMPORT_C gboolean       g_bookmark_file_has_group           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   102  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   103  | 
						    const gchar    *group,
  | 
| 
sl@0
 | 
   104  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   105  | 
IMPORT_C gchar **       g_bookmark_file_get_groups          (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   106  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   107  | 
						    gsize          *length,
  | 
| 
sl@0
 | 
   108  | 
						    GError        **error) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
   109  | 
IMPORT_C void           g_bookmark_file_add_application     (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   110  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   111  | 
						    const gchar    *name,
  | 
| 
sl@0
 | 
   112  | 
						    const gchar    *exec);
  | 
| 
sl@0
 | 
   113  | 
IMPORT_C gboolean       g_bookmark_file_has_application     (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   114  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   115  | 
						    const gchar    *name,
  | 
| 
sl@0
 | 
   116  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   117  | 
IMPORT_C gchar **       g_bookmark_file_get_applications    (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   118  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   119  | 
						    gsize          *length,
  | 
| 
sl@0
 | 
   120  | 
						    GError        **error) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
   121  | 
IMPORT_C gboolean       g_bookmark_file_set_app_info        (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   122  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   123  | 
						    const gchar    *name,
  | 
| 
sl@0
 | 
   124  | 
						    const gchar    *exec,
  | 
| 
sl@0
 | 
   125  | 
						    gint            count,
  | 
| 
sl@0
 | 
   126  | 
						    time_t          stamp,
  | 
| 
sl@0
 | 
   127  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   128  | 
IMPORT_C gboolean       g_bookmark_file_get_app_info        (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   129  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   130  | 
						    const gchar    *name,
  | 
| 
sl@0
 | 
   131  | 
						    gchar         **exec,
  | 
| 
sl@0
 | 
   132  | 
						    guint          *count,
  | 
| 
sl@0
 | 
   133  | 
						    time_t         *stamp,
  | 
| 
sl@0
 | 
   134  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   135  | 
IMPORT_C void           g_bookmark_file_set_is_private      (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   136  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   137  | 
						    gboolean        is_private);
  | 
| 
sl@0
 | 
   138  | 
IMPORT_C gboolean       g_bookmark_file_get_is_private      (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   139  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   140  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   141  | 
IMPORT_C void           g_bookmark_file_set_icon            (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   142  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   143  | 
						    const gchar    *href,
  | 
| 
sl@0
 | 
   144  | 
						    const gchar    *mime_type);
  | 
| 
sl@0
 | 
   145  | 
IMPORT_C gboolean       g_bookmark_file_get_icon            (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   146  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   147  | 
						    gchar         **href,
  | 
| 
sl@0
 | 
   148  | 
						    gchar         **mime_type,
  | 
| 
sl@0
 | 
   149  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   150  | 
IMPORT_C void           g_bookmark_file_set_added           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   151  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   152  | 
						    time_t          added);
  | 
| 
sl@0
 | 
   153  | 
IMPORT_C time_t         g_bookmark_file_get_added           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   154  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   155  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   156  | 
IMPORT_C void           g_bookmark_file_set_modified        (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   157  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   158  | 
						    time_t          modified);
  | 
| 
sl@0
 | 
   159  | 
IMPORT_C time_t         g_bookmark_file_get_modified        (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   160  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   161  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   162  | 
IMPORT_C void           g_bookmark_file_set_visited         (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   163  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   164  | 
						    time_t          visited);
  | 
| 
sl@0
 | 
   165  | 
IMPORT_C time_t         g_bookmark_file_get_visited         (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   166  | 
						    const gchar    *uri, 
  | 
| 
sl@0
 | 
   167  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   168  | 
IMPORT_C gboolean       g_bookmark_file_has_item            (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   169  | 
						    const gchar    *uri);
  | 
| 
sl@0
 | 
   170  | 
IMPORT_C gint           g_bookmark_file_get_size            (GBookmarkFile  *bookmark);
  | 
| 
sl@0
 | 
   171  | 
IMPORT_C gchar **       g_bookmark_file_get_uris            (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   172  | 
						    gsize          *length) G_GNUC_MALLOC;
  | 
| 
sl@0
 | 
   173  | 
IMPORT_C gboolean       g_bookmark_file_remove_group        (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   174  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   175  | 
						    const gchar    *group,
  | 
| 
sl@0
 | 
   176  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   177  | 
IMPORT_C gboolean       g_bookmark_file_remove_application  (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   178  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   179  | 
						    const gchar    *name,
  | 
| 
sl@0
 | 
   180  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   181  | 
IMPORT_C gboolean       g_bookmark_file_remove_item         (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   182  | 
						    const gchar    *uri,
  | 
| 
sl@0
 | 
   183  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   184  | 
IMPORT_C gboolean       g_bookmark_file_move_item           (GBookmarkFile  *bookmark,
  | 
| 
sl@0
 | 
   185  | 
						    const gchar    *old_uri,
  | 
| 
sl@0
 | 
   186  | 
						    const gchar    *new_uri,
  | 
| 
sl@0
 | 
   187  | 
						    GError        **error);
  | 
| 
sl@0
 | 
   188  | 
  | 
| 
sl@0
 | 
   189  | 
G_END_DECLS
  | 
| 
sl@0
 | 
   190  | 
  | 
| 
sl@0
 | 
   191  | 
#endif /* __G_BOOKMARK_FILE_H__ */
  |