Blame glib/gbookmarkfile.h

Packit ae235b
/* gbookmarkfile.h: parsing and building desktop bookmarks
Packit ae235b
 *
Packit ae235b
 * Copyright (C) 2005-2006 Emmanuele Bassi
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public License
Packit ae235b
 * along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __G_BOOKMARK_FILE_H__
Packit ae235b
#define __G_BOOKMARK_FILE_H__
Packit ae235b
Packit ae235b
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
Packit ae235b
#error "Only <glib.h> can be included directly."
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#include <glib/gerror.h>
Packit ae235b
#include <time.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_BOOKMARK_FILE_ERROR:
Packit ae235b
 *
Packit ae235b
 * Error domain for bookmark file parsing.
Packit ae235b
 * Errors in this domain will be from the #GBookmarkFileError
Packit ae235b
 * enumeration. See #GError for information on error domains.
Packit ae235b
 */
Packit ae235b
#define G_BOOKMARK_FILE_ERROR	(g_bookmark_file_error_quark ())
Packit ae235b
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GBookmarkFileError:
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did
Packit ae235b
 *     not register a bookmark
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was
Packit ae235b
 *     in an unknown encoding
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing
Packit ae235b
 * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found
Packit ae235b
 *
Packit ae235b
 * Error codes returned by bookmark file parsing.
Packit ae235b
 */
Packit ae235b
typedef enum
Packit ae235b
{
Packit ae235b
  G_BOOKMARK_FILE_ERROR_INVALID_URI,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_INVALID_VALUE,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_READ,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_WRITE,
Packit ae235b
  G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
Packit ae235b
} GBookmarkFileError;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GQuark g_bookmark_file_error_quark (void);
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GBookmarkFile:
Packit ae235b
 *
Packit ae235b
 * The `GBookmarkFile` structure contains only
Packit ae235b
 * private data and should not be directly accessed.
Packit ae235b
 */
Packit ae235b
typedef struct _GBookmarkFile GBookmarkFile;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GBookmarkFile *g_bookmark_file_new                 (void);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_free                (GBookmarkFile  *bookmark);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_load_from_file      (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *filename,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_load_from_data      (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *data,
Packit ae235b
						    gsize           length,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_load_from_data_dirs (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *file,
Packit ae235b
						    gchar         **full_path,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *        g_bookmark_file_to_data             (GBookmarkFile  *bookmark,
Packit ae235b
						    gsize          *length,
Packit ae235b
						    GError        **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_to_file             (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *filename,
Packit ae235b
						    GError        **error);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_title           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *title);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *        g_bookmark_file_get_title           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_description     (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *description);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *        g_bookmark_file_get_description     (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_mime_type       (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *mime_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *        g_bookmark_file_get_mime_type       (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_groups          (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar   **groups,
Packit ae235b
						    gsize           length);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_add_group           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *group);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_has_group           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *group,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar **       g_bookmark_file_get_groups          (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    gsize          *length,
Packit ae235b
						    GError        **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_add_application     (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *name,
Packit ae235b
						    const gchar    *exec);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_has_application     (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *name,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar **       g_bookmark_file_get_applications    (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    gsize          *length,
Packit ae235b
						    GError        **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_set_app_info        (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *name,
Packit ae235b
						    const gchar    *exec,
Packit ae235b
						    gint            count,
Packit ae235b
						    time_t          stamp,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_get_app_info        (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *name,
Packit ae235b
						    gchar         **exec,
Packit ae235b
						    guint          *count,
Packit ae235b
						    time_t         *stamp,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_is_private      (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    gboolean        is_private);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_get_is_private      (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_icon            (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *href,
Packit ae235b
						    const gchar    *mime_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_get_icon            (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    gchar         **href,
Packit ae235b
						    gchar         **mime_type,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_added           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    time_t          added);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
time_t         g_bookmark_file_get_added           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_modified        (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    time_t          modified);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
time_t         g_bookmark_file_get_modified        (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void           g_bookmark_file_set_visited         (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    time_t          visited);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
time_t         g_bookmark_file_get_visited         (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri, 
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_has_item            (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gint           g_bookmark_file_get_size            (GBookmarkFile  *bookmark);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar **       g_bookmark_file_get_uris            (GBookmarkFile  *bookmark,
Packit ae235b
						    gsize          *length) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_remove_group        (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *group,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_remove_application  (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    const gchar    *name,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_remove_item         (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *uri,
Packit ae235b
						    GError        **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean       g_bookmark_file_move_item           (GBookmarkFile  *bookmark,
Packit ae235b
						    const gchar    *old_uri,
Packit ae235b
						    const gchar    *new_uri,
Packit ae235b
						    GError        **error);
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_BOOKMARK_FILE_H__ */