Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add header file for builtin-gconf module
Move type definitions and function prototypes from builtin-gconf.c to builtin-gconf.h
- Loading branch information
Showing
3 changed files
with
173 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
/* ------------------------------------------------------------------------- * | ||
* Copyright (C) 2012-2014 Jolla Ltd. | ||
* Contact: Simo Piiroinen <simo.piiroinen@jollamobile.com> | ||
* License: LGPLv2 | ||
* ------------------------------------------------------------------------- */ | ||
|
||
#ifndef BUILTIN_GCONF_H_ | ||
# define BUILTIN_GCONF_H_ | ||
|
||
# ifdef __cplusplus | ||
extern "C" { | ||
# elif 0 | ||
} /* fool JED indentation ... */ | ||
# endif | ||
|
||
/* ========================================================================= * | ||
* | ||
* TYPES | ||
* | ||
* ========================================================================= */ | ||
|
||
typedef enum | ||
{ | ||
GCONF_ERROR_SUCCESS = 0, | ||
GCONF_ERROR_FAILED = 1, | ||
|
||
GCONF_ERROR_NO_SERVER = 2, | ||
GCONF_ERROR_NO_PERMISSION = 3, | ||
GCONF_ERROR_BAD_ADDRESS = 4, | ||
GCONF_ERROR_BAD_KEY = 5, | ||
|
||
GCONF_ERROR_PARSE_ERROR = 6, | ||
GCONF_ERROR_CORRUPT = 7, | ||
GCONF_ERROR_TYPE_MISMATCH = 8, | ||
GCONF_ERROR_IS_DIR = 9, | ||
GCONF_ERROR_IS_KEY = 10, | ||
GCONF_ERROR_OVERRIDDEN = 11, | ||
GCONF_ERROR_OAF_ERROR = 12, | ||
GCONF_ERROR_LOCAL_ENGINE = 13, | ||
GCONF_ERROR_LOCK_FAILED = 14, | ||
GCONF_ERROR_NO_WRITABLE_DATABASE = 15, | ||
GCONF_ERROR_IN_SHUTDOWN = 16, | ||
} GConfError; | ||
|
||
typedef enum | ||
{ | ||
GCONF_VALUE_INVALID, | ||
GCONF_VALUE_STRING, | ||
GCONF_VALUE_INT, | ||
GCONF_VALUE_FLOAT, | ||
GCONF_VALUE_BOOL, | ||
GCONF_VALUE_SCHEMA, | ||
GCONF_VALUE_LIST, | ||
GCONF_VALUE_PAIR | ||
|
||
} GConfValueType; | ||
|
||
typedef struct GConfValue | ||
{ | ||
// public | ||
|
||
GConfValueType type; | ||
|
||
// private | ||
|
||
int refcount; | ||
|
||
union { | ||
gboolean b; | ||
gint i; | ||
char *s; | ||
double f; | ||
} data; | ||
|
||
GConfValueType list_type; | ||
GSList *list_head; | ||
|
||
} GConfValue; | ||
|
||
typedef struct GConfEntry | ||
{ | ||
// public | ||
|
||
char *key; | ||
GConfValue *value; | ||
|
||
// private | ||
|
||
char *def; | ||
|
||
} GConfEntry; | ||
|
||
typedef struct GConfClient | ||
{ | ||
// public | ||
|
||
// (nothing) | ||
|
||
// private | ||
|
||
GSList *entries; | ||
|
||
GSList *notify_list; | ||
|
||
} GConfClient; | ||
|
||
typedef enum | ||
{ | ||
GCONF_CLIENT_PRELOAD_NONE, | ||
GCONF_CLIENT_PRELOAD_ONELEVEL, | ||
GCONF_CLIENT_PRELOAD_RECURSIVE | ||
} GConfClientPreloadType; | ||
|
||
typedef void (*GConfClientNotifyFunc)(GConfClient *client, | ||
guint cnxn_id, | ||
GConfEntry *entry, | ||
gpointer user_data); | ||
|
||
typedef struct GConfClientNotify | ||
{ | ||
guint id; | ||
gchar *namespace_section; | ||
GConfClientNotifyFunc func; | ||
gpointer user_data; | ||
GFreeFunc destroy_notify; | ||
|
||
} GConfClientNotify; | ||
|
||
/* ------------------------------------------------------------------------- * | ||
* | ||
* FUNCTIONS | ||
* | ||
* ------------------------------------------------------------------------- */ | ||
|
||
gchar *gconf_concat_dir_and_key(const gchar *dir, const gchar *key); | ||
GConfValue *gconf_value_copy(const GConfValue *src); | ||
GConfValue *gconf_value_new(GConfValueType type); | ||
void gconf_value_free(GConfValue *self); | ||
gboolean gconf_value_get_bool(const GConfValue *self); | ||
void gconf_value_set_bool(GConfValue *self, gboolean val); | ||
int gconf_value_get_int(const GConfValue *self); | ||
void gconf_value_set_int(GConfValue *self, gint val); | ||
double gconf_value_get_float(const GConfValue *self); | ||
void gconf_value_set_float(GConfValue *self, double val); | ||
const char *gconf_value_get_string(const GConfValue *self); | ||
void gconf_value_set_string(GConfValue *self, const char *val); | ||
GConfValueType gconf_value_get_list_type(const GConfValue *self); | ||
void gconf_value_set_list_type(GConfValue *self, GConfValueType list_type); | ||
GSList *gconf_value_get_list(const GConfValue *self); | ||
void gconf_value_set_list(GConfValue *self, GSList *list); | ||
const char *gconf_entry_get_key(const GConfEntry *entry); | ||
GConfValue *gconf_entry_get_value(const GConfEntry *entry); | ||
GConfClient *gconf_client_get_default(void); | ||
void gconf_client_add_dir(GConfClient *client, const gchar *dir, GConfClientPreloadType preload, GError **err); | ||
GConfValue *gconf_client_get(GConfClient *self, const gchar *key, GError **err); | ||
gboolean gconf_client_set_bool(GConfClient *client, const gchar *key, gboolean val, GError **err); | ||
gboolean gconf_client_set_int(GConfClient *client, const gchar *key, gint val, GError **err); | ||
gboolean gconf_client_set_float(GConfClient *client, const gchar *key, double val, GError **err); | ||
gboolean gconf_client_set_string(GConfClient *client, const gchar *key, const gchar *val, GError **err); | ||
gboolean gconf_client_set_list(GConfClient *client, const gchar *key, GConfValueType list_type, GSList *list, GError **err); | ||
void gconf_client_suggest_sync(GConfClient *client, GError **err); | ||
guint gconf_client_notify_add(GConfClient *client, const gchar *namespace_section, GConfClientNotifyFunc func, gpointer user_data, GFreeFunc destroy_notify, GError **err); | ||
void gconf_client_notify_remove(GConfClient *client, guint cnxn); | ||
|
||
# ifdef __cplusplus | ||
}; | ||
# endif | ||
|
||
#endif /* BUILTIN_GCONF_H_ */ |