2003-12-05 08:57:32 -08:00
|
|
|
#ifndef _ECORE_CONFIG_H
|
2004-04-24 21:28:52 -07:00
|
|
|
# define _ECORE_CONFIG_H
|
2003-12-05 08:57:32 -08:00
|
|
|
|
|
|
|
/**
|
2004-04-29 20:10:17 -07:00
|
|
|
* @file
|
|
|
|
* @brief Provides the Enlightened Property Library.
|
2003-12-05 08:57:32 -08:00
|
|
|
*
|
|
|
|
* The Enlightened Property Library (Ecore_Config) is an adbstraction from the
|
|
|
|
* complexities of writing your own configuration. It provides many features
|
|
|
|
* using the Enlightenment 17 development libraries.
|
2004-04-29 20:10:17 -07:00
|
|
|
*
|
|
|
|
* This file provies all headers and structs for use with Ecore_Config.
|
|
|
|
* Using individual header files should not be necessary.
|
2003-12-05 08:57:32 -08:00
|
|
|
*/
|
|
|
|
|
2004-04-24 21:28:52 -07:00
|
|
|
# define DIR_DELIMITER '/'
|
|
|
|
# define ECORE_CONFIG_FLOAT_PRECISION 1000
|
2003-12-05 08:57:32 -08:00
|
|
|
|
2004-04-24 21:28:52 -07:00
|
|
|
# ifndef TRUE
|
2003-12-05 08:57:32 -08:00
|
|
|
# define FALSE (0)
|
|
|
|
# define TRUE (!FALSE)
|
2004-04-24 21:28:52 -07:00
|
|
|
# endif
|
2003-12-05 08:57:32 -08:00
|
|
|
|
2004-04-24 21:28:52 -07:00
|
|
|
# include <Ecore_Ipc.h>
|
2004-03-27 06:57:23 -08:00
|
|
|
/* this should only be included if evas is present */
|
2004-04-24 21:28:52 -07:00
|
|
|
# include <Evas.h>
|
2003-12-05 08:57:32 -08:00
|
|
|
|
2003-12-06 09:24:19 -08:00
|
|
|
/* debug */
|
2004-04-24 21:28:52 -07:00
|
|
|
# define DEBUG 1
|
|
|
|
# undef ECORE_CONFIG_DEBUG
|
2003-12-06 09:24:19 -08:00
|
|
|
|
2004-04-24 21:28:52 -07:00
|
|
|
# ifdef ECORE_CONFIG_DEBUG
|
2003-12-06 09:24:19 -08:00
|
|
|
# define D(fmt,args...) do { if(DEBUG>=0) fprintf(stderr,fmt,## args); } while(0);
|
2003-12-31 14:15:33 -08:00
|
|
|
# define E(lvl,args...) do { if(DEBUG>=(lvl)) fprintf(stderr,## args); } while(0)
|
2004-04-24 21:28:52 -07:00
|
|
|
# else
|
2003-12-06 09:24:19 -08:00
|
|
|
# define D(msg,args...)
|
2003-12-31 14:15:33 -08:00
|
|
|
# define E(lvl,args...) do { } while(0)
|
2004-04-24 21:28:52 -07:00
|
|
|
# endif
|
2003-12-06 09:24:19 -08:00
|
|
|
|
2004-04-24 21:28:52 -07:00
|
|
|
# define ECORE_CONFIG_GLOBAL_ID "_system"
|
2003-12-05 08:57:32 -08:00
|
|
|
|
|
|
|
/* structures */
|
|
|
|
|
|
|
|
typedef enum Ecore_Config_Type {
|
|
|
|
PT_NIL=0,
|
|
|
|
PT_INT=1,
|
|
|
|
PT_FLT=2,
|
|
|
|
PT_STR=3,
|
2004-04-22 16:38:19 -07:00
|
|
|
PT_RGB=4,
|
|
|
|
PT_THM=5
|
2003-12-05 08:57:32 -08:00
|
|
|
} Ecore_Config_Type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum Ecore_Config_Flag {
|
|
|
|
PF_NONE=0,
|
|
|
|
PF_BOUNDS=1,
|
2004-02-03 14:53:13 -08:00
|
|
|
PF_MODIFIED=2,
|
|
|
|
PF_SYSTEM=4
|
2003-12-05 08:57:32 -08:00
|
|
|
} Ecore_Config_Flag;
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-05-03 04:28:43 -07:00
|
|
|
typedef int (*Ecore_Config_Listener)(const char *key,const Ecore_Config_Type type,const int tag,void *data);
|
2003-12-05 08:57:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct Ecore_Config_Listener_List {
|
2004-03-08 07:03:40 -08:00
|
|
|
Ecore_Config_Listener listener;
|
2003-12-05 08:57:32 -08:00
|
|
|
const char *name;
|
|
|
|
void *data;
|
|
|
|
int tag;
|
|
|
|
struct Ecore_Config_Listener_List *next; } Ecore_Config_Listener_List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The actual property for storing a key-value pair.
|
|
|
|
*/
|
|
|
|
typedef struct Ecore_Config_Prop {
|
|
|
|
char *key;
|
|
|
|
char *description;
|
2004-05-03 16:57:14 -07:00
|
|
|
char short_opt;
|
|
|
|
char *long_opt;
|
2003-12-06 09:37:20 -08:00
|
|
|
char *ptr;
|
2004-03-08 07:03:40 -08:00
|
|
|
Ecore_Config_Type type;
|
2003-12-05 08:57:32 -08:00
|
|
|
long val,lo,hi,step;
|
2004-03-08 07:03:40 -08:00
|
|
|
Ecore_Config_Flag flags;
|
2003-12-05 08:57:32 -08:00
|
|
|
Ecore_Config_Listener_List *listeners;
|
2004-05-02 14:02:49 -07:00
|
|
|
void *data;
|
2003-12-05 08:57:32 -08:00
|
|
|
struct Ecore_Config_Prop *next; /**< pointer to the next property in the list */
|
|
|
|
} Ecore_Config_Prop;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A container for a list of properties. Provided so that an application can
|
|
|
|
* use different set of properties at any time. This is useful for multiple
|
|
|
|
* window support.
|
|
|
|
*/
|
|
|
|
typedef struct Ecore_Config_Bundle {
|
|
|
|
char *identifier; /**< identifier for this set of properties (window ID for example) */
|
|
|
|
char *owner; /**< this is used to store the application name related to the bundle */
|
|
|
|
long serial; /**< unique identifier to identify bundle */
|
|
|
|
Ecore_Config_Prop *data; /**< pointer to root of property list */
|
|
|
|
void *user_data; /**< app specific pointer to "other data" */
|
|
|
|
struct Ecore_Config_Bundle *next; /**< pointer to next bundle in this application */
|
|
|
|
} Ecore_Config_Bundle;
|
|
|
|
|
|
|
|
typedef struct Ecore_Config_Server {
|
|
|
|
void *server;
|
|
|
|
char *name;
|
|
|
|
Ecore_Config_Bundle *bundles; /* data anchor */
|
|
|
|
struct Ecore_Config_Server *next; } Ecore_Config_Server;
|
|
|
|
|
2004-04-24 21:28:52 -07:00
|
|
|
# ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
# endif
|
|
|
|
|
2004-01-20 08:19:45 -08:00
|
|
|
/* global ptrs to save passing them through the API */
|
2004-03-01 15:11:28 -08:00
|
|
|
extern Ecore_Config_Server *__ecore_config_server_global;
|
|
|
|
extern Ecore_Config_Server *__ecore_config_server_local;
|
|
|
|
extern Ecore_Config_Bundle *__ecore_config_bundle_local;
|
|
|
|
extern char *__ecore_config_app_name;
|
2004-01-19 16:45:52 -08:00
|
|
|
|
2004-05-03 04:28:43 -07:00
|
|
|
Ecore_Config_Prop *ecore_config_get(const char *key);
|
2003-12-05 08:57:32 -08:00
|
|
|
const char *ecore_config_get_type(const Ecore_Config_Prop *e);
|
2004-01-20 08:19:45 -08:00
|
|
|
void *ecore_config_get_data(const char *key);
|
|
|
|
char *ecore_config_get_string(const char *key);
|
|
|
|
long ecore_config_get_int(const char *key);
|
|
|
|
int ecore_config_get_rgb(const char *key,int *r, int *g, int *b);
|
|
|
|
float ecore_config_get_float(const char *key);
|
2004-04-22 16:38:19 -07:00
|
|
|
char *ecore_config_get_theme(const char *key);
|
2004-01-20 08:19:45 -08:00
|
|
|
char *ecore_config_get_as_string(const char *key);
|
2004-05-03 16:57:14 -07:00
|
|
|
int ecore_config_describe(const char *key, char *desc);
|
|
|
|
int ecore_config_set_short_opt(const char *key, char short_opt);
|
|
|
|
int ecore_config_set_long_opt(const char *key, char *long_opt);
|
2004-05-03 04:28:43 -07:00
|
|
|
int ecore_config_set(const char *key,char *val);
|
|
|
|
int ecore_config_set_typed(const char *key,void *val,int type);
|
2004-01-20 08:19:45 -08:00
|
|
|
int ecore_config_set_string(const char *key,char *val);
|
|
|
|
int ecore_config_set_int(const char *key,int val);
|
|
|
|
int ecore_config_set_rgb(const char *key,char *val);
|
|
|
|
char *ecore_config_get_rgbstr(const char *key);
|
|
|
|
int ecore_config_set_float(const char *key,float val);
|
2004-04-22 16:38:19 -07:00
|
|
|
int ecore_config_set_theme(const char *key,char *val);
|
2004-05-02 14:02:49 -07:00
|
|
|
int ecore_config_set_theme_preview_group(const char *key, char *group);
|
2004-01-20 08:19:45 -08:00
|
|
|
int ecore_config_set_as_string(const char *key,char *val);
|
|
|
|
|
|
|
|
int ecore_config_default(const char *key,char *val,float lo,float hi,float step);
|
|
|
|
int ecore_config_default_int(const char *key,int val);
|
|
|
|
int ecore_config_default_int_bound(const char *key,int val,int lo,int hi,int step);
|
|
|
|
int ecore_config_default_string(const char *key,char *val);
|
|
|
|
int ecore_config_default_float(const char *key,float val);
|
|
|
|
int ecore_config_default_float_bound(const char *key,float val,float lo,float hi,float step);
|
|
|
|
int ecore_config_default_rgb(const char *key,char *val);
|
2004-04-22 16:38:19 -07:00
|
|
|
int ecore_config_default_theme(const char *key,char *val);
|
2004-01-20 08:19:45 -08:00
|
|
|
|
|
|
|
int ecore_config_listen(const char *name,const char *key,Ecore_Config_Listener listener,int tag,void *data);
|
|
|
|
int ecore_config_deaf(const char *name,const char *key,Ecore_Config_Listener listener);
|
|
|
|
Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e);
|
2004-04-22 16:38:19 -07:00
|
|
|
int ecore_config_guess_type(const char *key, char *val);
|
2003-12-05 08:57:32 -08:00
|
|
|
|
2003-12-06 09:24:19 -08:00
|
|
|
Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server *srv, const char *id);
|
2003-12-05 08:57:32 -08:00
|
|
|
Ecore_Config_Bundle *ecore_config_bundle_get_1st(Ecore_Config_Server *srv);
|
|
|
|
Ecore_Config_Bundle *ecore_config_bundle_get_next(Ecore_Config_Bundle *ns);
|
|
|
|
Ecore_Config_Bundle *ecore_config_bundle_get_by_serial(Ecore_Config_Server *srv, long serial);
|
|
|
|
Ecore_Config_Bundle *ecore_config_bundle_get_by_label(Ecore_Config_Server *srv, const char *label);
|
|
|
|
long ecore_config_bundle_get_serial(Ecore_Config_Bundle *ns);
|
|
|
|
char *ecore_config_bundle_get_label(Ecore_Config_Bundle *ns);
|
|
|
|
|
|
|
|
|
2004-01-20 08:19:45 -08:00
|
|
|
int ecore_config_init(char *name);
|
2004-05-03 09:13:12 -07:00
|
|
|
int ecore_config_shutdown(void);
|
2003-12-05 08:57:32 -08:00
|
|
|
|
2004-01-20 08:19:45 -08:00
|
|
|
int ecore_config_load(void);
|
|
|
|
int ecore_config_load_file(char *file);
|
|
|
|
int ecore_config_save(void);
|
|
|
|
int ecore_config_save_file(char *file);
|
2003-12-05 08:57:32 -08:00
|
|
|
|
2003-12-06 09:24:19 -08:00
|
|
|
/* error codes */
|
2004-04-24 21:28:52 -07:00
|
|
|
# define ECORE_CONFIG_ERR_NOTSUPP (-16)
|
|
|
|
# define ECORE_CONFIG_ERR_NOFILE (-15)
|
|
|
|
# define ECORE_CONFIG_ERR_META_DLFAIL (-14)
|
|
|
|
# define ECORE_CONFIG_ERR_META_FILE (-13)
|
|
|
|
# define ECORE_CONFIG_ERR_META_FORMAT (-12)
|
|
|
|
# define ECORE_CONFIG_ERR_MONMIS (-11)
|
|
|
|
# define ECORE_CONFIG_ERR_NOEXEC (-10)
|
|
|
|
# define ECORE_CONFIG_ERR_PARTIAL (-9)
|
|
|
|
# define ECORE_CONFIG_ERR_PATHEX (-8)
|
|
|
|
# define ECORE_CONFIG_ERR_TYPEMISMATCH (-7)
|
|
|
|
# define ECORE_CONFIG_ERR_MUTEX (-6)
|
|
|
|
# define ECORE_CONFIG_ERR_NOTFOUND (-5)
|
|
|
|
# define ECORE_CONFIG_ERR_OOM (-4)
|
|
|
|
# define ECORE_CONFIG_ERR_IGNORED (-3)
|
|
|
|
# define ECORE_CONFIG_ERR_NODATA (-2)
|
|
|
|
# define ECORE_CONFIG_ERR_FAIL (-1)
|
|
|
|
# define ECORE_CONFIG_ERR_SUCC (0)
|
2004-03-27 06:57:23 -08:00
|
|
|
|
2004-05-03 16:57:14 -07:00
|
|
|
# define ECORE_CONFIG_PARSE_HELP (-2)
|
|
|
|
# define ECORE_CONFIG_PARSE_EXIT (-1)
|
|
|
|
# define ECORE_CONFIG_PARSE_CONTINUE (0)
|
|
|
|
|
2004-03-27 06:57:23 -08:00
|
|
|
/* convenience mathods in convenience.c */
|
|
|
|
int ecore_config_evas_font_path_apply(Evas *evas);
|
2004-05-03 16:57:14 -07:00
|
|
|
void ecore_config_args_display(void);
|
|
|
|
int ecore_config_args_parse(int argc, char **argv);
|
2004-05-04 02:17:04 -07:00
|
|
|
void ecore_config_app_describe(char *description);
|
2004-04-24 21:28:52 -07:00
|
|
|
|
|
|
|
# ifdef __cplusplus
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|