Blame glib/gkeyfile.h

Packit ae235b
/* gkeyfile.h - desktop entry file parser
Packit ae235b
 *
Packit ae235b
 *  Copyright 2004 Red Hat, Inc.
Packit ae235b
 *
Packit ae235b
 *  Ray Strode <halfline@hawaii.rr.com>
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_KEY_FILE_H__
Packit ae235b
#define __G_KEY_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/gbytes.h>
Packit ae235b
#include <glib/gerror.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
typedef enum
Packit ae235b
{
Packit ae235b
  G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
Packit ae235b
  G_KEY_FILE_ERROR_PARSE,
Packit ae235b
  G_KEY_FILE_ERROR_NOT_FOUND,
Packit ae235b
  G_KEY_FILE_ERROR_KEY_NOT_FOUND,
Packit ae235b
  G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
Packit ae235b
  G_KEY_FILE_ERROR_INVALID_VALUE
Packit ae235b
} GKeyFileError;
Packit ae235b
Packit ae235b
#define G_KEY_FILE_ERROR g_key_file_error_quark()
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GQuark g_key_file_error_quark (void);
Packit ae235b
Packit ae235b
typedef struct _GKeyFile GKeyFile;
Packit ae235b
Packit ae235b
typedef enum
Packit ae235b
{
Packit ae235b
  G_KEY_FILE_NONE              = 0,
Packit ae235b
  G_KEY_FILE_KEEP_COMMENTS     = 1 << 0,
Packit ae235b
  G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
Packit ae235b
} GKeyFileFlags;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GKeyFile *g_key_file_new                    (void);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GKeyFile *g_key_file_ref                    (GKeyFile             *key_file);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_unref                  (GKeyFile             *key_file);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_free                   (GKeyFile             *key_file);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_list_separator     (GKeyFile             *key_file,
Packit ae235b
					     gchar                 separator);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_load_from_file         (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *file,
Packit ae235b
					     GKeyFileFlags         flags,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_load_from_data         (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *data,
Packit ae235b
					     gsize                 length,
Packit ae235b
					     GKeyFileFlags         flags,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_2_50
Packit ae235b
gboolean  g_key_file_load_from_bytes        (GKeyFile             *key_file,
Packit ae235b
                                             GBytes               *bytes,
Packit ae235b
                                             GKeyFileFlags         flags,
Packit ae235b
                                             GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean g_key_file_load_from_dirs          (GKeyFile             *key_file,
Packit ae235b
					     const gchar	  *file,
Packit ae235b
					     const gchar	 **search_dirs,
Packit ae235b
					     gchar		 **full_path,
Packit ae235b
					     GKeyFileFlags         flags,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean g_key_file_load_from_data_dirs     (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *file,
Packit ae235b
					     gchar               **full_path,
Packit ae235b
					     GKeyFileFlags         flags,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar    *g_key_file_to_data                (GKeyFile             *key_file,
Packit ae235b
					     gsize                *length,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_2_40
Packit ae235b
gboolean  g_key_file_save_to_file           (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *filename,
Packit ae235b
                                             GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar    *g_key_file_get_start_group        (GKeyFile             *key_file) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar   **g_key_file_get_groups             (GKeyFile             *key_file,
Packit ae235b
					     gsize                *length) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar   **g_key_file_get_keys               (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     gsize                *length,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_has_group              (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_has_key                (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar    *g_key_file_get_value              (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_value              (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar          *value);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar    *g_key_file_get_string             (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_string             (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar          *string);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar    *g_key_file_get_locale_string      (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar          *locale,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_2_56
Packit ae235b
gchar    *g_key_file_get_locale_for_key     (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             const gchar          *locale) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_locale_string      (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar          *locale,
Packit ae235b
					     const gchar          *string);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_get_boolean            (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_boolean            (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gboolean              value);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gint      g_key_file_get_integer            (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_integer            (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gint                  value);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gint64    g_key_file_get_int64              (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_int64              (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gint64                value);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
guint64   g_key_file_get_uint64             (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_uint64             (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     guint64               value);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gdouble   g_key_file_get_double             (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_double             (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             gdouble               value);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar   **g_key_file_get_string_list        (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gsize                *length,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_string_list        (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar * const   list[],
Packit ae235b
					     gsize                 length);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar   **g_key_file_get_locale_string_list (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar          *locale,
Packit ae235b
					     gsize                *length,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_locale_string_list (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     const gchar          *locale,
Packit ae235b
					     const gchar * const   list[],
Packit ae235b
					     gsize                 length);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean *g_key_file_get_boolean_list       (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gsize                *length,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_boolean_list       (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gboolean              list[],
Packit ae235b
					     gsize                 length);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gint     *g_key_file_get_integer_list       (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gsize                *length,
Packit ae235b
					     GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_double_list        (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             gdouble               list[],
Packit ae235b
                                             gsize                 length);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gdouble  *g_key_file_get_double_list        (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             gsize                *length,
Packit ae235b
                                             GError              **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_key_file_set_integer_list       (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     gint                  list[],
Packit ae235b
					     gsize                 length);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_set_comment            (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             const gchar          *comment,
Packit ae235b
                                             GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar    *g_key_file_get_comment            (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
                                             GError              **error) G_GNUC_MALLOC;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_remove_comment         (GKeyFile             *key_file,
Packit ae235b
                                             const gchar          *group_name,
Packit ae235b
                                             const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_remove_key             (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     const gchar          *key,
Packit ae235b
					     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_key_file_remove_group           (GKeyFile             *key_file,
Packit ae235b
					     const gchar          *group_name,
Packit ae235b
					     GError              **error);
Packit ae235b
Packit ae235b
/* Defines for handling freedesktop.org Desktop files */
Packit ae235b
#define G_KEY_FILE_DESKTOP_GROUP                "Desktop Entry"
Packit ae235b
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_TYPE             "Type"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_VERSION          "Version"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_NAME             "Name"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME     "GenericName"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY       "NoDisplay"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_COMMENT          "Comment"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_ICON             "Icon"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_HIDDEN           "Hidden"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN     "OnlyShowIn"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN      "NotShowIn"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC         "TryExec"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_EXEC             "Exec"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_PATH             "Path"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_TERMINAL         "Terminal"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE        "MimeType"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_CATEGORIES       "Categories"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY   "StartupNotify"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_URL              "URL"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable"
Packit ae235b
#define G_KEY_FILE_DESKTOP_KEY_ACTIONS          "Actions"
Packit ae235b
Packit ae235b
#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION     "Application"
Packit ae235b
#define G_KEY_FILE_DESKTOP_TYPE_LINK            "Link"
Packit ae235b
#define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY       "Directory"
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_KEY_FILE_H__ */