diff options
Diffstat (limited to 'libraries/ecore/src/lib/ecore_config')
13 files changed, 0 insertions, 5310 deletions
diff --git a/libraries/ecore/src/lib/ecore_config/Ecore_Config.h b/libraries/ecore/src/lib/ecore_config/Ecore_Config.h deleted file mode 100644 index 6733d7b..0000000 --- a/libraries/ecore/src/lib/ecore_config/Ecore_Config.h +++ /dev/null | |||
@@ -1,312 +0,0 @@ | |||
1 | #ifndef _ECORE_CONFIG_H | ||
2 | # define _ECORE_CONFIG_H | ||
3 | |||
4 | #ifdef EAPI | ||
5 | #undef EAPI | ||
6 | #endif | ||
7 | #ifdef _MSC_VER | ||
8 | # ifdef BUILDING_DLL | ||
9 | # define EAPI __declspec(dllexport) | ||
10 | # else | ||
11 | # define EAPI __declspec(dllimport) | ||
12 | # endif | ||
13 | #else | ||
14 | # ifdef __GNUC__ | ||
15 | # if __GNUC__ >= 4 | ||
16 | # define EAPI __attribute__ ((visibility("default"))) | ||
17 | # else | ||
18 | # define EAPI | ||
19 | # endif | ||
20 | # else | ||
21 | # define EAPI | ||
22 | # endif | ||
23 | #endif | ||
24 | |||
25 | /** | ||
26 | * @file | ||
27 | * @brief Provides the Enlightened Property Library. | ||
28 | * | ||
29 | * This file provies all headers and structs for use with Ecore_Config. | ||
30 | * Using individual header files should not be necessary. | ||
31 | */ | ||
32 | |||
33 | # define DIR_DELIMITER '/' | ||
34 | # define ECORE_CONFIG_FLOAT_PRECISION 1000 | ||
35 | |||
36 | /* FIXME: this should only be included if evas is present */ | ||
37 | # include <Evas.h> | ||
38 | |||
39 | # define ECORE_CONFIG_GLOBAL_ID "_system" | ||
40 | |||
41 | /* structures */ | ||
42 | |||
43 | /** | ||
44 | * Valid configuration property types. | ||
45 | */ | ||
46 | typedef enum Ecore_Config_Type | ||
47 | { | ||
48 | ECORE_CONFIG_NIL = 0, /**< Property with no value. */ | ||
49 | ECORE_CONFIG_INT = 1, /**< Integer property type. */ | ||
50 | ECORE_CONFIG_FLT = 2, /**< Float property type. */ | ||
51 | ECORE_CONFIG_STR = 3, /**< String property type. */ | ||
52 | ECORE_CONFIG_RGB = 4, /**< Colour property type. */ | ||
53 | ECORE_CONFIG_THM = 5, /**< Theme property type. */ | ||
54 | ECORE_CONFIG_BLN = 6, /**< Boolean property type. */ | ||
55 | ECORE_CONFIG_SCT = 7, /**< Structure property type */ | ||
56 | } Ecore_Config_Type; | ||
57 | |||
58 | typedef enum Ecore_Config_Flag | ||
59 | { | ||
60 | ECORE_CONFIG_FLAG_NONE = 0, | ||
61 | ECORE_CONFIG_FLAG_BOUNDS = 1, | ||
62 | ECORE_CONFIG_FLAG_MODIFIED = 2, | ||
63 | ECORE_CONFIG_FLAG_SYSTEM = 4, | ||
64 | ECORE_CONFIG_FLAG_CMDLN = 8 | ||
65 | } Ecore_Config_Flag; | ||
66 | |||
67 | /** | ||
68 | * Property change callback function prototype. | ||
69 | */ | ||
70 | typedef int (*Ecore_Config_Listener) (const char *key, | ||
71 | const Ecore_Config_Type type, | ||
72 | const int tag, void *data); | ||
73 | |||
74 | typedef struct Ecore_Config_Listener_List | ||
75 | { | ||
76 | Ecore_Config_Listener listener; | ||
77 | const char *name; | ||
78 | void *data; | ||
79 | int tag; | ||
80 | struct Ecore_Config_Listener_List *next; | ||
81 | } Ecore_Config_Listener_List; | ||
82 | |||
83 | /** | ||
84 | * The actual property for storing a key-value pair. | ||
85 | */ | ||
86 | typedef struct Ecore_Config_Prop | ||
87 | { | ||
88 | char *key; /* Property key. */ | ||
89 | char *description; /* Description set by ecore_config_descibe. */ | ||
90 | char short_opt; /* short identifier on command line (-f) */ | ||
91 | char *long_opt; /* long identifier on command line (--foo) */ | ||
92 | char *ptr; /* Used as the value when the property is a string or theme. */ | ||
93 | Ecore_Config_Type type; /* Property type. */ | ||
94 | long val; /* Used as the value when the property is an integer, float or colour. */ | ||
95 | long lo; /* Lower bound for the value when the property is an integer or float. */ | ||
96 | long hi; /* Higher bound for the value when the property is an integer or float. */ | ||
97 | long step; /* Increment for the value when the property is an integer or float. */ | ||
98 | Ecore_Config_Flag flags; /// < Configuration flags. | ||
99 | Ecore_Config_Listener_List *listeners; /* List of change listeners. */ | ||
100 | void *data; /// < Stores extra data for the property. | ||
101 | struct Ecore_Config_Prop *parent; /* if we are in a struct we have a parent to notify of changes etc */ | ||
102 | struct Ecore_Config_Prop *next; /* Pointer to the next property in the list. */ | ||
103 | } Ecore_Config_Prop; | ||
104 | |||
105 | /* | ||
106 | * A container for a list of properties. Provided so that an | ||
107 | * application can use different set of properties at any time. This | ||
108 | * is useful for multiple window support. | ||
109 | */ | ||
110 | typedef struct Ecore_Config_Bundle | ||
111 | { | ||
112 | char *identifier; /* Identifier for this set of properties (window ID for example) */ | ||
113 | char *owner; /* This is used to store the application name related to the bundle */ | ||
114 | long serial; /* Unique identifier to identify bundle */ | ||
115 | Ecore_Config_Prop *data; /* Pointer to root of property list */ | ||
116 | void *user_data; /* App specific pointer to "other data" */ | ||
117 | struct Ecore_Config_Bundle *next; /* Pointer to next bundle in this application */ | ||
118 | } Ecore_Config_Bundle; | ||
119 | |||
120 | typedef struct Ecore_Config_Server | ||
121 | { | ||
122 | void *server; | ||
123 | char *name; | ||
124 | Ecore_Config_Bundle *bundles; /* data anchor */ | ||
125 | struct Ecore_Config_Server *next; | ||
126 | } Ecore_Config_Server; | ||
127 | |||
128 | # ifdef __cplusplus | ||
129 | extern "C" | ||
130 | { | ||
131 | # endif | ||
132 | |||
133 | /* global ptrs to save passing them through the API */ | ||
134 | EAPI extern Ecore_Config_Server *__ecore_config_server_global; | ||
135 | EAPI extern Ecore_Config_Server *__ecore_config_server_local; | ||
136 | EAPI extern Ecore_Config_Bundle *__ecore_config_bundle_local; | ||
137 | EAPI extern char *__ecore_config_app_name; | ||
138 | |||
139 | EAPI Ecore_Config_Prop *ecore_config_get(const char *key); | ||
140 | EAPI const char *ecore_config_type_get(const Ecore_Config_Prop *e); | ||
141 | EAPI int ecore_config_boolean_get(const char *key); | ||
142 | EAPI char *ecore_config_string_get(const char *key); | ||
143 | EAPI long ecore_config_int_get(const char *key); | ||
144 | EAPI int ecore_config_argb_get(const char *key, int *a, int *r, | ||
145 | int *g, int *b); | ||
146 | EAPI long ecore_config_argbint_get(const char *key); | ||
147 | EAPI char *ecore_config_argbstr_get(const char *key); | ||
148 | EAPI float ecore_config_float_get(const char *key); | ||
149 | EAPI char *ecore_config_theme_get(const char *key); | ||
150 | EAPI char *ecore_config_as_string_get(const char *key); | ||
151 | EAPI int ecore_config_bound(Ecore_Config_Prop *e); | ||
152 | EAPI int ecore_config_describe(const char *key, const char *desc); | ||
153 | EAPI int ecore_config_short_opt_set(const char *key, | ||
154 | char short_opt); | ||
155 | EAPI int ecore_config_long_opt_set(const char *key, | ||
156 | const char *long_opt); | ||
157 | EAPI int ecore_config_set(const char *key, const char *val); | ||
158 | EAPI int ecore_config_typed_set(const char *key, const void *val, | ||
159 | int type); | ||
160 | EAPI int ecore_config_boolean_set(const char *key, int val); | ||
161 | EAPI int ecore_config_string_set(const char *key, const char *val); | ||
162 | EAPI int ecore_config_int_set(const char *key, int val); | ||
163 | EAPI int ecore_config_argb_set(const char *key, int a, int r, int g, int b); | ||
164 | EAPI int ecore_config_argbint_set(const char *key, long argb); | ||
165 | EAPI int ecore_config_argbstr_set(const char *key, const char *val); | ||
166 | EAPI int ecore_config_float_set(const char *key, float val); | ||
167 | EAPI int ecore_config_theme_set(const char *key, const char *val); | ||
168 | EAPI int ecore_config_theme_preview_group_set(const char *key, | ||
169 | const char *group); | ||
170 | EAPI int ecore_config_as_string_set(const char *key, const char *val); | ||
171 | |||
172 | EAPI int ecore_config_default(const char *key, const char *val, | ||
173 | float lo, float hi, float step); | ||
174 | EAPI int ecore_config_typed_default(const char *key, const void *val, | ||
175 | int type); | ||
176 | EAPI int ecore_config_boolean_default(const char *key, int val); | ||
177 | EAPI int ecore_config_int_default(const char *key, int val); | ||
178 | EAPI int ecore_config_int_default_bound(const char *key, int val, | ||
179 | int lo, int hi, int step); | ||
180 | EAPI int ecore_config_string_default(const char *key, const char *val); | ||
181 | EAPI int ecore_config_float_default(const char *key, float val); | ||
182 | EAPI int ecore_config_float_default_bound(const char *key, | ||
183 | float val, float lo, | ||
184 | float hi, float step); | ||
185 | EAPI int ecore_config_argb_default(const char *key, int a, int r, int g, int b); | ||
186 | EAPI int ecore_config_argbint_default(const char *key, long argb); | ||
187 | EAPI int ecore_config_argbstr_default(const char *key, const char *val); | ||
188 | EAPI int ecore_config_theme_default(const char *key, const char *val); | ||
189 | EAPI int ecore_config_struct_default(const char *key); | ||
190 | EAPI int ecore_config_struct_int_add(const char *key, const char *name, int val); | ||
191 | EAPI int ecore_config_struct_float_add(const char *key, const char *name, float val); | ||
192 | EAPI int ecore_config_struct_create(const char *key); | ||
193 | EAPI int ecore_config_struct_string_add(const char *key, const char *name, const char* val); | ||
194 | EAPI int ecore_config_struct_theme_add(const char *key, const char *name, const char* val); | ||
195 | EAPI int ecore_config_struct_argb_add(const char *key, const char *name, int a, int r, int g, int b); | ||
196 | EAPI int ecore_config_struct_boolean_add(const char *key, const char *name, int val); | ||
197 | EAPI int ecore_config_struct_get(const char *key, void *data); | ||
198 | |||
199 | EAPI int ecore_config_listen(const char *name, const char *key, | ||
200 | Ecore_Config_Listener listener, | ||
201 | int tag, void *data); | ||
202 | EAPI int ecore_config_deaf(const char *name, const char *key, | ||
203 | Ecore_Config_Listener listener); | ||
204 | EAPI Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e); | ||
205 | EAPI int ecore_config_type_guess(const char *key, const char *val); | ||
206 | |||
207 | EAPI Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server *srv, | ||
208 | const char *id); | ||
209 | EAPI Ecore_Config_Bundle *ecore_config_bundle_1st_get(Ecore_Config_Server *srv); | ||
210 | EAPI Ecore_Config_Bundle *ecore_config_bundle_next_get(Ecore_Config_Bundle *ns); | ||
211 | EAPI Ecore_Config_Bundle *ecore_config_bundle_by_serial_get(Ecore_Config_Server *srv, | ||
212 | long serial); | ||
213 | EAPI Ecore_Config_Bundle *ecore_config_bundle_by_label_get(Ecore_Config_Server *srv, | ||
214 | const char *label); | ||
215 | EAPI long ecore_config_bundle_serial_get(Ecore_Config_Bundle *ns); | ||
216 | EAPI char *ecore_config_bundle_label_get(Ecore_Config_Bundle *ns); | ||
217 | |||
218 | EAPI int ecore_config_init(const char *name); | ||
219 | EAPI int ecore_config_shutdown(void); | ||
220 | |||
221 | EAPI int ecore_config_system_init(void); | ||
222 | EAPI int ecore_config_system_shutdown(void); | ||
223 | |||
224 | EAPI int ecore_config_load(void); | ||
225 | EAPI int ecore_config_file_load(const char *file); | ||
226 | EAPI int ecore_config_save(void); | ||
227 | EAPI int ecore_config_file_save(const char *file); | ||
228 | |||
229 | /* error codes */ | ||
230 | # define ECORE_CONFIG_ERR_NOTSUPP (-16) | ||
231 | # define ECORE_CONFIG_ERR_NOFILE (-15) | ||
232 | # define ECORE_CONFIG_ERR_META_DLFAIL (-14) | ||
233 | # define ECORE_CONFIG_ERR_META_FILE (-13) | ||
234 | # define ECORE_CONFIG_ERR_META_FORMAT (-12) | ||
235 | # define ECORE_CONFIG_ERR_MONMIS (-11) | ||
236 | # define ECORE_CONFIG_ERR_NOEXEC (-10) | ||
237 | # define ECORE_CONFIG_ERR_PARTIAL (-9) | ||
238 | # define ECORE_CONFIG_ERR_PATHEX (-8) | ||
239 | # define ECORE_CONFIG_ERR_TYPEMISMATCH (-7) | ||
240 | # define ECORE_CONFIG_ERR_MUTEX (-6) | ||
241 | # define ECORE_CONFIG_ERR_NOTFOUND (-5) /* Error indicating that the item searched for could not be found. */ | ||
242 | # define ECORE_CONFIG_ERR_OOM (-4) /* Error given when the program runs out of memory. */ | ||
243 | # define ECORE_CONFIG_ERR_IGNORED (-3) /* Error occurred, but was ignored. */ | ||
244 | # define ECORE_CONFIG_ERR_NODATA (-2) /* Error given when necessary data is not provided. */ | ||
245 | # define ECORE_CONFIG_ERR_FAIL (-1) /* Failure result. */ | ||
246 | # define ECORE_CONFIG_ERR_SUCC (0) /* Success result. */ | ||
247 | |||
248 | # define ECORE_CONFIG_PARSE_HELP (-2) /* Help was displayed */ | ||
249 | # define ECORE_CONFIG_PARSE_EXIT (-1) /* An error occurred */ | ||
250 | # define ECORE_CONFIG_PARSE_CONTINUE (0) /* Arguments parsed successfully */ | ||
251 | |||
252 | /* convenience mathods in convenience.c */ | ||
253 | /* FIXME: this should only be included if evas is present */ | ||
254 | EAPI int ecore_config_evas_font_path_apply(Evas *evas); | ||
255 | EAPI char *ecore_config_theme_search_path_get(void); | ||
256 | EAPI int ecore_config_theme_search_path_append(const char *append); | ||
257 | |||
258 | EAPI char *ecore_config_theme_default_path_get(void); | ||
259 | EAPI char *ecore_config_theme_with_path_from_name_get(char *name); | ||
260 | EAPI char *ecore_config_theme_with_path_get(const char *key); | ||
261 | EAPI void ecore_config_args_display(void); | ||
262 | EAPI int ecore_config_args_parse(void); | ||
263 | EAPI void ecore_config_args_callback_str_add(char short_opt, | ||
264 | char *long_opt, char *desc, | ||
265 | void (*func)(char *val, void *data), | ||
266 | void *data); | ||
267 | EAPI void ecore_config_args_callback_noarg_add(char short_opt, | ||
268 | char *long_opt, char *desc, | ||
269 | void (*func)(char *val, void *data), | ||
270 | void *data); | ||
271 | EAPI void ecore_config_app_describe(char *description); | ||
272 | |||
273 | EAPI int ecore_config_create(const char *key, void *val, | ||
274 | char short_opt, char *long_opt, | ||
275 | char *desc); | ||
276 | EAPI int ecore_config_typed_create(const char *key, void *val, | ||
277 | int type, char short_opt, | ||
278 | char *long_opt, char *desc); | ||
279 | EAPI int ecore_config_boolean_create(const char *key, int val, | ||
280 | char short_opt, char *long_opt, | ||
281 | char *desc); | ||
282 | EAPI int ecore_config_int_create(const char *key, int val, | ||
283 | char short_opt, char *long_opt, | ||
284 | char *desc); | ||
285 | EAPI int ecore_config_int_create_bound(const char *key, int val, | ||
286 | int low, int high, | ||
287 | int step, char short_opt, | ||
288 | char *long_opt, | ||
289 | char *desc); | ||
290 | EAPI int ecore_config_string_create(const char *key, char *val, | ||
291 | char short_opt, | ||
292 | char *long_opt, char *desc); | ||
293 | EAPI int ecore_config_float_create(const char *key, float val, | ||
294 | char short_opt, char *long_opt, | ||
295 | char *desc); | ||
296 | EAPI int ecore_config_float_create_bound(const char *key, | ||
297 | float val, float low, | ||
298 | float high, float step, | ||
299 | char short_opt, | ||
300 | char *long_opt, | ||
301 | char *desc); | ||
302 | EAPI int ecore_config_argb_create(const char *key, char *val, | ||
303 | char short_opt, char *long_opt, | ||
304 | char *desc); | ||
305 | EAPI int ecore_config_theme_create(const char *key, char *val, | ||
306 | char short_opt, char *long_opt, | ||
307 | char *desc); | ||
308 | |||
309 | # ifdef __cplusplus | ||
310 | } | ||
311 | # endif | ||
312 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.am b/libraries/ecore/src/lib/ecore_config/Makefile.am deleted file mode 100644 index c459351..0000000 --- a/libraries/ecore/src/lib/ecore_config/Makefile.am +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | MAINTAINERCLEANFILES = Makefile.in | ||
2 | |||
3 | AM_CPPFLAGS = \ | ||
4 | -I$(top_srcdir)/src/lib/ecore \ | ||
5 | -I$(top_srcdir)/src/lib/ecore_ipc \ | ||
6 | -I$(top_srcdir)/ \ | ||
7 | -I$(top_builddir)/src/lib/ecore \ | ||
8 | -I$(top_builddir)/src/lib/ecore_ipc \ | ||
9 | -I$(top_builddir)/ \ | ||
10 | -DPACKAGE_BIN_DIR=\"$(bindir)\" \ | ||
11 | -DPACKAGE_LIB_DIR=\"$(libdir)\" \ | ||
12 | -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ | ||
13 | @EVAS_CFLAGS@ \ | ||
14 | @EET_CFLAGS@ \ | ||
15 | @EINA_CFLAGS@ | ||
16 | |||
17 | CLEANFILES = $(DB) | ||
18 | |||
19 | #DB = system.db | ||
20 | #$(DB): Makefile | ||
21 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/theme/name str "winter" | ||
22 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/font/path str "$(pkgdatadir)/data/fonts" | ||
23 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/browser str `which firefox 2>/dev/null || which phoenix 2>/dev/null || which mozilla 2>/dev/null || which opera 2>/dev/null || which konqueror 2>/dev/null || which epiphany 2>/dev/null` | ||
24 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/email str `which thunderbird 2>/dev/null || which mozilla 2>/dev/null || which kmail 2>/dev/null || which sylpheed 2>/dev/null || which evolution 2>/dev/null` | ||
25 | |||
26 | lib_LTLIBRARIES = libecore_config.la | ||
27 | |||
28 | includes_HEADERS = Ecore_Config.h | ||
29 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
30 | |||
31 | libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ | ||
32 | |||
33 | #config_DATA = $(DB) | ||
34 | #configdir = $(pkgdatadir) | ||
35 | |||
36 | libecore_config_la_SOURCES = \ | ||
37 | ecore_config.c \ | ||
38 | ecore_config_util.c \ | ||
39 | ecore_config_storage.c \ | ||
40 | ecore_config_extra.c \ | ||
41 | ecore_config_db.c | ||
42 | |||
43 | libecore_config_la_LIBADD = \ | ||
44 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
45 | @EET_LIBS@ \ | ||
46 | @EINA_LIBS@ \ | ||
47 | @EVAS_LIBS@ | ||
48 | |||
49 | if BUILD_ECORE_IPC | ||
50 | |||
51 | libecore_config_la_SOURCES += \ | ||
52 | ecore_config_ipc_main.c \ | ||
53 | ecore_config_ipc_ecore.c | ||
54 | |||
55 | libecore_config_la_LIBADD += $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la | ||
56 | |||
57 | endif | ||
58 | |||
59 | EXTRA_DIST = \ | ||
60 | ecore_config_ipc.h \ | ||
61 | ecore_config_private.h \ | ||
62 | ecore_config_util.h | ||
diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.in b/libraries/ecore/src/lib/ecore_config/Makefile.in deleted file mode 100644 index 4b908cd..0000000 --- a/libraries/ecore/src/lib/ecore_config/Makefile.in +++ /dev/null | |||
@@ -1,869 +0,0 @@ | |||
1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
2 | # @configure_input@ | ||
3 | |||
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
6 | # Inc. | ||
7 | # This Makefile.in is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
14 | # PARTICULAR PURPOSE. | ||
15 | |||
16 | @SET_MAKE@ | ||
17 | |||
18 | |||
19 | VPATH = @srcdir@ | ||
20 | pkgdatadir = $(datadir)/@PACKAGE@ | ||
21 | pkgincludedir = $(includedir)/@PACKAGE@ | ||
22 | pkglibdir = $(libdir)/@PACKAGE@ | ||
23 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
24 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
25 | install_sh_DATA = $(install_sh) -c -m 644 | ||
26 | install_sh_PROGRAM = $(install_sh) -c | ||
27 | install_sh_SCRIPT = $(install_sh) -c | ||
28 | INSTALL_HEADER = $(INSTALL_DATA) | ||
29 | transform = $(program_transform_name) | ||
30 | NORMAL_INSTALL = : | ||
31 | PRE_INSTALL = : | ||
32 | POST_INSTALL = : | ||
33 | NORMAL_UNINSTALL = : | ||
34 | PRE_UNINSTALL = : | ||
35 | POST_UNINSTALL = : | ||
36 | build_triplet = @build@ | ||
37 | host_triplet = @host@ | ||
38 | @BUILD_ECORE_IPC_TRUE@am__append_1 = \ | ||
39 | @BUILD_ECORE_IPC_TRUE@ecore_config_ipc_main.c \ | ||
40 | @BUILD_ECORE_IPC_TRUE@ecore_config_ipc_ecore.c | ||
41 | |||
42 | @BUILD_ECORE_IPC_TRUE@am__append_2 = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la | ||
43 | subdir = src/lib/ecore_config | ||
44 | DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ | ||
45 | $(srcdir)/Makefile.in | ||
46 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
47 | am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ | ||
48 | $(top_srcdir)/m4/ac_path_generic.m4 \ | ||
49 | $(top_srcdir)/m4/check_x_extension.m4 \ | ||
50 | $(top_srcdir)/m4/ecore_check_module.m4 \ | ||
51 | $(top_srcdir)/m4/ecore_check_options.m4 \ | ||
52 | $(top_srcdir)/m4/efl_compiler_flag.m4 \ | ||
53 | $(top_srcdir)/m4/efl_doxygen.m4 \ | ||
54 | $(top_srcdir)/m4/efl_examples.m4 \ | ||
55 | $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ | ||
56 | $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ | ||
57 | $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ | ||
58 | $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ | ||
59 | $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ | ||
60 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | ||
61 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | ||
62 | $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ | ||
63 | $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac | ||
64 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
65 | $(ACLOCAL_M4) | ||
66 | mkinstalldirs = $(install_sh) -d | ||
67 | CONFIG_HEADER = $(top_builddir)/config.h | ||
68 | CONFIG_CLEAN_FILES = | ||
69 | CONFIG_CLEAN_VPATH_FILES = | ||
70 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
71 | am__vpath_adj = case $$p in \ | ||
72 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
73 | *) f=$$p;; \ | ||
74 | esac; | ||
75 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | ||
76 | am__install_max = 40 | ||
77 | am__nobase_strip_setup = \ | ||
78 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | ||
79 | am__nobase_strip = \ | ||
80 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | ||
81 | am__nobase_list = $(am__nobase_strip_setup); \ | ||
82 | for p in $$list; do echo "$$p $$p"; done | \ | ||
83 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | ||
84 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | ||
85 | if (++n[$$2] == $(am__install_max)) \ | ||
86 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | ||
87 | END { for (dir in files) print dir, files[dir] }' | ||
88 | am__base_list = \ | ||
89 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | ||
90 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | ||
91 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" | ||
92 | LTLIBRARIES = $(lib_LTLIBRARIES) | ||
93 | libecore_config_la_DEPENDENCIES = \ | ||
94 | $(top_builddir)/src/lib/ecore/libecore.la $(am__append_2) | ||
95 | am__libecore_config_la_SOURCES_DIST = ecore_config.c \ | ||
96 | ecore_config_util.c ecore_config_storage.c \ | ||
97 | ecore_config_extra.c ecore_config_db.c ecore_config_ipc_main.c \ | ||
98 | ecore_config_ipc_ecore.c | ||
99 | @BUILD_ECORE_IPC_TRUE@am__objects_1 = ecore_config_ipc_main.lo \ | ||
100 | @BUILD_ECORE_IPC_TRUE@ ecore_config_ipc_ecore.lo | ||
101 | am_libecore_config_la_OBJECTS = ecore_config.lo ecore_config_util.lo \ | ||
102 | ecore_config_storage.lo ecore_config_extra.lo \ | ||
103 | ecore_config_db.lo $(am__objects_1) | ||
104 | libecore_config_la_OBJECTS = $(am_libecore_config_la_OBJECTS) | ||
105 | AM_V_lt = $(am__v_lt_$(V)) | ||
106 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||
107 | am__v_lt_0 = --silent | ||
108 | libecore_config_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ | ||
109 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ | ||
110 | $(AM_CFLAGS) $(CFLAGS) $(libecore_config_la_LDFLAGS) \ | ||
111 | $(LDFLAGS) -o $@ | ||
112 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
113 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
114 | am__depfiles_maybe = depfiles | ||
115 | am__mv = mv -f | ||
116 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
117 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
118 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
119 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | ||
120 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
121 | $(AM_CFLAGS) $(CFLAGS) | ||
122 | AM_V_CC = $(am__v_CC_$(V)) | ||
123 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||
124 | am__v_CC_0 = @echo " CC " $@; | ||
125 | AM_V_at = $(am__v_at_$(V)) | ||
126 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||
127 | am__v_at_0 = @ | ||
128 | CCLD = $(CC) | ||
129 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
130 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
131 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
132 | AM_V_CCLD = $(am__v_CCLD_$(V)) | ||
133 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||
134 | am__v_CCLD_0 = @echo " CCLD " $@; | ||
135 | AM_V_GEN = $(am__v_GEN_$(V)) | ||
136 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||
137 | am__v_GEN_0 = @echo " GEN " $@; | ||
138 | SOURCES = $(libecore_config_la_SOURCES) | ||
139 | DIST_SOURCES = $(am__libecore_config_la_SOURCES_DIST) | ||
140 | HEADERS = $(includes_HEADERS) | ||
141 | ETAGS = etags | ||
142 | CTAGS = ctags | ||
143 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
144 | ACLOCAL = @ACLOCAL@ | ||
145 | ALLOCA = @ALLOCA@ | ||
146 | AMTAR = @AMTAR@ | ||
147 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||
148 | AR = @AR@ | ||
149 | AS = @AS@ | ||
150 | AUTOCONF = @AUTOCONF@ | ||
151 | AUTOHEADER = @AUTOHEADER@ | ||
152 | AUTOMAKE = @AUTOMAKE@ | ||
153 | AWK = @AWK@ | ||
154 | CARES_CFLAGS = @CARES_CFLAGS@ | ||
155 | CARES_LIBS = @CARES_LIBS@ | ||
156 | CC = @CC@ | ||
157 | CCDEPMODE = @CCDEPMODE@ | ||
158 | CFLAGS = @CFLAGS@ | ||
159 | CHECK_CFLAGS = @CHECK_CFLAGS@ | ||
160 | CHECK_LIBS = @CHECK_LIBS@ | ||
161 | CPP = @CPP@ | ||
162 | CPPFLAGS = @CPPFLAGS@ | ||
163 | CURL_CFLAGS = @CURL_CFLAGS@ | ||
164 | CURL_LIBS = @CURL_LIBS@ | ||
165 | CXX = @CXX@ | ||
166 | CXXCPP = @CXXCPP@ | ||
167 | CXXDEPMODE = @CXXDEPMODE@ | ||
168 | CXXFLAGS = @CXXFLAGS@ | ||
169 | CYGPATH_W = @CYGPATH_W@ | ||
170 | DEFS = @DEFS@ | ||
171 | DEPDIR = @DEPDIR@ | ||
172 | DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ | ||
173 | DIRECTFB_LIBS = @DIRECTFB_LIBS@ | ||
174 | DLLTOOL = @DLLTOOL@ | ||
175 | DSYMUTIL = @DSYMUTIL@ | ||
176 | DUMPBIN = @DUMPBIN@ | ||
177 | ECHO_C = @ECHO_C@ | ||
178 | ECHO_N = @ECHO_N@ | ||
179 | ECHO_T = @ECHO_T@ | ||
180 | ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ | ||
181 | ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ | ||
182 | EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ | ||
183 | EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ | ||
184 | EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ | ||
185 | EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ | ||
186 | EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ | ||
187 | EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ | ||
188 | EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ | ||
189 | EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ | ||
190 | EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ | ||
191 | EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ | ||
192 | EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ | ||
193 | EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ | ||
194 | EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ | ||
195 | EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ | ||
196 | EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ | ||
197 | EGREP = @EGREP@ | ||
198 | EINA_CFLAGS = @EINA_CFLAGS@ | ||
199 | EINA_LIBS = @EINA_LIBS@ | ||
200 | ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ | ||
201 | ESCAPE_LIBS = @ESCAPE_LIBS@ | ||
202 | EVAS_CFLAGS = @EVAS_CFLAGS@ | ||
203 | EVAS_LIBS = @EVAS_LIBS@ | ||
204 | EVIL_CFLAGS = @EVIL_CFLAGS@ | ||
205 | EVIL_LIBS = @EVIL_LIBS@ | ||
206 | EXEEXT = @EXEEXT@ | ||
207 | EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ | ||
208 | EXOTIC_LIBS = @EXOTIC_LIBS@ | ||
209 | FGREP = @FGREP@ | ||
210 | GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ | ||
211 | GLIB_CFLAGS = @GLIB_CFLAGS@ | ||
212 | GLIB_LIBS = @GLIB_LIBS@ | ||
213 | GMSGFMT = @GMSGFMT@ | ||
214 | GMSGFMT_015 = @GMSGFMT_015@ | ||
215 | GREP = @GREP@ | ||
216 | INSTALL = @INSTALL@ | ||
217 | INSTALL_DATA = @INSTALL_DATA@ | ||
218 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
219 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
220 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
221 | INTLLIBS = @INTLLIBS@ | ||
222 | INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ | ||
223 | KEYSYMDEFS = @KEYSYMDEFS@ | ||
224 | LD = @LD@ | ||
225 | LDFLAGS = @LDFLAGS@ | ||
226 | LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ | ||
227 | LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ | ||
228 | LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ | ||
229 | LIBICONV = @LIBICONV@ | ||
230 | LIBINTL = @LIBINTL@ | ||
231 | LIBOBJS = @LIBOBJS@ | ||
232 | LIBS = @LIBS@ | ||
233 | LIBTOOL = @LIBTOOL@ | ||
234 | LIPO = @LIPO@ | ||
235 | LN_S = @LN_S@ | ||
236 | LTLIBICONV = @LTLIBICONV@ | ||
237 | LTLIBINTL = @LTLIBINTL@ | ||
238 | LTLIBOBJS = @LTLIBOBJS@ | ||
239 | MAKEINFO = @MAKEINFO@ | ||
240 | MKDIR_P = @MKDIR_P@ | ||
241 | MSGFMT = @MSGFMT@ | ||
242 | MSGFMT_015 = @MSGFMT_015@ | ||
243 | MSGMERGE = @MSGMERGE@ | ||
244 | NM = @NM@ | ||
245 | NMEDIT = @NMEDIT@ | ||
246 | OBJC = @OBJC@ | ||
247 | OBJCDEPMODE = @OBJCDEPMODE@ | ||
248 | OBJCFLAGS = @OBJCFLAGS@ | ||
249 | OBJDUMP = @OBJDUMP@ | ||
250 | OBJEXT = @OBJEXT@ | ||
251 | OTOOL = @OTOOL@ | ||
252 | OTOOL64 = @OTOOL64@ | ||
253 | PACKAGE = @PACKAGE@ | ||
254 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
255 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
256 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
257 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
258 | PACKAGE_URL = @PACKAGE_URL@ | ||
259 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
260 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
261 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | ||
262 | PIXMAN_LIBS = @PIXMAN_LIBS@ | ||
263 | PKG_CONFIG = @PKG_CONFIG@ | ||
264 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
265 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
266 | POSUB = @POSUB@ | ||
267 | RANLIB = @RANLIB@ | ||
268 | SCIM_CFLAGS = @SCIM_CFLAGS@ | ||
269 | SCIM_LIBS = @SCIM_LIBS@ | ||
270 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
271 | SDL_CONFIG = @SDL_CONFIG@ | ||
272 | SDL_LIBS = @SDL_LIBS@ | ||
273 | SED = @SED@ | ||
274 | SET_MAKE = @SET_MAKE@ | ||
275 | SHELL = @SHELL@ | ||
276 | SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ | ||
277 | SSL_CFLAGS = @SSL_CFLAGS@ | ||
278 | SSL_LIBS = @SSL_LIBS@ | ||
279 | STRIP = @STRIP@ | ||
280 | TLS2_CFLAGS = @TLS2_CFLAGS@ | ||
281 | TLS2_LIBS = @TLS2_LIBS@ | ||
282 | TLS_CFLAGS = @TLS_CFLAGS@ | ||
283 | TLS_LIBS = @TLS_LIBS@ | ||
284 | TSLIB_CFLAGS = @TSLIB_CFLAGS@ | ||
285 | TSLIB_LIBS = @TSLIB_LIBS@ | ||
286 | USE_NLS = @USE_NLS@ | ||
287 | VERSION = @VERSION@ | ||
288 | VMAJ = @VMAJ@ | ||
289 | WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ | ||
290 | WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ | ||
291 | WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ | ||
292 | WAYLAND_LIBS = @WAYLAND_LIBS@ | ||
293 | WIN32_CFLAGS = @WIN32_CFLAGS@ | ||
294 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | ||
295 | WIN32_LIBS = @WIN32_LIBS@ | ||
296 | XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ | ||
297 | XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ | ||
298 | XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ | ||
299 | XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ | ||
300 | XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ | ||
301 | XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ | ||
302 | XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ | ||
303 | XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ | ||
304 | XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ | ||
305 | XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ | ||
306 | XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ | ||
307 | XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ | ||
308 | XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ | ||
309 | XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ | ||
310 | XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ | ||
311 | XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ | ||
312 | XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ | ||
313 | XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ | ||
314 | XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ | ||
315 | XCB_X11_LIBS = @XCB_X11_LIBS@ | ||
316 | XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ | ||
317 | XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ | ||
318 | XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ | ||
319 | XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ | ||
320 | XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ | ||
321 | XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ | ||
322 | XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ | ||
323 | XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ | ||
324 | XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ | ||
325 | XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ | ||
326 | XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ | ||
327 | XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ | ||
328 | XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ | ||
329 | XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ | ||
330 | XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ | ||
331 | XDAMAGE_LIBS = @XDAMAGE_LIBS@ | ||
332 | XDPMS_CFLAGS = @XDPMS_CFLAGS@ | ||
333 | XDPMS_LIBS = @XDPMS_LIBS@ | ||
334 | XFIXES_CFLAGS = @XFIXES_CFLAGS@ | ||
335 | XFIXES_LIBS = @XFIXES_LIBS@ | ||
336 | XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ | ||
337 | XGESTURE_LIBS = @XGESTURE_LIBS@ | ||
338 | XGETTEXT = @XGETTEXT@ | ||
339 | XGETTEXT_015 = @XGETTEXT_015@ | ||
340 | XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ | ||
341 | XI2_CFLAGS = @XI2_CFLAGS@ | ||
342 | XI2_LIBS = @XI2_LIBS@ | ||
343 | XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ | ||
344 | XINERAMA_LIBS = @XINERAMA_LIBS@ | ||
345 | XKB_CFLAGS = @XKB_CFLAGS@ | ||
346 | XKB_LIBS = @XKB_LIBS@ | ||
347 | XMKMF = @XMKMF@ | ||
348 | XPRINT_CFLAGS = @XPRINT_CFLAGS@ | ||
349 | XPRINT_LIBS = @XPRINT_LIBS@ | ||
350 | XRANDR_CFLAGS = @XRANDR_CFLAGS@ | ||
351 | XRANDR_LIBS = @XRANDR_LIBS@ | ||
352 | XRENDER_CFLAGS = @XRENDER_CFLAGS@ | ||
353 | XRENDER_LIBS = @XRENDER_LIBS@ | ||
354 | XSS_CFLAGS = @XSS_CFLAGS@ | ||
355 | XSS_LIBS = @XSS_LIBS@ | ||
356 | XTEST_CFLAGS = @XTEST_CFLAGS@ | ||
357 | XTEST_LIBS = @XTEST_LIBS@ | ||
358 | X_CFLAGS = @X_CFLAGS@ | ||
359 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ | ||
360 | X_LIBS = @X_LIBS@ | ||
361 | X_PRE_LIBS = @X_PRE_LIBS@ | ||
362 | Xcursor_cflags = @Xcursor_cflags@ | ||
363 | Xcursor_libs = @Xcursor_libs@ | ||
364 | abs_builddir = @abs_builddir@ | ||
365 | abs_srcdir = @abs_srcdir@ | ||
366 | abs_top_builddir = @abs_top_builddir@ | ||
367 | abs_top_srcdir = @abs_top_srcdir@ | ||
368 | ac_ct_CC = @ac_ct_CC@ | ||
369 | ac_ct_CXX = @ac_ct_CXX@ | ||
370 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
371 | ac_ct_OBJC = @ac_ct_OBJC@ | ||
372 | am__include = @am__include@ | ||
373 | am__leading_dot = @am__leading_dot@ | ||
374 | am__quote = @am__quote@ | ||
375 | am__tar = @am__tar@ | ||
376 | am__untar = @am__untar@ | ||
377 | bindir = @bindir@ | ||
378 | build = @build@ | ||
379 | build_alias = @build_alias@ | ||
380 | build_cpu = @build_cpu@ | ||
381 | build_os = @build_os@ | ||
382 | build_vendor = @build_vendor@ | ||
383 | builddir = @builddir@ | ||
384 | cocoa_ldflags = @cocoa_ldflags@ | ||
385 | datadir = @datadir@ | ||
386 | datarootdir = @datarootdir@ | ||
387 | dlopen_libs = @dlopen_libs@ | ||
388 | docdir = @docdir@ | ||
389 | dvidir = @dvidir@ | ||
390 | ecore_cocoa_cflags = @ecore_cocoa_cflags@ | ||
391 | ecore_cocoa_libs = @ecore_cocoa_libs@ | ||
392 | ecore_con_cflags = @ecore_con_cflags@ | ||
393 | ecore_con_libs = @ecore_con_libs@ | ||
394 | ecore_directfb_cflags = @ecore_directfb_cflags@ | ||
395 | ecore_directfb_libs = @ecore_directfb_libs@ | ||
396 | ecore_evas_cflags = @ecore_evas_cflags@ | ||
397 | ecore_evas_libs = @ecore_evas_libs@ | ||
398 | ecore_fb_cflags = @ecore_fb_cflags@ | ||
399 | ecore_fb_libs = @ecore_fb_libs@ | ||
400 | ecore_file_cflags = @ecore_file_cflags@ | ||
401 | ecore_file_libs = @ecore_file_libs@ | ||
402 | ecore_imf_cflags = @ecore_imf_cflags@ | ||
403 | ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ | ||
404 | ecore_imf_evas_libs = @ecore_imf_evas_libs@ | ||
405 | ecore_imf_libs = @ecore_imf_libs@ | ||
406 | ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ | ||
407 | ecore_imf_scim_libs = @ecore_imf_scim_libs@ | ||
408 | ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ | ||
409 | ecore_imf_xim_libs = @ecore_imf_xim_libs@ | ||
410 | ecore_input_cflags = @ecore_input_cflags@ | ||
411 | ecore_input_evas_cflags = @ecore_input_evas_cflags@ | ||
412 | ecore_input_evas_libs = @ecore_input_evas_libs@ | ||
413 | ecore_input_libs = @ecore_input_libs@ | ||
414 | ecore_ipc_cflags = @ecore_ipc_cflags@ | ||
415 | ecore_ipc_libs = @ecore_ipc_libs@ | ||
416 | ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ | ||
417 | ecore_psl1ght_libs = @ecore_psl1ght_libs@ | ||
418 | ecore_sdl_cflags = @ecore_sdl_cflags@ | ||
419 | ecore_sdl_libs = @ecore_sdl_libs@ | ||
420 | ecore_wayland_cflags = @ecore_wayland_cflags@ | ||
421 | ecore_wayland_libs = @ecore_wayland_libs@ | ||
422 | ecore_win32_cflags = @ecore_win32_cflags@ | ||
423 | ecore_win32_libs = @ecore_win32_libs@ | ||
424 | ecore_wince_cflags = @ecore_wince_cflags@ | ||
425 | ecore_wince_libs = @ecore_wince_libs@ | ||
426 | ecore_x_cflags = @ecore_x_cflags@ | ||
427 | ecore_x_libs = @ecore_x_libs@ | ||
428 | ecore_x_libs_private = @ecore_x_libs_private@ | ||
429 | efl_doxygen = @efl_doxygen@ | ||
430 | efl_have_doxygen = @efl_have_doxygen@ | ||
431 | exec_prefix = @exec_prefix@ | ||
432 | have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ | ||
433 | host = @host@ | ||
434 | host_alias = @host_alias@ | ||
435 | host_cpu = @host_cpu@ | ||
436 | host_os = @host_os@ | ||
437 | host_vendor = @host_vendor@ | ||
438 | htmldir = @htmldir@ | ||
439 | includedir = @includedir@ | ||
440 | infodir = @infodir@ | ||
441 | install_sh = @install_sh@ | ||
442 | libdir = @libdir@ | ||
443 | libexecdir = @libexecdir@ | ||
444 | localedir = @localedir@ | ||
445 | localstatedir = @localstatedir@ | ||
446 | lt_ECHO = @lt_ECHO@ | ||
447 | lt_enable_auto_import = @lt_enable_auto_import@ | ||
448 | mandir = @mandir@ | ||
449 | mkdir_p = @mkdir_p@ | ||
450 | oldincludedir = @oldincludedir@ | ||
451 | pdfdir = @pdfdir@ | ||
452 | pkgconfig_requires_private = @pkgconfig_requires_private@ | ||
453 | prefix = @prefix@ | ||
454 | program_transform_name = @program_transform_name@ | ||
455 | psdir = @psdir@ | ||
456 | release_info = @release_info@ | ||
457 | requirements_ecore = @requirements_ecore@ | ||
458 | requirements_ecore_cocoa = @requirements_ecore_cocoa@ | ||
459 | requirements_ecore_con = @requirements_ecore_con@ | ||
460 | requirements_ecore_directfb = @requirements_ecore_directfb@ | ||
461 | requirements_ecore_evas = @requirements_ecore_evas@ | ||
462 | requirements_ecore_fb = @requirements_ecore_fb@ | ||
463 | requirements_ecore_file = @requirements_ecore_file@ | ||
464 | requirements_ecore_imf = @requirements_ecore_imf@ | ||
465 | requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ | ||
466 | requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ | ||
467 | requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ | ||
468 | requirements_ecore_input = @requirements_ecore_input@ | ||
469 | requirements_ecore_input_evas = @requirements_ecore_input_evas@ | ||
470 | requirements_ecore_ipc = @requirements_ecore_ipc@ | ||
471 | requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ | ||
472 | requirements_ecore_sdl = @requirements_ecore_sdl@ | ||
473 | requirements_ecore_wayland = @requirements_ecore_wayland@ | ||
474 | requirements_ecore_win32 = @requirements_ecore_win32@ | ||
475 | requirements_ecore_wince = @requirements_ecore_wince@ | ||
476 | requirements_ecore_x = @requirements_ecore_x@ | ||
477 | rt_libs = @rt_libs@ | ||
478 | sbindir = @sbindir@ | ||
479 | sharedstatedir = @sharedstatedir@ | ||
480 | srcdir = @srcdir@ | ||
481 | sysconfdir = @sysconfdir@ | ||
482 | target_alias = @target_alias@ | ||
483 | top_build_prefix = @top_build_prefix@ | ||
484 | top_builddir = @top_builddir@ | ||
485 | top_srcdir = @top_srcdir@ | ||
486 | version_info = @version_info@ | ||
487 | x_cflags = @x_cflags@ | ||
488 | x_includes = @x_includes@ | ||
489 | x_libs = @x_libs@ | ||
490 | MAINTAINERCLEANFILES = Makefile.in | ||
491 | AM_CPPFLAGS = \ | ||
492 | -I$(top_srcdir)/src/lib/ecore \ | ||
493 | -I$(top_srcdir)/src/lib/ecore_ipc \ | ||
494 | -I$(top_srcdir)/ \ | ||
495 | -I$(top_builddir)/src/lib/ecore \ | ||
496 | -I$(top_builddir)/src/lib/ecore_ipc \ | ||
497 | -I$(top_builddir)/ \ | ||
498 | -DPACKAGE_BIN_DIR=\"$(bindir)\" \ | ||
499 | -DPACKAGE_LIB_DIR=\"$(libdir)\" \ | ||
500 | -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ | ||
501 | @EVAS_CFLAGS@ \ | ||
502 | @EET_CFLAGS@ \ | ||
503 | @EINA_CFLAGS@ | ||
504 | |||
505 | CLEANFILES = $(DB) | ||
506 | |||
507 | #DB = system.db | ||
508 | #$(DB): Makefile | ||
509 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/theme/name str "winter" | ||
510 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/font/path str "$(pkgdatadir)/data/fonts" | ||
511 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/browser str `which firefox 2>/dev/null || which phoenix 2>/dev/null || which mozilla 2>/dev/null || which opera 2>/dev/null || which konqueror 2>/dev/null || which epiphany 2>/dev/null` | ||
512 | # edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/email str `which thunderbird 2>/dev/null || which mozilla 2>/dev/null || which kmail 2>/dev/null || which sylpheed 2>/dev/null || which evolution 2>/dev/null` | ||
513 | lib_LTLIBRARIES = libecore_config.la | ||
514 | includes_HEADERS = Ecore_Config.h | ||
515 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
516 | libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ | ||
517 | |||
518 | #config_DATA = $(DB) | ||
519 | #configdir = $(pkgdatadir) | ||
520 | libecore_config_la_SOURCES = ecore_config.c ecore_config_util.c \ | ||
521 | ecore_config_storage.c ecore_config_extra.c ecore_config_db.c \ | ||
522 | $(am__append_1) | ||
523 | libecore_config_la_LIBADD = $(top_builddir)/src/lib/ecore/libecore.la \ | ||
524 | @EET_LIBS@ @EINA_LIBS@ @EVAS_LIBS@ $(am__append_2) | ||
525 | EXTRA_DIST = \ | ||
526 | ecore_config_ipc.h \ | ||
527 | ecore_config_private.h \ | ||
528 | ecore_config_util.h | ||
529 | |||
530 | all: all-am | ||
531 | |||
532 | .SUFFIXES: | ||
533 | .SUFFIXES: .c .lo .o .obj | ||
534 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
535 | @for dep in $?; do \ | ||
536 | case '$(am__configure_deps)' in \ | ||
537 | *$$dep*) \ | ||
538 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
539 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
540 | exit 1;; \ | ||
541 | esac; \ | ||
542 | done; \ | ||
543 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_config/Makefile'; \ | ||
544 | $(am__cd) $(top_srcdir) && \ | ||
545 | $(AUTOMAKE) --gnu src/lib/ecore_config/Makefile | ||
546 | .PRECIOUS: Makefile | ||
547 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
548 | @case '$?' in \ | ||
549 | *config.status*) \ | ||
550 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
551 | *) \ | ||
552 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
553 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
554 | esac; | ||
555 | |||
556 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
557 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
558 | |||
559 | $(top_srcdir)/configure: $(am__configure_deps) | ||
560 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
561 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
562 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
563 | $(am__aclocal_m4_deps): | ||
564 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) | ||
565 | @$(NORMAL_INSTALL) | ||
566 | test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" | ||
567 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
568 | list2=; for p in $$list; do \ | ||
569 | if test -f $$p; then \ | ||
570 | list2="$$list2 $$p"; \ | ||
571 | else :; fi; \ | ||
572 | done; \ | ||
573 | test -z "$$list2" || { \ | ||
574 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ | ||
575 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ | ||
576 | } | ||
577 | |||
578 | uninstall-libLTLIBRARIES: | ||
579 | @$(NORMAL_UNINSTALL) | ||
580 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
581 | for p in $$list; do \ | ||
582 | $(am__strip_dir) \ | ||
583 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ | ||
584 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ | ||
585 | done | ||
586 | |||
587 | clean-libLTLIBRARIES: | ||
588 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) | ||
589 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ | ||
590 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ | ||
591 | test "$$dir" != "$$p" || dir=.; \ | ||
592 | echo "rm -f \"$${dir}/so_locations\""; \ | ||
593 | rm -f "$${dir}/so_locations"; \ | ||
594 | done | ||
595 | libecore_config.la: $(libecore_config_la_OBJECTS) $(libecore_config_la_DEPENDENCIES) | ||
596 | $(AM_V_CCLD)$(libecore_config_la_LINK) -rpath $(libdir) $(libecore_config_la_OBJECTS) $(libecore_config_la_LIBADD) $(LIBS) | ||
597 | |||
598 | mostlyclean-compile: | ||
599 | -rm -f *.$(OBJEXT) | ||
600 | |||
601 | distclean-compile: | ||
602 | -rm -f *.tab.c | ||
603 | |||
604 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config.Plo@am__quote@ | ||
605 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_db.Plo@am__quote@ | ||
606 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_extra.Plo@am__quote@ | ||
607 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_ipc_ecore.Plo@am__quote@ | ||
608 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_ipc_main.Plo@am__quote@ | ||
609 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_storage.Plo@am__quote@ | ||
610 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_util.Plo@am__quote@ | ||
611 | |||
612 | .c.o: | ||
613 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
614 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
615 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
616 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
617 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
618 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
619 | |||
620 | .c.obj: | ||
621 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
622 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
623 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
624 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
625 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
626 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
627 | |||
628 | .c.lo: | ||
629 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
630 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
631 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
632 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
633 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
634 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< | ||
635 | |||
636 | mostlyclean-libtool: | ||
637 | -rm -f *.lo | ||
638 | |||
639 | clean-libtool: | ||
640 | -rm -rf .libs _libs | ||
641 | install-includesHEADERS: $(includes_HEADERS) | ||
642 | @$(NORMAL_INSTALL) | ||
643 | test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" | ||
644 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
645 | for p in $$list; do \ | ||
646 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
647 | echo "$$d$$p"; \ | ||
648 | done | $(am__base_list) | \ | ||
649 | while read files; do \ | ||
650 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ | ||
651 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ | ||
652 | done | ||
653 | |||
654 | uninstall-includesHEADERS: | ||
655 | @$(NORMAL_UNINSTALL) | ||
656 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
657 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | ||
658 | test -n "$$files" || exit 0; \ | ||
659 | echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ | ||
660 | cd "$(DESTDIR)$(includesdir)" && rm -f $$files | ||
661 | |||
662 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
663 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
664 | unique=`for i in $$list; do \ | ||
665 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
666 | done | \ | ||
667 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
668 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
669 | mkid -fID $$unique | ||
670 | tags: TAGS | ||
671 | |||
672 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
673 | $(TAGS_FILES) $(LISP) | ||
674 | set x; \ | ||
675 | here=`pwd`; \ | ||
676 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
677 | unique=`for i in $$list; do \ | ||
678 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
679 | done | \ | ||
680 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
681 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
682 | shift; \ | ||
683 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
684 | test -n "$$unique" || unique=$$empty_fix; \ | ||
685 | if test $$# -gt 0; then \ | ||
686 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
687 | "$$@" $$unique; \ | ||
688 | else \ | ||
689 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
690 | $$unique; \ | ||
691 | fi; \ | ||
692 | fi | ||
693 | ctags: CTAGS | ||
694 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
695 | $(TAGS_FILES) $(LISP) | ||
696 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
697 | unique=`for i in $$list; do \ | ||
698 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
699 | done | \ | ||
700 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
701 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
702 | test -z "$(CTAGS_ARGS)$$unique" \ | ||
703 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
704 | $$unique | ||
705 | |||
706 | GTAGS: | ||
707 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
708 | && $(am__cd) $(top_srcdir) \ | ||
709 | && gtags -i $(GTAGS_ARGS) "$$here" | ||
710 | |||
711 | distclean-tags: | ||
712 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
713 | |||
714 | distdir: $(DISTFILES) | ||
715 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
716 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
717 | list='$(DISTFILES)'; \ | ||
718 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
719 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
720 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
721 | case $$dist_files in \ | ||
722 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
723 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
724 | sort -u` ;; \ | ||
725 | esac; \ | ||
726 | for file in $$dist_files; do \ | ||
727 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
728 | if test -d $$d/$$file; then \ | ||
729 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
730 | if test -d "$(distdir)/$$file"; then \ | ||
731 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
732 | fi; \ | ||
733 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
734 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
735 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
736 | fi; \ | ||
737 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
738 | else \ | ||
739 | test -f "$(distdir)/$$file" \ | ||
740 | || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
741 | || exit 1; \ | ||
742 | fi; \ | ||
743 | done | ||
744 | check-am: all-am | ||
745 | check: check-am | ||
746 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | ||
747 | installdirs: | ||
748 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ | ||
749 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
750 | done | ||
751 | install: install-am | ||
752 | install-exec: install-exec-am | ||
753 | install-data: install-data-am | ||
754 | uninstall: uninstall-am | ||
755 | |||
756 | install-am: all-am | ||
757 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
758 | |||
759 | installcheck: installcheck-am | ||
760 | install-strip: | ||
761 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
762 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
763 | `test -z '$(STRIP)' || \ | ||
764 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
765 | mostlyclean-generic: | ||
766 | |||
767 | clean-generic: | ||
768 | -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) | ||
769 | |||
770 | distclean-generic: | ||
771 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
772 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
773 | |||
774 | maintainer-clean-generic: | ||
775 | @echo "This command is intended for maintainers to use" | ||
776 | @echo "it deletes files that may require special tools to rebuild." | ||
777 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | ||
778 | clean: clean-am | ||
779 | |||
780 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ | ||
781 | mostlyclean-am | ||
782 | |||
783 | distclean: distclean-am | ||
784 | -rm -rf ./$(DEPDIR) | ||
785 | -rm -f Makefile | ||
786 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
787 | distclean-tags | ||
788 | |||
789 | dvi: dvi-am | ||
790 | |||
791 | dvi-am: | ||
792 | |||
793 | html: html-am | ||
794 | |||
795 | html-am: | ||
796 | |||
797 | info: info-am | ||
798 | |||
799 | info-am: | ||
800 | |||
801 | install-data-am: install-includesHEADERS | ||
802 | |||
803 | install-dvi: install-dvi-am | ||
804 | |||
805 | install-dvi-am: | ||
806 | |||
807 | install-exec-am: install-libLTLIBRARIES | ||
808 | |||
809 | install-html: install-html-am | ||
810 | |||
811 | install-html-am: | ||
812 | |||
813 | install-info: install-info-am | ||
814 | |||
815 | install-info-am: | ||
816 | |||
817 | install-man: | ||
818 | |||
819 | install-pdf: install-pdf-am | ||
820 | |||
821 | install-pdf-am: | ||
822 | |||
823 | install-ps: install-ps-am | ||
824 | |||
825 | install-ps-am: | ||
826 | |||
827 | installcheck-am: | ||
828 | |||
829 | maintainer-clean: maintainer-clean-am | ||
830 | -rm -rf ./$(DEPDIR) | ||
831 | -rm -f Makefile | ||
832 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
833 | |||
834 | mostlyclean: mostlyclean-am | ||
835 | |||
836 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | ||
837 | mostlyclean-libtool | ||
838 | |||
839 | pdf: pdf-am | ||
840 | |||
841 | pdf-am: | ||
842 | |||
843 | ps: ps-am | ||
844 | |||
845 | ps-am: | ||
846 | |||
847 | uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES | ||
848 | |||
849 | .MAKE: install-am install-strip | ||
850 | |||
851 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
852 | clean-libLTLIBRARIES clean-libtool ctags distclean \ | ||
853 | distclean-compile distclean-generic distclean-libtool \ | ||
854 | distclean-tags distdir dvi dvi-am html html-am info info-am \ | ||
855 | install install-am install-data install-data-am install-dvi \ | ||
856 | install-dvi-am install-exec install-exec-am install-html \ | ||
857 | install-html-am install-includesHEADERS install-info \ | ||
858 | install-info-am install-libLTLIBRARIES install-man install-pdf \ | ||
859 | install-pdf-am install-ps install-ps-am install-strip \ | ||
860 | installcheck installcheck-am installdirs maintainer-clean \ | ||
861 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
862 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
863 | tags uninstall uninstall-am uninstall-includesHEADERS \ | ||
864 | uninstall-libLTLIBRARIES | ||
865 | |||
866 | |||
867 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
868 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
869 | .NOEXPORT: | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config.c b/libraries/ecore/src/lib/ecore_config/ecore_config.c deleted file mode 100644 index e81538e..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config.c +++ /dev/null | |||
@@ -1,1870 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | #include <ctype.h> | ||
7 | #include <stdio.h> | ||
8 | #include <stdlib.h> | ||
9 | |||
10 | #include <sys/param.h> | ||
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <fcntl.h> | ||
14 | #include <limits.h> | ||
15 | #include <unistd.h> | ||
16 | |||
17 | #include "Ecore_Config.h" | ||
18 | #include "ecore_config_private.h" | ||
19 | #include "ecore_config_ipc.h" | ||
20 | |||
21 | #include "ecore_config_util.h" | ||
22 | int _ecore_config_log_dom = -1; | ||
23 | int DEBUG = 0; | ||
24 | EAPI Ecore_Config_Server *__ecore_config_server_global = NULL; | ||
25 | EAPI Ecore_Config_Server *__ecore_config_server_local = NULL; | ||
26 | EAPI Ecore_Config_Bundle *__ecore_config_bundle_local = NULL; | ||
27 | EAPI char *__ecore_config_app_name = NULL; | ||
28 | int __ecore_config_system_init = 0; | ||
29 | |||
30 | static int _ecore_config_system_init_no_load(void); | ||
31 | static int _ecore_config_system_load(void); | ||
32 | |||
33 | static inline void *__ecore_argb_to_long(int a, int r, int g, int b, long *v); | ||
34 | static inline void *__ecore_argbstr_to_long(const char *argb, long *v); | ||
35 | |||
36 | static const char *_ecore_config_type[] = | ||
37 | { "undefined", "integer", "float", "string", "colour", "theme", "boolean", "structure" }; | ||
38 | |||
39 | /** | ||
40 | * @defgroup Ecore_Config_Property_Group Ecore Config Property Functions | ||
41 | * | ||
42 | * Functions that retrieve or set the attributes relating to a property. | ||
43 | */ | ||
44 | |||
45 | /** | ||
46 | * Removes the given property from the local configuration and destroys it. | ||
47 | * @param e Property to destroy. | ||
48 | * @return @c NULL | ||
49 | * @ingroup Ecore_Config_Property_Group | ||
50 | */ | ||
51 | EAPI Ecore_Config_Prop * | ||
52 | ecore_config_dst(Ecore_Config_Prop * e) | ||
53 | { | ||
54 | Ecore_Config_Bundle *t; | ||
55 | Ecore_Config_Prop *p, *c; | ||
56 | Ecore_Config_Listener_List *l; | ||
57 | |||
58 | p = NULL; | ||
59 | t = __ecore_config_bundle_local; | ||
60 | c = t->data; | ||
61 | |||
62 | if (!e || !e->key) | ||
63 | return NULL; | ||
64 | if (t) | ||
65 | { | ||
66 | if (t->data == e) | ||
67 | t->data = e->next; | ||
68 | else | ||
69 | { | ||
70 | do | ||
71 | { | ||
72 | p = c; | ||
73 | c = c->next; | ||
74 | } | ||
75 | while (c && (c != e)); | ||
76 | if (c) /* remove from list if even in there */ | ||
77 | p->next = c->next; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | while (e->listeners) | ||
82 | { | ||
83 | l = e->listeners; | ||
84 | e->listeners = e->listeners->next; | ||
85 | free(l); | ||
86 | } | ||
87 | |||
88 | if (e->key) | ||
89 | free(e->key); | ||
90 | if (e->ptr && ((e->type == ECORE_CONFIG_STR) || (e->type == ECORE_CONFIG_THM))) | ||
91 | free(e->ptr); | ||
92 | |||
93 | memset(e, 0, sizeof(Ecore_Config_Prop)); | ||
94 | free(e); | ||
95 | |||
96 | return NULL; | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * @defgroup Ecore_Config_Get_Group Configuration Retrieve Functions | ||
101 | * | ||
102 | * Functions that retrieve configuration values, based on type. | ||
103 | */ | ||
104 | |||
105 | /** | ||
106 | * Returns the property with the given key. | ||
107 | * @param key The unique name of the wanted property. | ||
108 | * @return The property that corresponds to the given key. @c NULL if the | ||
109 | * key could not be found. | ||
110 | * @ingroup Ecore_Config_Get_Group | ||
111 | */ | ||
112 | EAPI Ecore_Config_Prop * | ||
113 | ecore_config_get(const char *key) | ||
114 | { | ||
115 | Ecore_Config_Bundle *t; | ||
116 | Ecore_Config_Prop *e; | ||
117 | |||
118 | t = __ecore_config_bundle_local; | ||
119 | if (!t || !key) | ||
120 | return NULL; | ||
121 | e = t->data; | ||
122 | while (e) | ||
123 | { | ||
124 | if (!strcmp(key, e->key)) | ||
125 | return e; | ||
126 | e = e->next; | ||
127 | } | ||
128 | return NULL; | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * Returns the type of the property. | ||
133 | * @param e Property to get the type of. | ||
134 | * @returns The type of the property. If the property is invalid, then the | ||
135 | * string "not found" is returned. | ||
136 | * @ingroup Ecore_Config_Property_Group | ||
137 | */ | ||
138 | EAPI const char * | ||
139 | ecore_config_type_get(const Ecore_Config_Prop * e) | ||
140 | { | ||
141 | if (e) | ||
142 | { | ||
143 | return _ecore_config_type[e->type]; | ||
144 | } | ||
145 | return "not found"; | ||
146 | } | ||
147 | |||
148 | /** | ||
149 | * Returns the specified property as a string. | ||
150 | * @param key The property key. | ||
151 | * @return The string value of the property. The function returns @c NULL if | ||
152 | * the property is not a string or is not set. | ||
153 | * @ingroup Ecore_Config_Get_Group | ||
154 | */ | ||
155 | EAPI char * | ||
156 | ecore_config_string_get(const char *key) | ||
157 | { | ||
158 | return _ecore_config_string_get( ecore_config_get(key) ); | ||
159 | } | ||
160 | |||
161 | char * | ||
162 | _ecore_config_string_get(Ecore_Config_Prop *e) | ||
163 | { | ||
164 | return (e && (e->type == ECORE_CONFIG_STR) && e->ptr) ? strdup(e->ptr) : NULL; | ||
165 | } | ||
166 | |||
167 | /** | ||
168 | * Returns the specified property as an integer. | ||
169 | * @param key The property key. | ||
170 | * @return The value of the property. The function returns -1 if the | ||
171 | * property is not an integer or is not set. | ||
172 | * @ingroup Ecore_Config_Get_Group | ||
173 | */ | ||
174 | EAPI int | ||
175 | ecore_config_boolean_get(const char *key) | ||
176 | { | ||
177 | return _ecore_config_boolean_get( ecore_config_get(key) ); | ||
178 | } | ||
179 | |||
180 | int | ||
181 | _ecore_config_boolean_get(Ecore_Config_Prop *e) | ||
182 | { | ||
183 | return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_BLN))) ? (e->val != 0) : -1; | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Returns the specified property as a long integer. | ||
188 | * @param key The property key. | ||
189 | * @return The integer value of the property. The function returns 0 if the | ||
190 | * property is not an integer or is not set. | ||
191 | * @ingroup Ecore_Config_Get_Group | ||
192 | */ | ||
193 | EAPI long | ||
194 | ecore_config_int_get(const char *key) | ||
195 | { | ||
196 | return _ecore_config_int_get( ecore_config_get(key) ); | ||
197 | } | ||
198 | |||
199 | long | ||
200 | _ecore_config_int_get(Ecore_Config_Prop *e) | ||
201 | { | ||
202 | return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_RGB))) ? e->val : 0L; | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * Returns the specified property as a float. | ||
207 | * @param key The property key. | ||
208 | * @return The float value of the property. The function returns 0.0 if the | ||
209 | * property is not a float or is not set. | ||
210 | * @ingroup Ecore_Config_Get_Group | ||
211 | */ | ||
212 | EAPI float | ||
213 | ecore_config_float_get(const char *key) | ||
214 | { | ||
215 | return _ecore_config_float_get( ecore_config_get(key) ); | ||
216 | } | ||
217 | |||
218 | float | ||
219 | _ecore_config_float_get(Ecore_Config_Prop *e) | ||
220 | { | ||
221 | return (e && (e->type == ECORE_CONFIG_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0; | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * Finds the alpha, red, green and blue values of a color property. | ||
226 | * @param key The property key. | ||
227 | * @param a A pointer to an integer to store the alpha value into. | ||
228 | * @param r A pointer to an integer to store the red value into. | ||
229 | * @param g A pointer to an integer to store the green value into. | ||
230 | * @param b A pointer to an integer to store the blue value into. | ||
231 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL | ||
232 | * otherwise. | ||
233 | * @ingroup Ecore_Config_Get_Group | ||
234 | */ | ||
235 | EAPI int | ||
236 | ecore_config_argb_get(const char *key, int *a, int *r, int *g, int *b) | ||
237 | { | ||
238 | return _ecore_config_argb_get( ecore_config_get(key), a, r, g, b); | ||
239 | } | ||
240 | |||
241 | int | ||
242 | _ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, int *g, int *b) | ||
243 | { | ||
244 | if (e && ((e->type == ECORE_CONFIG_RGB))) | ||
245 | { | ||
246 | if(a) *a = (e->val >> 24) & 0xff; | ||
247 | if(r) *r = (e->val >> 16) & 0xff; | ||
248 | if(g) *g = (e->val >> 8) & 0xff; | ||
249 | if(b) *b = e->val & 0xff; | ||
250 | return ECORE_CONFIG_ERR_SUCC; | ||
251 | } | ||
252 | return ECORE_CONFIG_ERR_FAIL; | ||
253 | } | ||
254 | |||
255 | /** | ||
256 | * Returns a color property as a long | ||
257 | * @param key The property key. | ||
258 | * @return ARGB data as long | ||
259 | * @ingroup Ecore_Config_Get_Group | ||
260 | */ | ||
261 | EAPI long | ||
262 | ecore_config_argbint_get(const char *key) | ||
263 | { | ||
264 | return _ecore_config_argbint_get( ecore_config_get(key) ); | ||
265 | } | ||
266 | |||
267 | long | ||
268 | _ecore_config_argbint_get(Ecore_Config_Prop *e) | ||
269 | { | ||
270 | if (e && ((e->type == ECORE_CONFIG_RGB))) | ||
271 | { | ||
272 | return e->val; | ||
273 | } | ||
274 | return 0L; | ||
275 | } | ||
276 | |||
277 | /** | ||
278 | * Returns a color property as a string of hexadecimal characters. | ||
279 | * @param key The property key. | ||
280 | * @return A string of hexadecimal characters in the format #aarrggbb. | ||
281 | * @ingroup Ecore_Config_Get_Group | ||
282 | */ | ||
283 | EAPI char * | ||
284 | ecore_config_argbstr_get(const char *key) | ||
285 | { | ||
286 | return _ecore_config_argbstr_get( ecore_config_get(key) ); | ||
287 | } | ||
288 | |||
289 | char * | ||
290 | _ecore_config_argbstr_get(Ecore_Config_Prop *e) | ||
291 | { | ||
292 | char *r; | ||
293 | |||
294 | r = NULL; | ||
295 | esprintf(&r, "#%08x", _ecore_config_int_get(e)); | ||
296 | return r; | ||
297 | } | ||
298 | |||
299 | /** | ||
300 | * Returns a theme property. | ||
301 | * @param key The property key. | ||
302 | * @return The name of the theme the property refers to. The function returns | ||
303 | * @c NULL if the property is not a theme or is not set. | ||
304 | * @ingroup Ecore_Config_Get_Group | ||
305 | */ | ||
306 | EAPI char * | ||
307 | ecore_config_theme_get(const char *key) | ||
308 | { | ||
309 | return _ecore_config_theme_get( ecore_config_get(key) ); | ||
310 | } | ||
311 | |||
312 | char * | ||
313 | _ecore_config_theme_get(Ecore_Config_Prop *e) | ||
314 | { | ||
315 | return (e && (e->type == ECORE_CONFIG_THM)) ? strdup(e->ptr) : NULL; | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * Retrieves the key as a string. | ||
320 | * @param key The property key. | ||
321 | * @return Returns a character array in the form of 'key:type=value'. @c NULL | ||
322 | * is returned if the property does not exist. | ||
323 | * @ingroup Ecore_Config_Get_Group | ||
324 | */ | ||
325 | EAPI char * | ||
326 | ecore_config_as_string_get(const char *key) | ||
327 | { | ||
328 | Ecore_Config_Prop *e; | ||
329 | char *val; | ||
330 | char *r; | ||
331 | |||
332 | val = NULL; | ||
333 | r = NULL; | ||
334 | if (!(e = ecore_config_get(key))) | ||
335 | ERR("no such property, \"%s\"...", key); | ||
336 | else | ||
337 | { | ||
338 | switch (e->type) | ||
339 | { | ||
340 | case ECORE_CONFIG_NIL: | ||
341 | val = strdup("<nil>"); | ||
342 | break; | ||
343 | case ECORE_CONFIG_INT: | ||
344 | esprintf(&val, "%ld", _ecore_config_int_get(e)); | ||
345 | break; | ||
346 | case ECORE_CONFIG_BLN: | ||
347 | esprintf(&val, "%ld", _ecore_config_boolean_get(e)); | ||
348 | break; | ||
349 | case ECORE_CONFIG_FLT: | ||
350 | esprintf(&val, "%lf", _ecore_config_float_get(e)); | ||
351 | break; | ||
352 | case ECORE_CONFIG_STR: | ||
353 | esprintf(&val, "\"%s\"", _ecore_config_string_get(e)); | ||
354 | break; | ||
355 | case ECORE_CONFIG_RGB: | ||
356 | esprintf(&val, "#%08x", _ecore_config_int_get(e)); | ||
357 | break; | ||
358 | case ECORE_CONFIG_THM: | ||
359 | esprintf(&val, "\"%s\"", _ecore_config_theme_get(e)); | ||
360 | break; | ||
361 | case ECORE_CONFIG_SCT: | ||
362 | break; | ||
363 | default: | ||
364 | esprintf(&r, "%s:unknown_type", key); | ||
365 | break; | ||
366 | } | ||
367 | if (val) | ||
368 | { | ||
369 | esprintf(&r, "%s:%s=%s", key, _ecore_config_type[e->type], val); | ||
370 | free(val); | ||
371 | } | ||
372 | } | ||
373 | return r; | ||
374 | } | ||
375 | |||
376 | EAPI int | ||
377 | ecore_config_bound(Ecore_Config_Prop * e) | ||
378 | { | ||
379 | int ret; | ||
380 | long v; | ||
381 | |||
382 | ret = ECORE_CONFIG_ERR_SUCC; | ||
383 | |||
384 | if (!e) | ||
385 | return ECORE_CONFIG_ERR_FAIL; | ||
386 | if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) | ||
387 | { | ||
388 | if ((e->val < e->lo)) | ||
389 | { | ||
390 | WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...", | ||
391 | e->key, e->val, e->lo); | ||
392 | e->val = e->lo; | ||
393 | } | ||
394 | else if ((e->val > e->hi)) | ||
395 | { | ||
396 | WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...", | ||
397 | e->key, e->val, e->hi); | ||
398 | e->val = e->hi; | ||
399 | } | ||
400 | else | ||
401 | ret = ECORE_CONFIG_ERR_IGNORED; | ||
402 | } | ||
403 | else | ||
404 | ret = ECORE_CONFIG_ERR_IGNORED; | ||
405 | |||
406 | if (e->step) | ||
407 | { | ||
408 | v = ((int)(e->val / e->step)) * e->step; | ||
409 | if (v != e->val) | ||
410 | { | ||
411 | if (e->type == ECORE_CONFIG_FLT) | ||
412 | WRN("ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...", | ||
413 | e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION, | ||
414 | ((double)e->step) / ECORE_CONFIG_FLOAT_PRECISION, | ||
415 | ((double)v) / ECORE_CONFIG_FLOAT_PRECISION); | ||
416 | else | ||
417 | WRN("ecore_config_bound(\"%s\"): integer value %ld not a multiple of %ld, adjusted to %ld...", | ||
418 | e->key, e->val, e->step, v); | ||
419 | ret = ECORE_CONFIG_ERR_SUCC; | ||
420 | e->val = v; | ||
421 | } | ||
422 | } | ||
423 | |||
424 | return ret; | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * Tries to guess the type of a property. | ||
429 | * | ||
430 | * This function first checks to see if the property exists. If it does, then | ||
431 | * the type of the stored property is returned. Otherwise, the function tries | ||
432 | * to guess the type of the property based on @p val. | ||
433 | * | ||
434 | * @param key The property key. | ||
435 | * @param val The value in string form. | ||
436 | * @return The type of the property determined by the function. Note that if | ||
437 | * val is @c NULL, @c ECORE_CONFIG_NIL will be returned. | ||
438 | */ | ||
439 | EAPI int | ||
440 | ecore_config_type_guess(const char *key, const char *val) | ||
441 | { | ||
442 | Ecore_Config_Prop *p; | ||
443 | char *l; | ||
444 | |||
445 | l = NULL; | ||
446 | |||
447 | if (key && (p = ecore_config_get(key)) && p->type != ECORE_CONFIG_NIL) | ||
448 | return p->type; | ||
449 | |||
450 | if (!val) | ||
451 | return ECORE_CONFIG_NIL; | ||
452 | if (val[0] == '#') | ||
453 | return ECORE_CONFIG_RGB; | ||
454 | strtol(val, &l, 10); | ||
455 | if (*l) | ||
456 | { | ||
457 | float f; | ||
458 | |||
459 | if (sscanf(val, "%f%*s", &f) != 1) | ||
460 | return ECORE_CONFIG_STR; | ||
461 | return ECORE_CONFIG_FLT; | ||
462 | } | ||
463 | return ECORE_CONFIG_INT; | ||
464 | } | ||
465 | |||
466 | static int | ||
467 | ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type) | ||
468 | { | ||
469 | |||
470 | if (!e) | ||
471 | return ECORE_CONFIG_ERR_NODATA; | ||
472 | |||
473 | if (!(val) && (type != ECORE_CONFIG_NIL && type != ECORE_CONFIG_SCT)) | ||
474 | e->ptr = NULL; | ||
475 | else | ||
476 | { | ||
477 | if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN) | ||
478 | { | ||
479 | e->val = (long) *((int *)val); | ||
480 | e->type = type; | ||
481 | } | ||
482 | else if (type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM) | ||
483 | { | ||
484 | if (!(e->ptr = strdup(val))) | ||
485 | return ECORE_CONFIG_ERR_OOM; | ||
486 | if (e->type == ECORE_CONFIG_NIL) | ||
487 | e->type = type; | ||
488 | } | ||
489 | else if (type == ECORE_CONFIG_RGB) | ||
490 | { | ||
491 | __ecore_argbstr_to_long((char *)val, &e->val); | ||
492 | e->type = ECORE_CONFIG_RGB; | ||
493 | } | ||
494 | else if (type == ECORE_CONFIG_FLT) | ||
495 | { | ||
496 | e->val = (long) ((*((float *)val)) * ECORE_CONFIG_FLOAT_PRECISION); | ||
497 | e->type = ECORE_CONFIG_FLT; | ||
498 | } | ||
499 | else if (type == ECORE_CONFIG_SCT) | ||
500 | { | ||
501 | e->type = ECORE_CONFIG_SCT; | ||
502 | } | ||
503 | else | ||
504 | { | ||
505 | e->type = ECORE_CONFIG_NIL; | ||
506 | } | ||
507 | |||
508 | ecore_config_bound(e); | ||
509 | e->flags |= ECORE_CONFIG_FLAG_MODIFIED; | ||
510 | e->flags &= ~ECORE_CONFIG_FLAG_CMDLN; | ||
511 | return ECORE_CONFIG_ERR_SUCC; | ||
512 | } | ||
513 | return ECORE_CONFIG_ERR_IGNORED; | ||
514 | } | ||
515 | |||
516 | static int | ||
517 | ecore_config_typed_add(const char *key, const void *val, int type) | ||
518 | { | ||
519 | int error = ECORE_CONFIG_ERR_SUCC; | ||
520 | Ecore_Config_Prop *e = NULL; | ||
521 | Ecore_Config_Bundle *t; | ||
522 | |||
523 | t = __ecore_config_bundle_local; | ||
524 | if (!key) | ||
525 | return ECORE_CONFIG_ERR_NODATA; | ||
526 | |||
527 | if (!(e = calloc(1, sizeof(Ecore_Config_Prop)))) | ||
528 | { | ||
529 | return ECORE_CONFIG_ERR_OOM; | ||
530 | } | ||
531 | else if (!(e->key = strdup(key))) | ||
532 | { | ||
533 | error = ECORE_CONFIG_ERR_OOM; | ||
534 | } | ||
535 | else if ((error = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC) | ||
536 | { | ||
537 | if (t) | ||
538 | { | ||
539 | e->next = t->data; | ||
540 | t->data = e; | ||
541 | } | ||
542 | return ECORE_CONFIG_ERR_SUCC; | ||
543 | } | ||
544 | |||
545 | if(e->key) | ||
546 | free(e->key); | ||
547 | if(e) | ||
548 | free(e); | ||
549 | |||
550 | if (error == ECORE_CONFIG_ERR_SUCC) | ||
551 | error = ECORE_CONFIG_ERR_FAIL; | ||
552 | |||
553 | return error; | ||
554 | } | ||
555 | |||
556 | static int | ||
557 | ecore_config_add(const char *key, const char *val) | ||
558 | { | ||
559 | int type; | ||
560 | |||
561 | type = ecore_config_type_guess(key, val); | ||
562 | return ecore_config_typed_add(key, val, type); | ||
563 | } | ||
564 | |||
565 | /** | ||
566 | * Sets the description field of the indicated property. | ||
567 | * @param key The property key. | ||
568 | * @param desc Description string. | ||
569 | * @note The description string is copied for the property's use. You can | ||
570 | * free @p desc once this function is called. | ||
571 | * @ingroup Ecore_Config_Property_Group | ||
572 | */ | ||
573 | EAPI int | ||
574 | ecore_config_describe(const char *key, const char *desc) | ||
575 | { | ||
576 | Ecore_Config_Prop *e; | ||
577 | |||
578 | if (!(e = ecore_config_get(key))) | ||
579 | return ECORE_CONFIG_ERR_NODATA; | ||
580 | e->description = strdup(desc); | ||
581 | return ECORE_CONFIG_ERR_SUCC; | ||
582 | } | ||
583 | |||
584 | /** | ||
585 | * Set the short option character of a property. | ||
586 | * @param key The property key. | ||
587 | * @param short_opt Character used to indicate the value of a property | ||
588 | * given on the command line. | ||
589 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA | ||
590 | * is returned if the property does not exist. | ||
591 | * @ingroup Ecore_Config_Property_Group | ||
592 | */ | ||
593 | EAPI int | ||
594 | ecore_config_short_opt_set(const char *key, char short_opt) | ||
595 | { | ||
596 | Ecore_Config_Prop *e; | ||
597 | |||
598 | if (!(e = ecore_config_get(key))) | ||
599 | return ECORE_CONFIG_ERR_NODATA; | ||
600 | e->short_opt = short_opt; | ||
601 | return ECORE_CONFIG_ERR_SUCC; | ||
602 | } | ||
603 | |||
604 | /** | ||
605 | * Set the long option string of the property. | ||
606 | * @param key The property key. | ||
607 | * @param long_opt String used to indicate the value of a property given | ||
608 | * on the command line. | ||
609 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA | ||
610 | * is returned if the property does not exist. | ||
611 | * @ingroup Ecore_Config_Property_Group | ||
612 | */ | ||
613 | EAPI int | ||
614 | ecore_config_long_opt_set(const char *key, const char *long_opt) | ||
615 | { | ||
616 | Ecore_Config_Prop *e; | ||
617 | |||
618 | if (!(e = ecore_config_get(key))) | ||
619 | return ECORE_CONFIG_ERR_NODATA; | ||
620 | if (e->long_opt) | ||
621 | free(e->long_opt); | ||
622 | if (long_opt) | ||
623 | e->long_opt = strdup(long_opt); | ||
624 | return ECORE_CONFIG_ERR_SUCC; | ||
625 | } | ||
626 | |||
627 | static void | ||
628 | _ecore_config_listener_fire(Ecore_Config_Prop *prop) | ||
629 | { | ||
630 | Ecore_Config_Listener_List *l; | ||
631 | for (l = prop->listeners; l; l = l->next) | ||
632 | l->listener(prop->key, prop->type, l->tag, l->data); | ||
633 | |||
634 | /* fire change listeners for the generic struct container etc */ | ||
635 | if (prop->parent) | ||
636 | _ecore_config_listener_fire(prop->parent); | ||
637 | } | ||
638 | |||
639 | /** | ||
640 | * Sets the indicated property to the given value and type. | ||
641 | * @param key The property key. | ||
642 | * @param val A pointer to the value to set the property to. | ||
643 | * @param type The type of the property. | ||
644 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
645 | * @ingroup Ecore_Config_Property_Group | ||
646 | */ | ||
647 | EAPI int | ||
648 | ecore_config_typed_set(const char *key, const void *val, int type) | ||
649 | { | ||
650 | Ecore_Config_Prop *e; | ||
651 | int ret; | ||
652 | |||
653 | if (!key) | ||
654 | return ECORE_CONFIG_ERR_NODATA; | ||
655 | /* if (!t) { * global prop * | ||
656 | e=ecore_config_get(key); | ||
657 | if (e) | ||
658 | for(l=e->listeners;l;l=l->next) | ||
659 | l->listener(e->key,e->type,l->tag,l->data,t); | ||
660 | return ECORE_CONFIG_ERR_SUCC; | ||
661 | } | ||
662 | */ | ||
663 | if (!(e = ecore_config_get(key))) | ||
664 | return ecore_config_typed_add(key, val, type); | ||
665 | |||
666 | if ((ret = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC) | ||
667 | { | ||
668 | _ecore_config_listener_fire(e); | ||
669 | } | ||
670 | else | ||
671 | { | ||
672 | ERR("ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d", | ||
673 | key, ret); | ||
674 | } | ||
675 | |||
676 | return ret; | ||
677 | } | ||
678 | |||
679 | /** | ||
680 | * @defgroup Ecore_Config_Set_Group Ecore Config Setters | ||
681 | * | ||
682 | * Functions that set the value of a property. | ||
683 | */ | ||
684 | |||
685 | /** | ||
686 | * Sets the indicated property to the value indicated by @a val. | ||
687 | * @param key The property key. | ||
688 | * @param val String representation of value to set. | ||
689 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
690 | * @ingroup Ecore_Config_Set_Group | ||
691 | */ | ||
692 | EAPI int | ||
693 | ecore_config_set(const char *key, const char *val) | ||
694 | { | ||
695 | int type; | ||
696 | int tmpi; | ||
697 | float tmpf; | ||
698 | long tmpl; | ||
699 | |||
700 | type = ecore_config_type_guess(key, val); | ||
701 | if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN) | ||
702 | { | ||
703 | tmpi = atoi(val); | ||
704 | return ecore_config_typed_set(key, &tmpi, type); | ||
705 | } | ||
706 | else if (type == ECORE_CONFIG_FLT) | ||
707 | { | ||
708 | tmpf = atof(val); | ||
709 | return ecore_config_typed_set(key, &tmpf, type); | ||
710 | } | ||
711 | else if (type == ECORE_CONFIG_RGB) | ||
712 | { | ||
713 | __ecore_argbstr_to_long(val, &tmpl); | ||
714 | return ecore_config_typed_set(key, &tmpl, type); | ||
715 | } | ||
716 | else | ||
717 | return ecore_config_typed_set(key, val, type); | ||
718 | } | ||
719 | |||
720 | /** | ||
721 | * Sets the indicated property to the value given in the string. | ||
722 | * @param key The property key. | ||
723 | * @param val String representation of the value. | ||
724 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
725 | * @ingroup Ecore_Config_Set_Group | ||
726 | */ | ||
727 | EAPI int | ||
728 | ecore_config_as_string_set(const char *key, const char *val) | ||
729 | { | ||
730 | return ecore_config_set(key, val); | ||
731 | } | ||
732 | |||
733 | /** | ||
734 | * Sets the indicated property to the given boolean. | ||
735 | * @param key The property key. | ||
736 | * @param val Boolean integer to set the property to. | ||
737 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
738 | * @ingroup Ecore_Config_Set_Group | ||
739 | */ | ||
740 | EAPI int | ||
741 | ecore_config_boolean_set(const char *key, int val) | ||
742 | { | ||
743 | val = val ? 1 : 0; | ||
744 | return ecore_config_typed_set(key, &val, ECORE_CONFIG_BLN); | ||
745 | } | ||
746 | |||
747 | /** | ||
748 | * Sets the indicated property to the given integer. | ||
749 | * @param key The property key. | ||
750 | * @param val Integer to set the property to. | ||
751 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
752 | * @ingroup Ecore_Config_Set_Group | ||
753 | */ | ||
754 | EAPI int | ||
755 | ecore_config_int_set(const char *key, int val) | ||
756 | { | ||
757 | return ecore_config_typed_set(key, &val, ECORE_CONFIG_INT); | ||
758 | } | ||
759 | |||
760 | /** | ||
761 | * Sets the indicated property to the given string. | ||
762 | * @param key The property key. | ||
763 | * @param val String to set the property to. | ||
764 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
765 | * @ingroup Ecore_Config_Set_Group | ||
766 | */ | ||
767 | EAPI int | ||
768 | ecore_config_string_set(const char *key, const char *val) | ||
769 | { | ||
770 | return ecore_config_typed_set(key, val, ECORE_CONFIG_STR); | ||
771 | } | ||
772 | |||
773 | /** | ||
774 | * Sets the indicated property to the given float value. | ||
775 | * @param key The property key. | ||
776 | * @param val Float to set the property to. | ||
777 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
778 | * @ingroup Ecore_Config_Set_Group | ||
779 | */ | ||
780 | EAPI int | ||
781 | ecore_config_float_set(const char *key, float val) | ||
782 | { | ||
783 | return ecore_config_typed_set(key, &val, ECORE_CONFIG_FLT); | ||
784 | } | ||
785 | |||
786 | /** | ||
787 | * Sets the indicated property to a color value. | ||
788 | * @param key The property key | ||
789 | * @param a integer 0..255 | ||
790 | * @param r integer 0..255 | ||
791 | * @param g integer 0..255 | ||
792 | * @param b integer 0..255 | ||
793 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
794 | * @ingroup Ecore_Config_Set_Group | ||
795 | */ | ||
796 | EAPI int | ||
797 | ecore_config_argb_set(const char *key, int a, int r, int g, int b) | ||
798 | { | ||
799 | long v = 0; | ||
800 | return ecore_config_typed_set(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB); | ||
801 | } | ||
802 | |||
803 | /** | ||
804 | * Sets the indicated property to a color value. | ||
805 | * @param key The property key | ||
806 | * @param argb ARGB data as long | ||
807 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
808 | * @ingroup Ecore_Config_Set_Group | ||
809 | */ | ||
810 | EAPI int | ||
811 | ecore_config_argbint_set(const char *key, long argb) | ||
812 | { | ||
813 | return ecore_config_typed_set(key, &argb, ECORE_CONFIG_RGB); | ||
814 | } | ||
815 | |||
816 | /** | ||
817 | * Sets the indicated property to a color value. | ||
818 | * @param key The property key | ||
819 | * @param val Color value in ARGB format. | ||
820 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
821 | * @ingroup Ecore_Config_Set_Group | ||
822 | */ | ||
823 | EAPI int | ||
824 | ecore_config_argbstr_set(const char *key, const char *val) | ||
825 | { | ||
826 | long v = 0; | ||
827 | return ecore_config_typed_set(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB); | ||
828 | } | ||
829 | |||
830 | /** | ||
831 | * Sets the indicated property to a theme name. | ||
832 | * @param key The property key. | ||
833 | * @param val String giving the name of the theme. | ||
834 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
835 | * @ingroup Ecore_Config_Set_Group | ||
836 | */ | ||
837 | EAPI int | ||
838 | ecore_config_theme_set(const char *key, const char *val) | ||
839 | { | ||
840 | return ecore_config_typed_set(key, val, ECORE_CONFIG_THM); | ||
841 | } | ||
842 | |||
843 | /** | ||
844 | * Sets the theme preview group of an indicated property. | ||
845 | * @param key The property key. | ||
846 | * @param group The group name. | ||
847 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
848 | * @ingroup Ecore_Config_Set_Group | ||
849 | */ | ||
850 | EAPI int | ||
851 | ecore_config_theme_preview_group_set(const char *key, const char *group) | ||
852 | { | ||
853 | int ret; | ||
854 | Ecore_Config_Prop *e; | ||
855 | |||
856 | ret = ECORE_CONFIG_ERR_SUCC; | ||
857 | if (!(e = ecore_config_get(key))) | ||
858 | { /* prop doesn't exist yet */ | ||
859 | if ((ret = ecore_config_typed_add(key, "", ECORE_CONFIG_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */ | ||
860 | return ret; /* ...failed */ | ||
861 | if (!(e = ecore_config_get(key))) /* get handle */ | ||
862 | return ECORE_CONFIG_ERR_FAIL; | ||
863 | } | ||
864 | if (e->data) | ||
865 | free(e->data); | ||
866 | e->data = strdup(group); | ||
867 | |||
868 | return ret; | ||
869 | } | ||
870 | |||
871 | EAPI int | ||
872 | ecore_config_typed_default(const char *key, const void *val, int type) | ||
873 | { | ||
874 | int ret; | ||
875 | Ecore_Config_Prop *e; | ||
876 | |||
877 | ret = ECORE_CONFIG_ERR_SUCC; | ||
878 | |||
879 | if (!(e = ecore_config_get(key))) | ||
880 | { /* prop doesn't exist yet */ | ||
881 | if ((ret = ecore_config_typed_add(key, val, type)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */ | ||
882 | return ret; /* ...failed */ | ||
883 | if (!(e = ecore_config_get(key))) /* get handle */ | ||
884 | return ECORE_CONFIG_ERR_FAIL; | ||
885 | e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED; | ||
886 | } | ||
887 | else if (!(e->flags & ECORE_CONFIG_FLAG_MODIFIED) && !(e->flags & ECORE_CONFIG_FLAG_SYSTEM)) | ||
888 | { | ||
889 | ecore_config_typed_set(key, val, type); | ||
890 | if (!(e = ecore_config_get(key))) /* get handle */ | ||
891 | return ECORE_CONFIG_ERR_FAIL; | ||
892 | e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED; | ||
893 | } | ||
894 | return ret; | ||
895 | } | ||
896 | |||
897 | /** | ||
898 | * @defgroup Ecore_Config_Default_Group Ecore Config Defaults | ||
899 | * | ||
900 | * Functions that are used to set the default values of properties. | ||
901 | */ | ||
902 | |||
903 | /** | ||
904 | * Sets the indicated property if it has not already been set or loaded. | ||
905 | * @param key The property key. | ||
906 | * @param val Default value of the key. | ||
907 | * @param lo Lowest valid value for the key. | ||
908 | * @param hi Highest valid value for the key. | ||
909 | * @param step Used by integer and float values. | ||
910 | * @return @c ECORE_CONFIG_ERR_SUCC if there are no errors. | ||
911 | * @note The @p lo, @p hi and @p step parameters are only used when storing | ||
912 | * integer and float properties. | ||
913 | * @ingroup Ecore_Config_Default_Group | ||
914 | */ | ||
915 | EAPI int | ||
916 | ecore_config_default(const char *key, const char *val, float lo, float hi, float step) | ||
917 | { | ||
918 | int ret, type; | ||
919 | Ecore_Config_Prop *e; | ||
920 | |||
921 | type = ecore_config_type_guess(key, val); | ||
922 | ret = ecore_config_typed_default(key, val, type); | ||
923 | e = ecore_config_get(key); | ||
924 | if (e) | ||
925 | { | ||
926 | if (type == ECORE_CONFIG_INT) | ||
927 | { | ||
928 | e->step = step; | ||
929 | e->flags |= ECORE_CONFIG_FLAG_BOUNDS; | ||
930 | e->lo = lo; | ||
931 | e->hi = hi; | ||
932 | ecore_config_bound(e); | ||
933 | } | ||
934 | else if (type == ECORE_CONFIG_FLT) | ||
935 | { | ||
936 | e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); | ||
937 | e->flags |= ECORE_CONFIG_FLAG_BOUNDS; | ||
938 | e->lo = (int)(lo * ECORE_CONFIG_FLOAT_PRECISION); | ||
939 | e->hi = (int)(hi * ECORE_CONFIG_FLOAT_PRECISION); | ||
940 | ecore_config_bound(e); | ||
941 | } | ||
942 | } | ||
943 | |||
944 | return ret; | ||
945 | } | ||
946 | |||
947 | /** | ||
948 | * Sets the indicated property to the given boolean if the property has not yet | ||
949 | * been set. | ||
950 | * @param key The property key. | ||
951 | * @param val Boolean Integer to set the value to. | ||
952 | * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. | ||
953 | * @ingroup Ecore_Config_Default_Group | ||
954 | */ | ||
955 | EAPI int | ||
956 | ecore_config_boolean_default(const char *key, int val) | ||
957 | { | ||
958 | val = val ? 1 : 0; | ||
959 | return ecore_config_typed_default(key, &val, ECORE_CONFIG_BLN); | ||
960 | } | ||
961 | |||
962 | /** | ||
963 | * Sets the indicated property to the given integer if the property has not yet | ||
964 | * been set. | ||
965 | * @param key The property key. | ||
966 | * @param val Integer to set the value to. | ||
967 | * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. | ||
968 | * @ingroup Ecore_Config_Default_Group | ||
969 | */ | ||
970 | EAPI int | ||
971 | ecore_config_int_default(const char *key, int val) | ||
972 | { | ||
973 | return ecore_config_typed_default(key, &val, ECORE_CONFIG_INT); | ||
974 | } | ||
975 | |||
976 | /** | ||
977 | * Sets the indicated property to the given integer if the property has not yet | ||
978 | * been set. | ||
979 | * | ||
980 | * The bounds and step values are set regardless. | ||
981 | * | ||
982 | * @param key The property key. | ||
983 | * @param val Integer to set the property to. | ||
984 | * @param low Lowest valid integer value for the property. | ||
985 | * @param high Highest valid integer value for the property. | ||
986 | * @param step Increment value for the property. | ||
987 | * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. | ||
988 | * @ingroup Ecore_Config_Default_Group | ||
989 | */ | ||
990 | EAPI int | ||
991 | ecore_config_int_default_bound(const char *key, int val, int low, int high, | ||
992 | int step) | ||
993 | { | ||
994 | Ecore_Config_Prop *e; | ||
995 | int ret; | ||
996 | |||
997 | ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_INT); | ||
998 | e = ecore_config_get(key); | ||
999 | if (e) | ||
1000 | { | ||
1001 | e->step = step; | ||
1002 | e->flags |= ECORE_CONFIG_FLAG_BOUNDS; | ||
1003 | e->lo = low; | ||
1004 | e->hi = high; | ||
1005 | ecore_config_bound(e); | ||
1006 | } | ||
1007 | |||
1008 | return ret; | ||
1009 | } | ||
1010 | |||
1011 | /** | ||
1012 | * Sets the indicated property to the given string if the property has not yet | ||
1013 | * been set. | ||
1014 | * @param key The property key. | ||
1015 | * @param val String to set the property to. | ||
1016 | * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. | ||
1017 | * @ingroup Ecore_Config_Default_Group | ||
1018 | */ | ||
1019 | EAPI int | ||
1020 | ecore_config_string_default(const char *key, const char *val) | ||
1021 | { | ||
1022 | return ecore_config_typed_default(key, val, ECORE_CONFIG_STR); | ||
1023 | } | ||
1024 | |||
1025 | /** | ||
1026 | * Sets the indicated property to the given float if the property has not yet | ||
1027 | * been set. | ||
1028 | * @param key The property key. | ||
1029 | * @param val Float to set the property to. | ||
1030 | * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. | ||
1031 | * @ingroup Ecore_Config_Default_Group | ||
1032 | */ | ||
1033 | EAPI int | ||
1034 | ecore_config_float_default(const char *key, float val) | ||
1035 | { | ||
1036 | return ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT); | ||
1037 | } | ||
1038 | |||
1039 | /** | ||
1040 | * Sets the indicated property to the given float if the property has not yet | ||
1041 | * been set. | ||
1042 | * | ||
1043 | * The bounds and step values are set regardless. | ||
1044 | * | ||
1045 | * @param key The property key. | ||
1046 | * @param val Float to set the property to. | ||
1047 | * @param low Lowest valid integer value for the property. | ||
1048 | * @param high Highest valid float value for the property. | ||
1049 | * @param step Increment value for the property. | ||
1050 | * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. | ||
1051 | * @ingroup Ecore_Config_Default_Group | ||
1052 | */ | ||
1053 | EAPI int | ||
1054 | ecore_config_float_default_bound(const char *key, float val, float low, | ||
1055 | float high, float step) | ||
1056 | { | ||
1057 | Ecore_Config_Prop *e; | ||
1058 | int ret; | ||
1059 | |||
1060 | ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT); | ||
1061 | e = ecore_config_get(key); | ||
1062 | if (e) | ||
1063 | { | ||
1064 | e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); | ||
1065 | e->flags |= ECORE_CONFIG_FLAG_BOUNDS; | ||
1066 | e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION); | ||
1067 | e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION); | ||
1068 | ecore_config_bound(e); | ||
1069 | } | ||
1070 | |||
1071 | return ret; | ||
1072 | } | ||
1073 | |||
1074 | /** | ||
1075 | * Sets the indicated property to a color value if the property has not yet | ||
1076 | * been set. | ||
1077 | * @param key The property key. | ||
1078 | * @param a integer 0..255 | ||
1079 | * @param r integer 0..255 | ||
1080 | * @param g integer 0..255 | ||
1081 | * @param b integer 0..255 | ||
1082 | * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. | ||
1083 | * @ingroup Ecore_Config_Default_Group | ||
1084 | */ | ||
1085 | EAPI int | ||
1086 | ecore_config_argb_default(const char *key, int a, int r, int g, int b) | ||
1087 | { | ||
1088 | long v = 0; | ||
1089 | return ecore_config_typed_default(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB); | ||
1090 | } | ||
1091 | |||
1092 | /** | ||
1093 | * Sets the indicated property to a color value if the property has not yet | ||
1094 | * been set. | ||
1095 | * @param key The property key. | ||
1096 | * @param argb ARGB data as long | ||
1097 | * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. | ||
1098 | * @ingroup Ecore_Config_Default_Group | ||
1099 | */ | ||
1100 | EAPI int | ||
1101 | ecore_config_argbint_default(const char *key, long argb) | ||
1102 | { | ||
1103 | return ecore_config_typed_default(key, &argb, ECORE_CONFIG_RGB); | ||
1104 | } | ||
1105 | |||
1106 | /** | ||
1107 | * Sets the indicated property to a color value if the property has not yet | ||
1108 | * been set. | ||
1109 | * @param key The property key. | ||
1110 | * @param val Color value in ARGB format. | ||
1111 | * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. | ||
1112 | * @ingroup Ecore_Config_Default_Group | ||
1113 | */ | ||
1114 | EAPI int | ||
1115 | ecore_config_argbstr_default(const char *key, const char *val) | ||
1116 | { | ||
1117 | long v = 0; | ||
1118 | return ecore_config_typed_default(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB); | ||
1119 | } | ||
1120 | |||
1121 | /** | ||
1122 | * Sets the indicated property to a theme name if the property has not yet | ||
1123 | * been set. | ||
1124 | * @param key The property key. | ||
1125 | * @param val String giving the name of the theme. | ||
1126 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1127 | * @ingroup Ecore_Config_Default_Group | ||
1128 | */ | ||
1129 | EAPI int | ||
1130 | ecore_config_theme_default(const char *key, const char *val) | ||
1131 | { | ||
1132 | return ecore_config_typed_default(key, val, ECORE_CONFIG_THM); | ||
1133 | } | ||
1134 | |||
1135 | /** | ||
1136 | * @defgroup Ecore_Config_Struct_Group Ecore Config Structures | ||
1137 | * | ||
1138 | * Functions that are used to create structures of properties. | ||
1139 | */ | ||
1140 | |||
1141 | /** | ||
1142 | * Sets the indicated property to a structure if the property has not yet | ||
1143 | * been set. | ||
1144 | * @param key The property key. | ||
1145 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1146 | * @ingroup Ecore_Config_Struct_Group | ||
1147 | */ | ||
1148 | EAPI int | ||
1149 | ecore_config_struct_create(const char *key) | ||
1150 | { | ||
1151 | WRN("you are using ecore_config structures. These are very young"); | ||
1152 | WRN(" and not complete - you have been warned"); | ||
1153 | |||
1154 | return ecore_config_typed_default(key, NULL, ECORE_CONFIG_SCT); | ||
1155 | } | ||
1156 | |||
1157 | static int | ||
1158 | _ecore_config_struct_append(Ecore_Config_Prop *sct, Ecore_Config_Prop *add) | ||
1159 | { | ||
1160 | Eina_List *l; | ||
1161 | |||
1162 | if (!sct || !add || sct->type != ECORE_CONFIG_SCT) | ||
1163 | return ECORE_CONFIG_ERR_IGNORED; | ||
1164 | |||
1165 | l = sct->data; | ||
1166 | sct->data = eina_list_append(l, add); | ||
1167 | add->parent = sct; | ||
1168 | |||
1169 | return ECORE_CONFIG_ERR_SUCC; | ||
1170 | } | ||
1171 | |||
1172 | static int | ||
1173 | _ecore_config_struct_typed_add(const char *key, const char *name, const void *val, | ||
1174 | int type) | ||
1175 | { | ||
1176 | char *subkey; | ||
1177 | int ret; | ||
1178 | |||
1179 | subkey = malloc((strlen(key) + strlen(name) + 2) * sizeof(char)); | ||
1180 | strcpy(subkey, key); | ||
1181 | strcat(subkey, "."); | ||
1182 | strcat(subkey, name); | ||
1183 | |||
1184 | ecore_config_typed_default(subkey, val, type); | ||
1185 | ret = _ecore_config_struct_append(ecore_config_get(key), | ||
1186 | ecore_config_get(subkey)); | ||
1187 | free(subkey); | ||
1188 | return ret; | ||
1189 | } | ||
1190 | |||
1191 | /** | ||
1192 | * Add an int property to the named structure. The property is set if it has not | ||
1193 | * yet been set. | ||
1194 | * @param key The key of the structure to add to. | ||
1195 | * @param name The name of the item to add - this will be appended to the key | ||
1196 | * @param val the int to default to | ||
1197 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1198 | * @ingroup Ecore_Config_Struct_Group | ||
1199 | */ | ||
1200 | EAPI int | ||
1201 | ecore_config_struct_int_add(const char *key, const char *name, int val) | ||
1202 | { | ||
1203 | return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_INT); | ||
1204 | } | ||
1205 | |||
1206 | /** | ||
1207 | * Add a float property to the named structure. The property is set if it has | ||
1208 | * not yet been set. | ||
1209 | * @param key The key of the structure to add to. | ||
1210 | * @param name The name of the item to add - this will be appended to the key | ||
1211 | * @param val The float to default to | ||
1212 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1213 | * @ingroup Ecore_Config_Struct_Group | ||
1214 | */ | ||
1215 | EAPI int | ||
1216 | ecore_config_struct_float_add(const char *key, const char *name, float val) | ||
1217 | { | ||
1218 | return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_FLT); | ||
1219 | } | ||
1220 | |||
1221 | /** | ||
1222 | * Add a string property to the named structure. The property is set if it has | ||
1223 | * not yet been set. | ||
1224 | * @param key The key of the structure to add to. | ||
1225 | * @param name The name of the item to add - this will be appended to the key | ||
1226 | * @param val The string to default to | ||
1227 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1228 | * @ingroup Ecore_Config_Struct_Group | ||
1229 | */ | ||
1230 | EAPI int | ||
1231 | ecore_config_struct_string_add(const char *key, const char *name, const char* val) | ||
1232 | { | ||
1233 | return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_STR); | ||
1234 | } | ||
1235 | |||
1236 | /** | ||
1237 | * Add an argb property to the named structure. The property is set if it has | ||
1238 | * not yet been set. | ||
1239 | * @param key The key of the structure to add to. | ||
1240 | * @param name The name of the item to add - this will be appended to the key | ||
1241 | * @param a The alpha to default to | ||
1242 | * @param r The red to default to | ||
1243 | * @param g The green to default to | ||
1244 | * @param b The blue to default to | ||
1245 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1246 | * @ingroup Ecore_Config_Struct_Group | ||
1247 | */ | ||
1248 | EAPI int | ||
1249 | ecore_config_struct_argb_add(const char *key, const char *name, int a, int r, | ||
1250 | int g, int b) | ||
1251 | { | ||
1252 | long argb; | ||
1253 | |||
1254 | __ecore_argb_to_long(a, r, g, b, &argb); | ||
1255 | return _ecore_config_struct_typed_add(key, name, &argb, ECORE_CONFIG_RGB); | ||
1256 | } | ||
1257 | |||
1258 | /** | ||
1259 | * Add a theme property to the named structure. The property is set if it has | ||
1260 | * not yet been set. | ||
1261 | * @param key The key of the structure to add to. | ||
1262 | * @param name The name of the item to add - this will be appended to the key | ||
1263 | * @param val The theme name to default to | ||
1264 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1265 | * @ingroup Ecore_Config_Struct_Group | ||
1266 | */ | ||
1267 | EAPI int | ||
1268 | ecore_config_struct_theme_add(const char *key, const char *name, const char* val) | ||
1269 | { | ||
1270 | return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_THM); | ||
1271 | } | ||
1272 | |||
1273 | /** | ||
1274 | * Add a boolean property to the named structure. The property is set if it has | ||
1275 | * not yet been set. | ||
1276 | * @param key The key of the structure to add to. | ||
1277 | * @param name The name of the item to add - this will be appended to the key | ||
1278 | * @param val The boolean to default to | ||
1279 | * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. | ||
1280 | * @ingroup Ecore_Config_Struct_Group | ||
1281 | */ | ||
1282 | EAPI int | ||
1283 | ecore_config_struct_boolean_add(const char *key, const char *name, int val) | ||
1284 | { | ||
1285 | val = val ? 1 : 0; | ||
1286 | return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_BLN); | ||
1287 | } | ||
1288 | |||
1289 | /** | ||
1290 | * Get the contents of a defined structure property and load it into the passed | ||
1291 | * C struct | ||
1292 | * @param key The name of the structure property to look up. | ||
1293 | * @param data The struct to write into. | ||
1294 | * @return @c ECORE_CONFIG_ERR_SUCC if the structure is written successfully. | ||
1295 | * @ingroup Ecore_Config_Struct_Group | ||
1296 | */ | ||
1297 | EAPI int | ||
1298 | ecore_config_struct_get(const char *key, void *data) | ||
1299 | { | ||
1300 | Ecore_Config_Prop *e, *f; | ||
1301 | Eina_List *l; | ||
1302 | unsigned char *ptr; | ||
1303 | long argb; | ||
1304 | |||
1305 | e = ecore_config_get(key); | ||
1306 | if (!e) | ||
1307 | return ECORE_CONFIG_ERR_NODATA; | ||
1308 | |||
1309 | l = e->data; | ||
1310 | ptr = data; | ||
1311 | while (l) | ||
1312 | { | ||
1313 | f = (Ecore_Config_Prop *) l->data; | ||
1314 | switch (f->type) | ||
1315 | { | ||
1316 | case ECORE_CONFIG_INT: | ||
1317 | *((int *) ptr) = _ecore_config_int_get(f); | ||
1318 | ptr += sizeof(int); | ||
1319 | break; | ||
1320 | case ECORE_CONFIG_BLN: | ||
1321 | *((int *) ptr) = _ecore_config_boolean_get(f); | ||
1322 | ptr += sizeof(int); | ||
1323 | break; | ||
1324 | case ECORE_CONFIG_FLT: | ||
1325 | *((float *) ptr) = _ecore_config_float_get(f); | ||
1326 | ptr += sizeof(float); | ||
1327 | break; | ||
1328 | case ECORE_CONFIG_STR: | ||
1329 | case ECORE_CONFIG_THM: | ||
1330 | *((char **) ptr) = _ecore_config_string_get(f); | ||
1331 | ptr += sizeof(char *); | ||
1332 | break; | ||
1333 | case ECORE_CONFIG_RGB: | ||
1334 | argb = _ecore_config_argbint_get(f); | ||
1335 | *((int *) ptr) = (argb >> 24) & 0xff; | ||
1336 | ptr += sizeof(int); | ||
1337 | *((int *) ptr) = (argb >> 16) & 0xff; | ||
1338 | ptr += sizeof(int); | ||
1339 | *((int *) ptr) = (argb >> 8) & 0xff; | ||
1340 | ptr += sizeof(int); | ||
1341 | *((int *) ptr) = argb & 0xff; | ||
1342 | ptr += sizeof(int); | ||
1343 | break; | ||
1344 | default: | ||
1345 | WRN("ARGH - STRUCT coding not implemented yet"); | ||
1346 | } | ||
1347 | l = eina_list_next(l); | ||
1348 | } | ||
1349 | return ECORE_CONFIG_ERR_SUCC; | ||
1350 | } | ||
1351 | |||
1352 | /** | ||
1353 | * @defgroup Ecore_Config_Listeners_Group Ecore Config Listeners | ||
1354 | * | ||
1355 | * Functions that set and unset property listener callbacks. | ||
1356 | */ | ||
1357 | |||
1358 | /** | ||
1359 | * Adds a callback function to the list of functions called when a property | ||
1360 | * changes. | ||
1361 | * @param name Name of the callback. | ||
1362 | * @param key The key of the property to listen to. | ||
1363 | * @param listener Listener callback function. | ||
1364 | * @param tag Tag to pass to @p listener when it is called. | ||
1365 | * @param data Data to pass to @p listener when it is called. | ||
1366 | * @return @c ECORE_CONFIG_ERR_SUCC if successful in setting up the callback. | ||
1367 | * @ingroup Ecore_Config_Listeners_Group | ||
1368 | */ | ||
1369 | EAPI int | ||
1370 | ecore_config_listen(const char *name, const char *key, | ||
1371 | Ecore_Config_Listener listener, int tag, void *data) | ||
1372 | { | ||
1373 | Ecore_Config_Prop *e; | ||
1374 | Ecore_Config_Listener_List *l; | ||
1375 | |||
1376 | if (!key) | ||
1377 | return ECORE_CONFIG_ERR_NODATA; | ||
1378 | |||
1379 | if (!(e = ecore_config_get(key))) | ||
1380 | { | ||
1381 | int ret = ecore_config_add(key, ""); | ||
1382 | |||
1383 | if (ret != ECORE_CONFIG_ERR_SUCC) | ||
1384 | { | ||
1385 | ERR("ecore_config_listen: ecore_config_add(\"%s\") failed: %d", | ||
1386 | key, ret); | ||
1387 | return ret; | ||
1388 | } | ||
1389 | if (!(e = ecore_config_get(key))) | ||
1390 | { | ||
1391 | ERR("ecore_config_listen: list of properties corrupted!?"); | ||
1392 | return ECORE_CONFIG_ERR_FAIL; | ||
1393 | } | ||
1394 | } | ||
1395 | |||
1396 | for (l = e->listeners; l; l = l->next) | ||
1397 | if (!strcmp(l->name, name) || (l->listener == listener)) | ||
1398 | { | ||
1399 | ERR("ecore_config_listen: %s is already listening for changes of %s...", | ||
1400 | name, key); | ||
1401 | return ECORE_CONFIG_ERR_IGNORED; | ||
1402 | } | ||
1403 | |||
1404 | if (!(l = malloc(sizeof(Ecore_Config_Listener_List)))) | ||
1405 | return ECORE_CONFIG_ERR_OOM; | ||
1406 | |||
1407 | ERR("registering listener \"%s\" for \"%s\" (%d)...", name, key, e->type); | ||
1408 | |||
1409 | memset(l, 0, sizeof(Ecore_Config_Listener_List)); | ||
1410 | |||
1411 | l->listener = listener; | ||
1412 | l->name = name; | ||
1413 | l->data = data; | ||
1414 | l->tag = tag; | ||
1415 | l->next = e->listeners; | ||
1416 | e->listeners = l; | ||
1417 | |||
1418 | if (e->type != ECORE_CONFIG_NIL) /* call right on creation if prop exists and has val */ | ||
1419 | listener(key, e->type, tag, data); | ||
1420 | |||
1421 | return ECORE_CONFIG_ERR_SUCC; | ||
1422 | } | ||
1423 | |||
1424 | /** | ||
1425 | * Removes a listener callback. | ||
1426 | * @param name Name of the callback to remove. | ||
1427 | * @param key The property key the callback is listening to. | ||
1428 | * @param listener The callback function to remove. | ||
1429 | * @return @c ECORE_CONFIG_ERR_SUCC if successful in removing the callback. | ||
1430 | * If no callback matches the given parameters, then | ||
1431 | * @c ECORE_CONFIG_ERR_NOTFOUND is returned. If @c NULL is passed | ||
1432 | * for the key pointer, @c ECORE_CONFIG_ERR_NODATA is returned. | ||
1433 | * @ingroup Ecore_Config_Listeners_Group | ||
1434 | */ | ||
1435 | EAPI int | ||
1436 | ecore_config_deaf(const char *name, const char *key, | ||
1437 | Ecore_Config_Listener listener) | ||
1438 | { | ||
1439 | Ecore_Config_Prop *e; | ||
1440 | Ecore_Config_Listener_List *l, *p; | ||
1441 | int ret; | ||
1442 | |||
1443 | ret = ECORE_CONFIG_ERR_NOTFOUND; | ||
1444 | |||
1445 | if (!key) | ||
1446 | return ECORE_CONFIG_ERR_NODATA; | ||
1447 | |||
1448 | if (!(e = ecore_config_get(key))) | ||
1449 | return ECORE_CONFIG_ERR_NOTFOUND; | ||
1450 | |||
1451 | for (p = NULL, l = e->listeners; l; p = l) | ||
1452 | { | ||
1453 | Ecore_Config_Listener_List *nl; | ||
1454 | |||
1455 | nl = l->next; | ||
1456 | if ((name && !strcmp(l->name, name)) || (l->listener == listener)) | ||
1457 | { | ||
1458 | ret = ECORE_CONFIG_ERR_SUCC; | ||
1459 | if (!p) | ||
1460 | e->listeners = e->listeners->next; | ||
1461 | else | ||
1462 | p->next = l->next; | ||
1463 | memset(l, 0, sizeof(Ecore_Config_Listener)); | ||
1464 | free(l); | ||
1465 | } | ||
1466 | l = nl; | ||
1467 | } | ||
1468 | |||
1469 | return ret; | ||
1470 | } | ||
1471 | |||
1472 | /** | ||
1473 | * Locates the first configuration bundle on the given server. | ||
1474 | * @param srv The configuration server. | ||
1475 | * @return Pointer to the first configuration bundle. | ||
1476 | */ | ||
1477 | EAPI Ecore_Config_Bundle * | ||
1478 | ecore_config_bundle_1st_get(Ecore_Config_Server * srv) | ||
1479 | { /* anchor: global, but read-only */ | ||
1480 | return srv->bundles; | ||
1481 | } | ||
1482 | |||
1483 | /** | ||
1484 | * Locates the configuration bundle after the given one. | ||
1485 | * @param ns The configuration bundle. | ||
1486 | * @return The next configuration bundle. | ||
1487 | */ | ||
1488 | EAPI Ecore_Config_Bundle * | ||
1489 | ecore_config_bundle_next_get(Ecore_Config_Bundle * ns) | ||
1490 | { | ||
1491 | return ns ? ns->next : NULL; | ||
1492 | } | ||
1493 | |||
1494 | /** | ||
1495 | * Locates a configuration bundle on a configuration server based on its serial | ||
1496 | * number. | ||
1497 | * @param srv The configuration server. | ||
1498 | * @param serial Serial number. | ||
1499 | * @return The configuration bundle with the given serial number. | ||
1500 | */ | ||
1501 | EAPI Ecore_Config_Bundle * | ||
1502 | ecore_config_bundle_by_serial_get(Ecore_Config_Server * srv, long serial) | ||
1503 | { | ||
1504 | Ecore_Config_Bundle *eb; | ||
1505 | |||
1506 | eb = srv->bundles; | ||
1507 | |||
1508 | if (serial < 0) | ||
1509 | return NULL; | ||
1510 | else if (serial == 0) | ||
1511 | { | ||
1512 | Ecore_Config_Bundle *r = eb; | ||
1513 | |||
1514 | return r; | ||
1515 | } | ||
1516 | |||
1517 | while (eb) | ||
1518 | { | ||
1519 | if (eb->serial == serial) | ||
1520 | return eb; | ||
1521 | eb = eb->next; | ||
1522 | } | ||
1523 | return NULL; | ||
1524 | } | ||
1525 | |||
1526 | /** | ||
1527 | * Gets the Ecore_Config_Bundle with the given identifier from the given | ||
1528 | * server. | ||
1529 | * @param srv The configuration server. | ||
1530 | * @param label The bundle's identifier string. | ||
1531 | * @return The bundle with the given identifier string, or @c NULL if it | ||
1532 | * could not be found. | ||
1533 | */ | ||
1534 | EAPI Ecore_Config_Bundle * | ||
1535 | ecore_config_bundle_by_label_get(Ecore_Config_Server * srv, const char *label) | ||
1536 | { | ||
1537 | Ecore_Config_Bundle *ns; | ||
1538 | |||
1539 | ns = srv->bundles; | ||
1540 | |||
1541 | while (ns) | ||
1542 | { | ||
1543 | if (ns->identifier && !strcmp(ns->identifier, label)) | ||
1544 | return ns; | ||
1545 | ns = ns->next; | ||
1546 | } | ||
1547 | return NULL; | ||
1548 | } | ||
1549 | |||
1550 | /** | ||
1551 | * Retrieves the bundle's serial number. | ||
1552 | * @param ns The configuration bundle. | ||
1553 | * @return The bundle's identifier string, or -1 if ns is @c NULL. | ||
1554 | */ | ||
1555 | EAPI long | ||
1556 | ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns) | ||
1557 | { | ||
1558 | return ns ? ns->serial : -1; | ||
1559 | } | ||
1560 | |||
1561 | /** | ||
1562 | * Retrieves the bundle's identifier. | ||
1563 | * @param ns The configuration bundle. | ||
1564 | * @return The bundle's identifer string. | ||
1565 | */ | ||
1566 | EAPI char * | ||
1567 | ecore_config_bundle_label_get(Ecore_Config_Bundle * ns) | ||
1568 | { | ||
1569 | return ns ? ns->identifier : NULL; | ||
1570 | } | ||
1571 | |||
1572 | /** | ||
1573 | * Creates a new Ecore_Config_Bundle. | ||
1574 | * @param srv Config server. | ||
1575 | * @param identifier Identifier string for the new bundle. | ||
1576 | * @return A pointer to a new Ecore_Config_Bundle. @c NULL is returned if the | ||
1577 | * structure couldn't be allocated. | ||
1578 | */ | ||
1579 | EAPI Ecore_Config_Bundle * | ||
1580 | ecore_config_bundle_new(Ecore_Config_Server * srv, const char *identifier) | ||
1581 | { | ||
1582 | Ecore_Config_Bundle *t; | ||
1583 | static long ss; | ||
1584 | |||
1585 | ss = 0; /* bundle unique serial */ | ||
1586 | |||
1587 | if ((t = malloc(sizeof(Ecore_Config_Bundle)))) | ||
1588 | { | ||
1589 | memset(t, 0, sizeof(Ecore_Config_Bundle)); | ||
1590 | |||
1591 | t->identifier = (char *)identifier; | ||
1592 | t->serial = ++ss; | ||
1593 | t->owner = srv->name; | ||
1594 | t->next = srv->bundles; | ||
1595 | srv->bundles = t; | ||
1596 | } | ||
1597 | return t; | ||
1598 | } | ||
1599 | |||
1600 | static Ecore_Config_Server * | ||
1601 | do_init(const char *name) | ||
1602 | { | ||
1603 | return _ecore_config_ipc_init(name); | ||
1604 | } | ||
1605 | |||
1606 | static Ecore_Config_Server * | ||
1607 | ecore_config_init_local(const char *name) | ||
1608 | { | ||
1609 | char *p; | ||
1610 | char *buf; | ||
1611 | |||
1612 | if ((p = getenv("HOME"))) | ||
1613 | { /* debug-only ### FIXME */ | ||
1614 | if (!(buf = malloc(PATH_MAX * sizeof(char)))) | ||
1615 | return NULL; | ||
1616 | snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name); | ||
1617 | unlink(buf); | ||
1618 | |||
1619 | free(buf); | ||
1620 | } | ||
1621 | |||
1622 | return do_init(name); | ||
1623 | } | ||
1624 | |||
1625 | static Ecore_Config_Server * | ||
1626 | ecore_config_init_global(const char *name) | ||
1627 | { | ||
1628 | char *p; | ||
1629 | int global; | ||
1630 | char *buf; | ||
1631 | |||
1632 | if ((p = getenv("HOME"))) | ||
1633 | { /* debug-only ### FIXME */ | ||
1634 | if (!(buf = malloc(PATH_MAX * sizeof(char)))) | ||
1635 | return NULL; | ||
1636 | snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name); | ||
1637 | global = creat(buf, S_IRWXU); | ||
1638 | |||
1639 | if (global >= 0) | ||
1640 | close(global); | ||
1641 | |||
1642 | free(buf); | ||
1643 | } | ||
1644 | |||
1645 | return do_init(name); | ||
1646 | } | ||
1647 | |||
1648 | /** | ||
1649 | * @defgroup Ecore_Config_App_Lib_Group Ecore Config App Library Functions | ||
1650 | * | ||
1651 | * Functions that are used to start up and shutdown the Enlightened | ||
1652 | * Property Library when used directly by an application. | ||
1653 | */ | ||
1654 | |||
1655 | /** | ||
1656 | * Initializes the Enlightened Property Library. | ||
1657 | * | ||
1658 | * Either this function or @ref ecore_config_system_init must be run | ||
1659 | * before any other function in the Enlightened Property Library, even | ||
1660 | * if you have run @ref ecore_init . The name given is used to | ||
1661 | * determine the default configuration to load. | ||
1662 | * | ||
1663 | * @param name Application name | ||
1664 | * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up. | ||
1665 | * @c ECORE_CONFIG_ERR_FAIL otherwise. | ||
1666 | * @ingroup Ecore_Config_App_Lib_Group | ||
1667 | */ | ||
1668 | EAPI int | ||
1669 | ecore_config_init(const char *name) | ||
1670 | { | ||
1671 | char *path; | ||
1672 | Ecore_Config_Prop *list; | ||
1673 | _ecore_config_log_dom = eina_log_domain_register | ||
1674 | ("ecore_config", ECORE_CONFIG_DEFAULT_LOG_COLOR); | ||
1675 | if(_ecore_config_log_dom < 0) | ||
1676 | { | ||
1677 | EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module."); | ||
1678 | return -1; | ||
1679 | } | ||
1680 | _ecore_config_system_init_no_load(); | ||
1681 | |||
1682 | __ecore_config_app_name = strdup(name); | ||
1683 | __ecore_config_server_local = ecore_config_init_local(name); | ||
1684 | if (!__ecore_config_server_local) | ||
1685 | return ECORE_CONFIG_ERR_FAIL; | ||
1686 | |||
1687 | list = __ecore_config_bundle_local->data; | ||
1688 | free( __ecore_config_bundle_local ); | ||
1689 | __ecore_config_bundle_local = | ||
1690 | ecore_config_bundle_new(__ecore_config_server_local, "config"); | ||
1691 | __ecore_config_bundle_local->data = list; | ||
1692 | |||
1693 | path = ecore_config_theme_default_path_get(); | ||
1694 | ecore_config_string_default("/e/themes/search_path", path); | ||
1695 | if (path) | ||
1696 | free(path); | ||
1697 | |||
1698 | list = ecore_config_get("/e/themes/search_path"); | ||
1699 | if (list) | ||
1700 | { | ||
1701 | list->flags |= ECORE_CONFIG_FLAG_SYSTEM; | ||
1702 | list->flags &= ~ECORE_CONFIG_FLAG_MODIFIED; | ||
1703 | } | ||
1704 | |||
1705 | return _ecore_config_system_load(); | ||
1706 | } | ||
1707 | |||
1708 | /** | ||
1709 | * Frees memory and shuts down the library for an application. | ||
1710 | * @return @c ECORE_CONFIG_ERR_IGNORED . | ||
1711 | * @ingroup Ecore_Config_App_Lib_Group | ||
1712 | */ | ||
1713 | EAPI int | ||
1714 | ecore_config_shutdown(void) | ||
1715 | { | ||
1716 | return ecore_config_system_shutdown(); | ||
1717 | } | ||
1718 | |||
1719 | /** | ||
1720 | * @defgroup Ecore_Config_Lib_Lib_Group Ecore Config Library Functions | ||
1721 | * | ||
1722 | * Functions that are used to start up and shutdown the Enlightened | ||
1723 | * Property Library when used directly by an application. | ||
1724 | */ | ||
1725 | |||
1726 | /** | ||
1727 | * Initializes the Enlightened Property Library. | ||
1728 | * | ||
1729 | * This function is meant to be run from other programming libraries. | ||
1730 | * It should not be called from applications. | ||
1731 | * | ||
1732 | * This function (or @ref ecore_config_init ) | ||
1733 | * must be run before any other function in the | ||
1734 | * Enlightened Property Library, even if you have run @ref ecore_init . | ||
1735 | * | ||
1736 | * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up. | ||
1737 | * @c ECORE_CONFIG_ERR_FAIL otherwise. | ||
1738 | * @ingroup Ecore_Config_Lib_Lib_Group | ||
1739 | */ | ||
1740 | EAPI int | ||
1741 | ecore_config_system_init(void) | ||
1742 | { | ||
1743 | _ecore_config_system_init_no_load(); | ||
1744 | return _ecore_config_system_load(); | ||
1745 | } | ||
1746 | |||
1747 | static int | ||
1748 | _ecore_config_system_init_no_load(void) | ||
1749 | { | ||
1750 | char *p; | ||
1751 | |||
1752 | __ecore_config_system_init++; | ||
1753 | if (__ecore_config_system_init > 1) | ||
1754 | return ECORE_CONFIG_ERR_IGNORED; | ||
1755 | |||
1756 | DEBUG = -1; | ||
1757 | if ((p = getenv("ECORE_CONFIG_DEBUG")) && p[0] != 0) | ||
1758 | { | ||
1759 | DEBUG = atoi(p); | ||
1760 | } | ||
1761 | |||
1762 | __ecore_config_server_global = | ||
1763 | ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); | ||
1764 | if (!__ecore_config_server_global) | ||
1765 | return ECORE_CONFIG_ERR_FAIL; | ||
1766 | |||
1767 | __ecore_config_bundle_local = | ||
1768 | ecore_config_bundle_new(__ecore_config_server_global, "system"); | ||
1769 | |||
1770 | /* set up a simple default path */ | ||
1771 | ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes"); | ||
1772 | |||
1773 | return ECORE_CONFIG_ERR_SUCC; | ||
1774 | } | ||
1775 | |||
1776 | |||
1777 | static int | ||
1778 | _ecore_config_system_load(void) | ||
1779 | { | ||
1780 | char *buf, *p; | ||
1781 | Ecore_Config_Prop *sys; | ||
1782 | |||
1783 | if (__ecore_config_system_init != 1) | ||
1784 | return ECORE_CONFIG_ERR_FAIL; | ||
1785 | |||
1786 | if ((p = getenv("HOME"))) | ||
1787 | { /* debug-only ### FIXME */ | ||
1788 | if ((buf = malloc(PATH_MAX * sizeof(char)))) | ||
1789 | { | ||
1790 | snprintf(buf, PATH_MAX, "%s/.e/config.eet", p); | ||
1791 | if (ecore_config_file_load(buf) != 0) { | ||
1792 | /* even if this file (system.eet) doesn't exist we can | ||
1793 | * continue without it as it isn't striclty necessary. | ||
1794 | */ | ||
1795 | ecore_config_file_load(PACKAGE_DATA_DIR "/system.eet"); | ||
1796 | } | ||
1797 | sys = __ecore_config_bundle_local->data; | ||
1798 | while (sys) | ||
1799 | { | ||
1800 | /* unmark it modified - modification will mean it has been overridden */ | ||
1801 | sys->flags &= ~ECORE_CONFIG_FLAG_MODIFIED; | ||
1802 | /* mark as system so that examine can hide them */ | ||
1803 | sys->flags |= ECORE_CONFIG_FLAG_SYSTEM; | ||
1804 | sys = sys->next; | ||
1805 | } | ||
1806 | } | ||
1807 | free(buf); | ||
1808 | } | ||
1809 | |||
1810 | return ECORE_CONFIG_ERR_SUCC; | ||
1811 | } | ||
1812 | |||
1813 | |||
1814 | /** | ||
1815 | * Frees memory and shuts down the library for other programming libraries. | ||
1816 | * @return @c ECORE_CONFIG_ERR_IGNORED | ||
1817 | * @ingroup Ecore_Config_Lib_Lib_Group | ||
1818 | */ | ||
1819 | EAPI int | ||
1820 | ecore_config_system_shutdown(void) | ||
1821 | { | ||
1822 | int ret; | ||
1823 | |||
1824 | __ecore_config_system_init--; | ||
1825 | if (__ecore_config_system_init > 0) | ||
1826 | return ECORE_CONFIG_ERR_IGNORED; | ||
1827 | |||
1828 | ret = _ecore_config_ipc_exit(); | ||
1829 | if (__ecore_config_app_name) | ||
1830 | free(__ecore_config_app_name); | ||
1831 | while(__ecore_config_bundle_local->data) | ||
1832 | ecore_config_dst(__ecore_config_bundle_local->data); | ||
1833 | free(__ecore_config_bundle_local); | ||
1834 | free(__ecore_config_server_local); | ||
1835 | free(__ecore_config_server_global); | ||
1836 | eina_log_domain_unregister(_ecore_config_log_dom); | ||
1837 | _ecore_config_log_dom = -1; | ||
1838 | return ret; | ||
1839 | } | ||
1840 | |||
1841 | static inline void * | ||
1842 | __ecore_argb_to_long(int a, int r, int g, int b, long *v) | ||
1843 | { | ||
1844 | *v = ((a << 24) & 0xff000000 ) | ||
1845 | | ((r << 16) & 0xff0000 ) | ||
1846 | | ((g << 8) & 0xff00 ) | ||
1847 | | ( b & 0xff ); | ||
1848 | |||
1849 | return v; | ||
1850 | } | ||
1851 | |||
1852 | static inline void * | ||
1853 | __ecore_argbstr_to_long(const char *argb, long *v) | ||
1854 | { | ||
1855 | char *l = NULL; | ||
1856 | |||
1857 | // convert hexadecimal string #..., #0x..., 0x..., ... to long | ||
1858 | if(*argb == '#') | ||
1859 | argb++; | ||
1860 | *v = (long)strtoul( argb, &l, 16); | ||
1861 | |||
1862 | if(*l) | ||
1863 | { | ||
1864 | ERR("ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?", argb); | ||
1865 | return NULL; | ||
1866 | } | ||
1867 | |||
1868 | return v; | ||
1869 | } | ||
1870 | |||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_db.c b/libraries/ecore/src/lib/ecore_config/ecore_config_db.c deleted file mode 100644 index 6238958..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_db.c +++ /dev/null | |||
@@ -1,296 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <stdio.h> | ||
7 | #include <string.h> | ||
8 | #include <limits.h> | ||
9 | |||
10 | #include <sys/param.h> | ||
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <unistd.h> | ||
14 | #include <locale.h> | ||
15 | |||
16 | #include <Eet.h> | ||
17 | |||
18 | #include "Ecore_Config.h" | ||
19 | #include "ecore_config_private.h" | ||
20 | #include "ecore_config_util.h" | ||
21 | |||
22 | struct _Ecore_Config_DB_File | ||
23 | { | ||
24 | Eet_File *ef; | ||
25 | }; | ||
26 | |||
27 | Ecore_Config_DB_File * | ||
28 | _ecore_config_db_open_read(const char *file) | ||
29 | { | ||
30 | Eet_File *ef; | ||
31 | Ecore_Config_DB_File *db; | ||
32 | |||
33 | eet_init(); | ||
34 | db = malloc(sizeof(Ecore_Config_DB_File)); | ||
35 | if (!db) return NULL; | ||
36 | ef = eet_open((char*)file, EET_FILE_MODE_READ); | ||
37 | if (!ef) | ||
38 | { | ||
39 | free(db); | ||
40 | return NULL; | ||
41 | } | ||
42 | db->ef = ef; | ||
43 | return db; | ||
44 | } | ||
45 | |||
46 | Ecore_Config_DB_File * | ||
47 | _ecore_config_db_open_write(const char *file) | ||
48 | { | ||
49 | Eet_File *ef; | ||
50 | Ecore_Config_DB_File *db; | ||
51 | |||
52 | eet_init(); | ||
53 | db = malloc(sizeof(Ecore_Config_DB_File)); | ||
54 | if (!db) return NULL; | ||
55 | ef = eet_open((char*)file, EET_FILE_MODE_WRITE); | ||
56 | if (!ef) | ||
57 | { | ||
58 | free(db); | ||
59 | return NULL; | ||
60 | } | ||
61 | db->ef = ef; | ||
62 | return db; | ||
63 | } | ||
64 | |||
65 | void | ||
66 | _ecore_config_db_close(Ecore_Config_DB_File *db) | ||
67 | { | ||
68 | eet_close(db->ef); | ||
69 | free(db); | ||
70 | eet_shutdown(); | ||
71 | } | ||
72 | |||
73 | char ** | ||
74 | _ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret) | ||
75 | { | ||
76 | char **keys; | ||
77 | int key_count; | ||
78 | int i; | ||
79 | |||
80 | keys = eet_list(db->ef, (char*)"*", &key_count); | ||
81 | if (!keys) | ||
82 | { | ||
83 | *num_ret = 0; | ||
84 | return NULL; | ||
85 | } | ||
86 | /* make keys freeable - this is safe to do */ | ||
87 | for (i = 0; i < key_count; i++) keys[i] = strdup(keys[i]); | ||
88 | *num_ret = key_count; | ||
89 | return keys; | ||
90 | } | ||
91 | |||
92 | Ecore_Config_Type | ||
93 | _ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key) | ||
94 | { | ||
95 | char *data; | ||
96 | int size; | ||
97 | |||
98 | data = eet_read(db->ef, (char*)key, &size); | ||
99 | if (data) | ||
100 | { | ||
101 | if (size <= 2) | ||
102 | { | ||
103 | free(data); | ||
104 | return ECORE_CONFIG_NIL; | ||
105 | } | ||
106 | if (data[size - 1] != 0) | ||
107 | { | ||
108 | free(data); | ||
109 | return ECORE_CONFIG_NIL; | ||
110 | } | ||
111 | return (Ecore_Config_Type) data[0]; | ||
112 | } | ||
113 | return ECORE_CONFIG_NIL; | ||
114 | } | ||
115 | |||
116 | int | ||
117 | _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key) | ||
118 | { | ||
119 | char *data, *value; | ||
120 | int size; | ||
121 | Ecore_Config_Type type; | ||
122 | |||
123 | data = eet_read(db->ef, (char*)key, &size); | ||
124 | if (data) | ||
125 | { | ||
126 | int l; | ||
127 | char *prev_locale; | ||
128 | |||
129 | if (size <= 2) | ||
130 | { | ||
131 | free(data); | ||
132 | return 0; | ||
133 | } | ||
134 | if (data[size - 1] != 0) | ||
135 | { | ||
136 | free(data); | ||
137 | return 0; | ||
138 | } | ||
139 | /* "type" NIL 1242 NIL */ | ||
140 | l = strlen(data); | ||
141 | if (l >= (size - 1)) | ||
142 | { | ||
143 | free(data); | ||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | type = data[0]; | ||
148 | value = data + l + 1; | ||
149 | |||
150 | switch (type) | ||
151 | { | ||
152 | case ECORE_CONFIG_INT: | ||
153 | case ECORE_CONFIG_BLN: | ||
154 | { | ||
155 | int tmp; | ||
156 | prev_locale = setlocale(LC_NUMERIC, "C"); | ||
157 | tmp = atoi(value); | ||
158 | if (prev_locale) setlocale(LC_NUMERIC, prev_locale); | ||
159 | |||
160 | ecore_config_typed_set(key, (void *)&tmp, type); | ||
161 | break; | ||
162 | } | ||
163 | case ECORE_CONFIG_FLT: | ||
164 | { | ||
165 | float tmp; | ||
166 | prev_locale = setlocale(LC_NUMERIC, "C"); | ||
167 | tmp = atof(value); | ||
168 | if (prev_locale) setlocale(LC_NUMERIC, prev_locale); | ||
169 | |||
170 | ecore_config_typed_set(key, (void *)&tmp, type); | ||
171 | break; | ||
172 | } | ||
173 | case ECORE_CONFIG_RGB: | ||
174 | ecore_config_argbstr_set(key, value); | ||
175 | break; | ||
176 | case ECORE_CONFIG_STR: | ||
177 | case ECORE_CONFIG_THM: | ||
178 | ecore_config_typed_set(key, (void *)value, type); | ||
179 | break; | ||
180 | case ECORE_CONFIG_SCT: | ||
181 | INF("loading struct %s", key); | ||
182 | break; | ||
183 | default: | ||
184 | WRN("Type %d not handled", type); | ||
185 | } | ||
186 | free(data); | ||
187 | return 1; | ||
188 | } | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | void * | ||
194 | _ecore_config_db_key_data_get(Ecore_Config_DB_File *db, const char *key, int *size_ret) | ||
195 | { | ||
196 | char *data; | ||
197 | int size; | ||
198 | |||
199 | data = eet_read(db->ef, (char*)key, &size); | ||
200 | if (data) | ||
201 | { | ||
202 | int l; | ||
203 | char *dat; | ||
204 | |||
205 | if (size <= 2) | ||
206 | { | ||
207 | free(data); | ||
208 | return NULL; | ||
209 | } | ||
210 | if (data[size - 1] != 0) | ||
211 | { | ||
212 | free(data); | ||
213 | return NULL; | ||
214 | } | ||
215 | * "type" NIL data_goes_here NIL * | ||
216 | l = strlen(data); | ||
217 | if (l >= (size - 1)) | ||
218 | { | ||
219 | free(data); | ||
220 | return NULL; | ||
221 | } | ||
222 | dat = malloc(size - (l + 2)); | ||
223 | memcpy(dat, data + l + 1, size - (l + 2)); | ||
224 | free(data); | ||
225 | *size_ret = size - (l + 2); | ||
226 | return dat; | ||
227 | } | ||
228 | return NULL; | ||
229 | }*/ | ||
230 | |||
231 | void | ||
232 | _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e) | ||
233 | { | ||
234 | char *prev_locale= NULL; | ||
235 | char *val = NULL; | ||
236 | char *r = NULL; | ||
237 | int num; | ||
238 | |||
239 | prev_locale = setlocale(LC_NUMERIC, "C"); | ||
240 | |||
241 | switch (e->type) | ||
242 | { | ||
243 | case ECORE_CONFIG_INT: | ||
244 | esprintf(&val, "%i", _ecore_config_int_get(e)); | ||
245 | break; | ||
246 | case ECORE_CONFIG_BLN: | ||
247 | esprintf(&val, "%i", _ecore_config_boolean_get(e)); | ||
248 | break; | ||
249 | case ECORE_CONFIG_FLT: | ||
250 | esprintf(&val, "%16.16f", _ecore_config_float_get(e)); | ||
251 | break; | ||
252 | case ECORE_CONFIG_STR: | ||
253 | val = _ecore_config_string_get(e); | ||
254 | break; | ||
255 | case ECORE_CONFIG_THM: | ||
256 | val = _ecore_config_theme_get(e); | ||
257 | break; | ||
258 | case ECORE_CONFIG_RGB: | ||
259 | val = _ecore_config_argbstr_get(e); | ||
260 | break; | ||
261 | default: | ||
262 | WRN("Type %d not handled", e->type); | ||
263 | } | ||
264 | |||
265 | if (prev_locale) | ||
266 | { | ||
267 | setlocale(LC_NUMERIC, prev_locale); | ||
268 | } | ||
269 | |||
270 | if(val) | ||
271 | { | ||
272 | num = esprintf(&r, "%c%c%s%c", (char) e->type, 0, val, 0); | ||
273 | if(num) | ||
274 | eet_write(db->ef, e->key, r, num, 1); | ||
275 | free(r); | ||
276 | } | ||
277 | |||
278 | free(val); | ||
279 | } | ||
280 | /* | ||
281 | void | ||
282 | _ecore_config_db_key_data_set(Ecore_Config_DB_File *db, const char *key, void *data, int data_size) | ||
283 | { | ||
284 | char *buf; | ||
285 | int num; | ||
286 | |||
287 | num = 1 + 1 + data_size + 1; | ||
288 | buf = malloc(num); | ||
289 | if (!buf) return; | ||
290 | buf[0] = (char) ECORE_CONFIG_BIN; | ||
291 | buf[1] = 0; | ||
292 | memcpy(buf + 2, data, data_size); | ||
293 | buf[num - 1] = 0; | ||
294 | eet_write(db->ef, (char*)key, buf, num, 1); | ||
295 | free(buf); | ||
296 | }*/ | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c b/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c deleted file mode 100644 index a134952..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c +++ /dev/null | |||
@@ -1,803 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | #include <stdio.h> | ||
7 | #include <stdlib.h> | ||
8 | |||
9 | #include <sys/types.h> | ||
10 | #include <sys/stat.h> | ||
11 | |||
12 | #include "Ecore_Config.h" | ||
13 | #include "Ecore.h" | ||
14 | #include "ecore_config_private.h" | ||
15 | typedef struct __Ecore_Config_Arg_Callback _Ecore_Config_Arg_Callback; | ||
16 | struct __Ecore_Config_Arg_Callback | ||
17 | { | ||
18 | char short_opt; | ||
19 | char *long_opt; | ||
20 | char *description; | ||
21 | void *data; | ||
22 | void (*func)(char *val, void *data); | ||
23 | Ecore_Config_Type type; | ||
24 | _Ecore_Config_Arg_Callback *next; | ||
25 | }; | ||
26 | |||
27 | char *__ecore_config_app_description; | ||
28 | _Ecore_Config_Arg_Callback *_ecore_config_arg_callbacks; | ||
29 | |||
30 | /* shorthand prop setup code to make client apps a little smaller ;) */ | ||
31 | |||
32 | /** | ||
33 | * Creates a new property, if it does not already exist, and sets its | ||
34 | * attributes to those given. | ||
35 | * | ||
36 | * The type of the property is guessed from the key and the value | ||
37 | * given. | ||
38 | * | ||
39 | * @param key The property key. | ||
40 | * @param val Pointer to default value of key. | ||
41 | * @param short_opt Short option used to set the property from command | ||
42 | * line. | ||
43 | * @param long_opt Long option used to set the property from command line. | ||
44 | * @param desc String description of property. | ||
45 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
46 | * @ingroup Ecore_Config_Create_Group | ||
47 | */ | ||
48 | int | ||
49 | ecore_config_create(const char *key, void *val, char short_opt, char *long_opt, | ||
50 | char *desc) | ||
51 | { | ||
52 | int type = ecore_config_type_guess(key, val); | ||
53 | |||
54 | return ecore_config_typed_create(key, val, type, short_opt, long_opt, desc); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * Creates a new property, if it does not already exist, and sets its | ||
59 | * attributes to those given. | ||
60 | * @param key The property key. | ||
61 | * @param val Pointer to default value of key. | ||
62 | * @param type Type of the property. | ||
63 | * @param short_opt Short option used to set the property from | ||
64 | * command line. | ||
65 | * @param long_opt Long option used to set the property from command line. | ||
66 | * @param desc String description of property. | ||
67 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
68 | * @ingroup Ecore_Config_Create_Group | ||
69 | */ | ||
70 | int | ||
71 | ecore_config_typed_create(const char *key, void *val, int type, char short_opt, | ||
72 | char *long_opt, char *desc) | ||
73 | { | ||
74 | int ret; | ||
75 | |||
76 | if ((ret = | ||
77 | ecore_config_typed_default(key, val, type)) != ECORE_CONFIG_ERR_SUCC) | ||
78 | return ret; | ||
79 | if ((ret = | ||
80 | ecore_config_short_opt_set(key, short_opt)) != ECORE_CONFIG_ERR_SUCC) | ||
81 | return ret; | ||
82 | if ((ret = | ||
83 | ecore_config_long_opt_set(key, long_opt)) != ECORE_CONFIG_ERR_SUCC) | ||
84 | return ret; | ||
85 | ret = ecore_config_describe(key, desc); | ||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | /** | ||
90 | * Creates a new boolean property, if it does not already exist, and sets its | ||
91 | * attributes to those given. | ||
92 | * @param key The property key. | ||
93 | * @param val Default boolean value of key. | ||
94 | * @param short_opt Short option used to set the property from command | ||
95 | * line. | ||
96 | * @param long_opt Long option used to set the property from command line. | ||
97 | * @param desc String description of property. | ||
98 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
99 | * @ingroup Ecore_Config_Create_Group | ||
100 | */ | ||
101 | int | ||
102 | ecore_config_boolean_create(const char *key, int val, char short_opt, | ||
103 | char *long_opt, char *desc) | ||
104 | { | ||
105 | return | ||
106 | ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_BLN, short_opt, long_opt, | ||
107 | desc); | ||
108 | } | ||
109 | |||
110 | /** | ||
111 | * Creates a new integer property, if it does not already exist, and sets its | ||
112 | * attributes to those given. | ||
113 | * @param key The property key. | ||
114 | * @param val Default integer value of key. | ||
115 | * @param short_opt Short option used to set the property from command | ||
116 | * line. | ||
117 | * @param long_opt Long option used to set the property from command line. | ||
118 | * @param desc String description of property. | ||
119 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
120 | * @ingroup Ecore_Config_Create_Group | ||
121 | */ | ||
122 | int | ||
123 | ecore_config_int_create(const char *key, int val, char short_opt, | ||
124 | char *long_opt, char *desc) | ||
125 | { | ||
126 | return | ||
127 | ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt, | ||
128 | desc); | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * Creates a new integer property, if it does not already exist, and sets its | ||
133 | * attributes to those given. | ||
134 | * @param key The property key. | ||
135 | * @param val Default integer value of key. | ||
136 | * @param low Lowest valid integer value for the property. | ||
137 | * @param high Highest valid integer value for the property. | ||
138 | * @param step Increment value for the property. | ||
139 | * @param short_opt Short option used to set the property from command | ||
140 | * line. | ||
141 | * @param long_opt Long option used to set the property from command line. | ||
142 | * @param desc String description of property. | ||
143 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
144 | * @ingroup Ecore_Config_Create_Group | ||
145 | */ | ||
146 | int | ||
147 | ecore_config_int_create_bound(const char *key, int val, int low, int high, | ||
148 | int step, char short_opt, char *long_opt, | ||
149 | char *desc) | ||
150 | { | ||
151 | Ecore_Config_Prop *e; | ||
152 | int ret; | ||
153 | |||
154 | ret = | ||
155 | ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt, | ||
156 | desc); | ||
157 | if (ret != ECORE_CONFIG_ERR_SUCC) | ||
158 | return ret; | ||
159 | e = ecore_config_get(key); | ||
160 | if (e) | ||
161 | { | ||
162 | e->step = step; | ||
163 | e->flags |= ECORE_CONFIG_FLAG_BOUNDS; | ||
164 | e->lo = low; | ||
165 | e->hi = high; | ||
166 | ecore_config_bound(e); | ||
167 | } | ||
168 | return ret; | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * Creates a new string property, if it does not already exist, and sets its | ||
173 | * attributes to those given. | ||
174 | * @param key The property key. | ||
175 | * @param val Default value of key. | ||
176 | * @param short_opt Short option used to set the property from command | ||
177 | * line. | ||
178 | * @param long_opt Long option used to set the property from command line. | ||
179 | * @param desc String description of property. | ||
180 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
181 | * @ingroup Ecore_Config_Create_Group | ||
182 | */ | ||
183 | int | ||
184 | ecore_config_string_create(const char *key, char *val, char short_opt, | ||
185 | char *long_opt, char *desc) | ||
186 | { | ||
187 | return | ||
188 | ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_STR, short_opt, long_opt, | ||
189 | desc); | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * Creates a new float property, if it does not already exist, and sets its | ||
194 | * attributes to those given. | ||
195 | * @param key The property key. | ||
196 | * @param val Default float value of key. | ||
197 | * @param short_opt Short option used to set the property from command | ||
198 | * line. | ||
199 | * @param long_opt Long option used to set the property from command line. | ||
200 | * @param desc String description of property. | ||
201 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
202 | * @ingroup Ecore_Config_Create_Group | ||
203 | */ | ||
204 | int | ||
205 | ecore_config_float_create(const char *key, float val, char short_opt, | ||
206 | char *long_opt, char *desc) | ||
207 | { | ||
208 | return | ||
209 | ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt, | ||
210 | desc); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * Creates a new float property, if it does not already exist, and sets its | ||
215 | * attributes to those given. | ||
216 | * @param key The property key. | ||
217 | * @param val Default float value of key. | ||
218 | * @param low Lowest valid float value for the property. | ||
219 | * @param high Highest valid float value for the property. | ||
220 | * @param step Increment value for the property. | ||
221 | * @param short_opt Short option used to set the property from command | ||
222 | * line. | ||
223 | * @param long_opt Long option used to set the property from command line. | ||
224 | * @param desc String description of property. | ||
225 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
226 | * @ingroup Ecore_Config_Create_Group | ||
227 | */ | ||
228 | int | ||
229 | ecore_config_float_create_bound(const char *key, float val, float low, | ||
230 | float high, float step, char short_opt, | ||
231 | char *long_opt, char *desc) | ||
232 | { | ||
233 | Ecore_Config_Prop *e; | ||
234 | int ret; | ||
235 | |||
236 | ret = | ||
237 | ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt, | ||
238 | desc); | ||
239 | e = ecore_config_get(key); | ||
240 | if (e) | ||
241 | { | ||
242 | e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); | ||
243 | e->flags |= ECORE_CONFIG_FLAG_BOUNDS; | ||
244 | e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION); | ||
245 | e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION); | ||
246 | ecore_config_bound(e); | ||
247 | } | ||
248 | return ret; | ||
249 | } | ||
250 | |||
251 | /** | ||
252 | * Creates a new color property, if it does not already exist, and sets its | ||
253 | * attributes to those given. | ||
254 | * @param key The property key. | ||
255 | * @param val Default color value of key, as a hexadecimal string. | ||
256 | * @param short_opt Short option used to set the property from command | ||
257 | * line. | ||
258 | * @param long_opt Long option used to set the property from command line. | ||
259 | * @param desc String description of property. | ||
260 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
261 | * @ingroup Ecore_Config_Create_Group | ||
262 | */ | ||
263 | int | ||
264 | ecore_config_argb_create(const char *key, char *val, char short_opt, | ||
265 | char *long_opt, char *desc) | ||
266 | { | ||
267 | return | ||
268 | ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_RGB, short_opt, long_opt, | ||
269 | desc); | ||
270 | } | ||
271 | |||
272 | /** | ||
273 | * Creates a new theme property, if it does not already exist, and sets its | ||
274 | * attributes to those given. | ||
275 | * @param key The property key. | ||
276 | * @param val Default theme name for the property. | ||
277 | * @param short_opt Short option used to set the property from command | ||
278 | * line. | ||
279 | * @param long_opt Long option used to set the property from command line. | ||
280 | * @param desc String description of property. | ||
281 | * @return @c ECORE_CONFIG_ERR_SUCC on success. | ||
282 | * @ingroup Ecore_Config_Create_Group | ||
283 | */ | ||
284 | int | ||
285 | ecore_config_theme_create(const char *key, char *val, char short_opt, | ||
286 | char *long_opt, char *desc) | ||
287 | { | ||
288 | return | ||
289 | ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_THM, short_opt, long_opt, | ||
290 | desc); | ||
291 | } | ||
292 | |||
293 | /* this should only be built if evas is present */ | ||
294 | |||
295 | /** | ||
296 | * Calls evas_font_path_append on @p evas for each of the font names stored | ||
297 | * in the property "/e/font/path". | ||
298 | * @param evas Evas object to append the font names to. | ||
299 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA | ||
300 | * is returned if the property has not been set. | ||
301 | */ | ||
302 | int | ||
303 | ecore_config_evas_font_path_apply(Evas * evas) | ||
304 | { | ||
305 | char *font_path, *font_path_tmp, *ptr, *end; | ||
306 | |||
307 | font_path = ecore_config_string_get("/e/font/path"); | ||
308 | |||
309 | if (!font_path) | ||
310 | return ECORE_CONFIG_ERR_NODATA; | ||
311 | ptr = font_path; | ||
312 | end = font_path + strlen(font_path); | ||
313 | font_path_tmp = font_path; | ||
314 | while (ptr && ptr < end) | ||
315 | { | ||
316 | while (*ptr != '|' && ptr < end) | ||
317 | ptr++; | ||
318 | if (ptr < end) | ||
319 | *ptr = '\0'; | ||
320 | |||
321 | evas_font_path_append(evas, font_path_tmp); | ||
322 | ptr++; | ||
323 | font_path_tmp = ptr; | ||
324 | } | ||
325 | |||
326 | free(font_path); | ||
327 | |||
328 | return ECORE_CONFIG_ERR_SUCC; | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Retrieves the default theme search path. | ||
333 | * | ||
334 | * @return The default theme search path. | ||
335 | */ | ||
336 | char * | ||
337 | ecore_config_theme_default_path_get(void) | ||
338 | { | ||
339 | char *path, *home; | ||
340 | int len; | ||
341 | |||
342 | home = getenv("HOME"); | ||
343 | len = strlen(PACKAGE_DATA_DIR "/../") + strlen(__ecore_config_app_name) + | ||
344 | strlen("/themes/") + 1; | ||
345 | if (home) | ||
346 | len += strlen(home) + strlen("/.e/apps/") + | ||
347 | strlen(__ecore_config_app_name) + | ||
348 | strlen("/themes/|"); /* no \0, as that is above */ | ||
349 | |||
350 | if (!(path = malloc(len))) | ||
351 | return NULL; | ||
352 | |||
353 | *path = '\0'; | ||
354 | if (home) | ||
355 | { | ||
356 | strcat(path, home); | ||
357 | strcat(path, "/.e/apps/"); | ||
358 | strcat(path, __ecore_config_app_name); | ||
359 | strcat(path, "/themes/|"); | ||
360 | } | ||
361 | strcat(path, PACKAGE_DATA_DIR "/../"); | ||
362 | strcat(path, __ecore_config_app_name); | ||
363 | strcat(path, "/themes/"); | ||
364 | |||
365 | return path; | ||
366 | } | ||
367 | |||
368 | /** | ||
369 | * Retrieves the search path used to find themes. | ||
370 | * | ||
371 | * The search path is stored in the property "/e/themes/search_path". If | ||
372 | * the property has not been set, the default path used is | ||
373 | * "/usr/local/share/<app_name>/themes|~/.e/apps/<app_name>/themes". | ||
374 | * See @ref ecore_config_theme_default_path_get for more information about | ||
375 | * the default path. | ||
376 | * | ||
377 | * @return The search path. @c NULL is returned if there is no memory left. | ||
378 | */ | ||
379 | char * | ||
380 | ecore_config_theme_search_path_get(void) | ||
381 | { | ||
382 | char *search_path; | ||
383 | search_path = ecore_config_string_get("/e/themes/search_path"); | ||
384 | |||
385 | /* this should no longer be the case, as it is defaulted in init */ | ||
386 | if (!search_path) | ||
387 | { | ||
388 | search_path = ecore_config_theme_default_path_get(); | ||
389 | if (search_path) | ||
390 | { | ||
391 | ecore_config_string_default("/e/themes/search_path", search_path); | ||
392 | free(search_path); | ||
393 | } | ||
394 | } | ||
395 | return search_path; | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * Adds the given path to the search path used to find themes. | ||
400 | * | ||
401 | * If the search path is successfully, the new search path will be saved | ||
402 | * into the property "/e/themes/search_path". Therefore, this function | ||
403 | * should be called @b after @ref ecore_config_load to allow a user to | ||
404 | * override the default search path. | ||
405 | * | ||
406 | * @param path The given | ||
407 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL | ||
408 | * will be returned if @p path already exists in the search path. | ||
409 | * @c ECORE_CONFIG_ERR_FAIL is returned if @p path is @c NULL. | ||
410 | */ | ||
411 | int | ||
412 | ecore_config_theme_search_path_append(const char *path) | ||
413 | { | ||
414 | char *search_path, *loc, *new_search_path; | ||
415 | int len, search_len; | ||
416 | Ecore_Config_Prop *prop; | ||
417 | |||
418 | if (!path) | ||
419 | return ECORE_CONFIG_ERR_NODATA; | ||
420 | search_path = ecore_config_theme_search_path_get(); | ||
421 | |||
422 | loc = strstr(search_path, path); | ||
423 | len = strlen(path); | ||
424 | search_len = strlen(search_path); | ||
425 | |||
426 | if (!loc || (loc != search_path && *(loc - 1) != '|') || | ||
427 | (loc != (search_path + search_len - len) && *(loc + len - 1) != '|')) | ||
428 | { | ||
429 | new_search_path = malloc(search_len + len + 2); /* 2 = \0 + | */ | ||
430 | strcpy(new_search_path, search_path); | ||
431 | strncat(new_search_path, "|", 1); | ||
432 | strncat(new_search_path, path, len); | ||
433 | |||
434 | ecore_config_string_set("/e/themes/search_path", new_search_path); | ||
435 | prop = ecore_config_get("/e/themes/search_path"); | ||
436 | if (prop) | ||
437 | prop->flags &= ~ECORE_CONFIG_FLAG_MODIFIED; | ||
438 | |||
439 | free(new_search_path); | ||
440 | |||
441 | return ECORE_CONFIG_ERR_SUCC; | ||
442 | } | ||
443 | return ECORE_CONFIG_ERR_FAIL; | ||
444 | } | ||
445 | |||
446 | /** | ||
447 | * Retrieve a theme file's full path. | ||
448 | * | ||
449 | * The search path for theme files is given by @ref | ||
450 | * ecore_config_theme_search_path_get . | ||
451 | * | ||
452 | * @param name The name of the theme. | ||
453 | * @return A full path to the theme on success. @c NULL will be returned | ||
454 | * if @p name is @c NULL or no theme matching the given name could | ||
455 | * be found. | ||
456 | */ | ||
457 | char * | ||
458 | ecore_config_theme_with_path_from_name_get(char *name) | ||
459 | { | ||
460 | char *search_path, *search_path_tmp, *ptr, *end, *file; | ||
461 | struct stat st; | ||
462 | |||
463 | if (!name) | ||
464 | return NULL; /* no theme specified (nor a default) */ | ||
465 | |||
466 | search_path = ecore_config_theme_search_path_get(); | ||
467 | ptr = search_path; | ||
468 | end = search_path + strlen(search_path); | ||
469 | search_path_tmp = search_path; | ||
470 | while (ptr && ptr < end) | ||
471 | { | ||
472 | while (*ptr != '|' && ptr < end) | ||
473 | ptr++; | ||
474 | if (ptr < end) | ||
475 | *ptr = '\0'; | ||
476 | |||
477 | file = malloc(strlen(search_path_tmp) + strlen(name) + 6); | ||
478 | /* 6 = / + .edj + \0 */ | ||
479 | |||
480 | snprintf(file, strlen(search_path_tmp) + strlen(name) + 6, | ||
481 | "%s/%s.edj", search_path_tmp, name); | ||
482 | |||
483 | if (stat(file, &st) == 0) | ||
484 | { | ||
485 | free(search_path); | ||
486 | return file; | ||
487 | } | ||
488 | free(file); | ||
489 | ptr++; | ||
490 | search_path_tmp = ptr; | ||
491 | } | ||
492 | |||
493 | free(search_path); | ||
494 | |||
495 | return NULL; /* we could not find the theme with that name in search path */ | ||
496 | } | ||
497 | |||
498 | /** | ||
499 | * Retrieves the full path to the theme file of the theme stored in the | ||
500 | * given property. | ||
501 | * | ||
502 | * The search path for themes is given by @ref | ||
503 | * ecore_config_theme_search_path_get . | ||
504 | * | ||
505 | * @param key The given property. | ||
506 | * @return A full path to the theme on success, or @c NULL on failure. | ||
507 | * This function will fail if no key is specified or not theme | ||
508 | * matching that given by the property @p key could be found. | ||
509 | */ | ||
510 | char * | ||
511 | ecore_config_theme_with_path_get(const char *key) | ||
512 | { | ||
513 | return | ||
514 | ecore_config_theme_with_path_from_name_get(ecore_config_theme_get(key)); | ||
515 | } | ||
516 | |||
517 | static const char *_ecore_config_short_types[] = | ||
518 | { " ", "<int> ", "<flt> ", "<str> ", "<rgb> ", "<str> ", "<bool>" }; | ||
519 | |||
520 | /** | ||
521 | * Prints the property list of the local configuration bundle to output. | ||
522 | */ | ||
523 | void | ||
524 | ecore_config_args_display(void) | ||
525 | { | ||
526 | Ecore_Config_Prop *props; | ||
527 | _Ecore_Config_Arg_Callback *callbacks; | ||
528 | |||
529 | if (__ecore_config_app_description) | ||
530 | ERR("%s\n\n", __ecore_config_app_description); | ||
531 | ERR("Supported Options:"); | ||
532 | ERR(" -h, --help\t Print this text"); | ||
533 | if (!__ecore_config_bundle_local) | ||
534 | return; | ||
535 | props = __ecore_config_bundle_local->data; | ||
536 | while (props) | ||
537 | { | ||
538 | /* if it is a system prop, or cannot be set on command line hide it */ | ||
539 | if (props->flags & ECORE_CONFIG_FLAG_SYSTEM || (!props->short_opt && !props->long_opt)) | ||
540 | { | ||
541 | props = props->next; | ||
542 | continue; | ||
543 | } | ||
544 | INF(" %c%c%c --%s\t%s %s", props->short_opt ? '-' : ' ', | ||
545 | props->short_opt ? props->short_opt : ' ', | ||
546 | props->short_opt ? ',' : ' ', | ||
547 | props->long_opt ? props->long_opt : props->key, | ||
548 | _ecore_config_short_types[props->type], | ||
549 | props->description ? props->description : | ||
550 | "(no description available)"); | ||
551 | |||
552 | props = props->next; | ||
553 | } | ||
554 | callbacks = _ecore_config_arg_callbacks; | ||
555 | while (callbacks) | ||
556 | { | ||
557 | INF(" %c%c%c --%s\t%s %s", callbacks->short_opt ? '-' : ' ', | ||
558 | callbacks->short_opt ? callbacks->short_opt : ' ', | ||
559 | callbacks->short_opt ? ',' : ' ', | ||
560 | callbacks->long_opt ? callbacks->long_opt : "", | ||
561 | _ecore_config_short_types[callbacks->type], | ||
562 | callbacks->description ? callbacks->description : | ||
563 | "(no description available)"); | ||
564 | |||
565 | callbacks = callbacks->next; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | static int | ||
570 | ecore_config_parse_set(Ecore_Config_Prop * prop, char *arg, char *opt, | ||
571 | char opt2) | ||
572 | { | ||
573 | if (!arg) | ||
574 | { | ||
575 | if (opt) | ||
576 | ERR("Missing expected argument for option --%s", opt); | ||
577 | else | ||
578 | ERR("Missing expected argument for option -%c", opt2); | ||
579 | return ECORE_CONFIG_PARSE_EXIT; | ||
580 | } | ||
581 | else | ||
582 | { | ||
583 | ecore_config_set(prop->key, arg); | ||
584 | prop->flags |= ECORE_CONFIG_FLAG_CMDLN; | ||
585 | } | ||
586 | return ECORE_CONFIG_PARSE_CONTINUE; | ||
587 | } | ||
588 | |||
589 | static void | ||
590 | ecore_config_args_callback_add(char short_opt, char *long_opt, char *desc, | ||
591 | void (*func)(char *val, void *data), | ||
592 | void *data, Ecore_Config_Type type) { | ||
593 | _Ecore_Config_Arg_Callback *new_cb; | ||
594 | |||
595 | new_cb = malloc(sizeof(_Ecore_Config_Arg_Callback)); | ||
596 | new_cb->short_opt = short_opt; | ||
597 | if (long_opt) | ||
598 | new_cb->long_opt = strdup(long_opt); | ||
599 | if (desc) | ||
600 | new_cb->description = strdup(desc); | ||
601 | new_cb->data = data; | ||
602 | new_cb->func = func; | ||
603 | new_cb->type = type; | ||
604 | |||
605 | new_cb->next = _ecore_config_arg_callbacks; | ||
606 | _ecore_config_arg_callbacks = new_cb; | ||
607 | } | ||
608 | |||
609 | void | ||
610 | ecore_config_args_callback_str_add(char short_opt, char *long_opt, char *desc, | ||
611 | void (*func)(char *val, void *data), | ||
612 | void *data) { | ||
613 | ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_STR); | ||
614 | } | ||
615 | |||
616 | void | ||
617 | ecore_config_args_callback_noarg_add(char short_opt, char *long_opt, char *desc, | ||
618 | void (*func)(char *val, void *data), | ||
619 | void *data) { | ||
620 | ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_NIL); | ||
621 | } | ||
622 | |||
623 | /** | ||
624 | * Parse the arguments set by @ref ecore_app_args_set and set properties | ||
625 | * accordingly. | ||
626 | * | ||
627 | * @return @c ECORE_CONFIG_PARSE_CONTINUE if successful. | ||
628 | * @c ECORE_CONFIG_PARSE_EXIT is returned if an unrecognised option | ||
629 | * is found. @c ECORE_CONFIG_PARSE_HELP is returned if help was | ||
630 | * displayed. | ||
631 | */ | ||
632 | int | ||
633 | ecore_config_args_parse(void) | ||
634 | { | ||
635 | int argc; | ||
636 | char **argv; | ||
637 | int nextarg, next_short_opt, found, ret; | ||
638 | char *arg; | ||
639 | char *long_opt, short_opt; | ||
640 | Ecore_Config_Prop *prop; | ||
641 | _Ecore_Config_Arg_Callback *callback; | ||
642 | |||
643 | ecore_app_args_get(&argc, &argv); | ||
644 | nextarg = 1; | ||
645 | while (nextarg < argc) | ||
646 | { | ||
647 | arg = argv[nextarg]; | ||
648 | |||
649 | if (*arg != '-') | ||
650 | { | ||
651 | ERR("Unexpected attribute \"%s\"", arg); | ||
652 | nextarg++; | ||
653 | continue; | ||
654 | } | ||
655 | |||
656 | next_short_opt = 1; | ||
657 | short_opt = *(arg + next_short_opt); | ||
658 | |||
659 | if (short_opt == '-') | ||
660 | { | ||
661 | long_opt = arg + 2; | ||
662 | |||
663 | if (!strcmp(long_opt, "help")) | ||
664 | { | ||
665 | ecore_config_args_display(); | ||
666 | return ECORE_CONFIG_PARSE_HELP; | ||
667 | } | ||
668 | |||
669 | found = 0; | ||
670 | prop = __ecore_config_bundle_local->data; | ||
671 | while (prop) | ||
672 | { | ||
673 | if ((prop->long_opt && !strcmp(long_opt, prop->long_opt)) | ||
674 | || !strcmp(long_opt, prop->key)) | ||
675 | { | ||
676 | found = 1; | ||
677 | if ((ret = | ||
678 | ecore_config_parse_set(prop, argv[++nextarg], | ||
679 | long_opt, | ||
680 | '\0')) != | ||
681 | ECORE_CONFIG_PARSE_CONTINUE) | ||
682 | return ret; | ||
683 | break; | ||
684 | } | ||
685 | prop = prop->next; | ||
686 | } | ||
687 | if (!found) | ||
688 | { | ||
689 | callback = _ecore_config_arg_callbacks; | ||
690 | while (callback) | ||
691 | { | ||
692 | if ((callback->long_opt && | ||
693 | !strcmp(long_opt, callback->long_opt))) | ||
694 | { | ||
695 | found = 1; | ||
696 | if (callback->type == ECORE_CONFIG_NIL) | ||
697 | { | ||
698 | callback->func(NULL, callback->data); | ||
699 | } | ||
700 | else | ||
701 | { | ||
702 | if (!argv[++nextarg]) | ||
703 | { | ||
704 | ERR("Missing expected argument for option --%s", long_opt); | ||
705 | return ECORE_CONFIG_PARSE_EXIT; | ||
706 | } | ||
707 | callback->func(argv[nextarg], callback->data); | ||
708 | } | ||
709 | break; | ||
710 | } | ||
711 | callback = callback->next; | ||
712 | } | ||
713 | } | ||
714 | if (!found) | ||
715 | { | ||
716 | ERR("Unrecognised option \"%s\"", long_opt); | ||
717 | ERR("Try using -h or --help for more information.\n"); | ||
718 | return ECORE_CONFIG_PARSE_EXIT; | ||
719 | } | ||
720 | } | ||
721 | else | ||
722 | { | ||
723 | while (short_opt) | ||
724 | { | ||
725 | if (short_opt == 'h') | ||
726 | { | ||
727 | ecore_config_args_display(); | ||
728 | return ECORE_CONFIG_PARSE_HELP; | ||
729 | } | ||
730 | else | ||
731 | { | ||
732 | found = 0; | ||
733 | prop = __ecore_config_bundle_local->data; | ||
734 | while (prop) | ||
735 | { | ||
736 | if (short_opt == prop->short_opt) | ||
737 | { | ||
738 | found = 1; | ||
739 | if ((ret = | ||
740 | ecore_config_parse_set(prop, | ||
741 | argv[++nextarg], | ||
742 | NULL, | ||
743 | short_opt)) != | ||
744 | ECORE_CONFIG_PARSE_CONTINUE) | ||
745 | return ret; | ||
746 | break; | ||
747 | } | ||
748 | prop = prop->next; | ||
749 | } | ||
750 | |||
751 | if (!found) | ||
752 | { | ||
753 | callback = _ecore_config_arg_callbacks; | ||
754 | while (callback) | ||
755 | { | ||
756 | if (short_opt == callback->short_opt) | ||
757 | { | ||
758 | found = 1; | ||
759 | if (callback->type == ECORE_CONFIG_NIL) | ||
760 | { | ||
761 | callback->func(NULL, callback->data); | ||
762 | } | ||
763 | else | ||
764 | { | ||
765 | if (!argv[++nextarg]) | ||
766 | { | ||
767 | ERR("Missing expected argument for option -%c", short_opt); | ||
768 | return ECORE_CONFIG_PARSE_EXIT; | ||
769 | } | ||
770 | callback->func(argv[nextarg], callback->data); | ||
771 | } | ||
772 | break; | ||
773 | } | ||
774 | callback = callback->next; | ||
775 | } | ||
776 | } | ||
777 | if (!found) | ||
778 | { | ||
779 | ERR("Unrecognised option '%c'", short_opt); | ||
780 | ERR("Try using -h or --help for more information.\n"); | ||
781 | return ECORE_CONFIG_PARSE_EXIT; | ||
782 | } | ||
783 | } | ||
784 | short_opt = *(arg + ++next_short_opt); | ||
785 | } | ||
786 | } | ||
787 | nextarg++; | ||
788 | } | ||
789 | |||
790 | return ECORE_CONFIG_PARSE_CONTINUE; | ||
791 | } | ||
792 | |||
793 | /** | ||
794 | * Sets the description string used by @ref ecore_config_args_display . | ||
795 | * @param description Description of application. | ||
796 | */ | ||
797 | void | ||
798 | ecore_config_app_describe(char *description) | ||
799 | { | ||
800 | if (__ecore_config_app_description) | ||
801 | free(__ecore_config_app_description); | ||
802 | __ecore_config_app_description = strdup(description); | ||
803 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h deleted file mode 100644 index 7b3dea1..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | #include <Ecore_Ipc.h> | ||
2 | #include "Ecore_Config.h" | ||
3 | |||
4 | typedef enum | ||
5 | { | ||
6 | IPC_NONE, | ||
7 | IPC_PROP_LIST, | ||
8 | IPC_PROP_DESC, | ||
9 | IPC_PROP_GET, | ||
10 | IPC_PROP_SET, /* end of the codes shared by evidence and econf */ | ||
11 | |||
12 | IPC_GLOBAL_PROP_LIST, | ||
13 | |||
14 | IPC_BUNDLE_LIST, | ||
15 | IPC_BUNDLE_NEW, | ||
16 | IPC_BUNDLE_LABEL_GET, | ||
17 | IPC_BUNDLE_LABEL_SET, | ||
18 | IPC_BUNDLE_LABEL_FIND, | ||
19 | |||
20 | IPC_LAST | ||
21 | } Ecore_Config_Ipc_Call; | ||
22 | |||
23 | Ecore_Config_Server *_ecore_config_ipc_init(const char *pipe_name); | ||
24 | int _ecore_config_ipc_exit(void); | ||
25 | |||
26 | Ecore_Config_Server *_ecore_config_server_convert(void *srv); | ||
27 | |||
28 | char *_ecore_config_ipc_prop_list(Ecore_Config_Server * srv, | ||
29 | const long serial); | ||
30 | char *_ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, | ||
31 | const long serial, | ||
32 | const char *key); | ||
33 | char *_ecore_config_ipc_prop_get(Ecore_Config_Server * srv, | ||
34 | const long serial, | ||
35 | const char *key); | ||
36 | int _ecore_config_ipc_prop_set(Ecore_Config_Server * srv, | ||
37 | const long serial, | ||
38 | const char *key, | ||
39 | const char *val); | ||
40 | |||
41 | char *_ecore_config_ipc_bundle_list(Ecore_Config_Server * srv); | ||
42 | int _ecore_config_ipc_bundle_new(Ecore_Config_Server * srv, | ||
43 | const char *); | ||
44 | char *_ecore_config_ipc_bundle_label_get(Ecore_Config_Server * | ||
45 | srv, const long); | ||
46 | int _ecore_config_ipc_bundle_label_set(Ecore_Config_Server * | ||
47 | srv, const long, | ||
48 | const char *); | ||
49 | long _ecore_config_ipc_bundle_label_find(Ecore_Config_Server * | ||
50 | srv, const char *); | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c deleted file mode 100644 index b1622f3..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c +++ /dev/null | |||
@@ -1,384 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | /* by Azundris, with thanks to Corey Donohoe <atmos@atmos.org> */ | ||
6 | #include <stdio.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | #include <errno.h> | ||
10 | #include <limits.h> | ||
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <unistd.h> | ||
14 | #include <ctype.h> | ||
15 | |||
16 | #include <Ecore.h> | ||
17 | #include "ecore_private.h" | ||
18 | #include <Ecore_Ipc.h> | ||
19 | |||
20 | #include "ecore_config_ipc.h" | ||
21 | #include "ecore_config_util.h" | ||
22 | #include "ecore_config_private.h" | ||
23 | |||
24 | #include "Ecore_Config.h" | ||
25 | |||
26 | |||
27 | /*****************************************************************************/ | ||
28 | |||
29 | static int | ||
30 | _ecore_config_ipc_ecore_string_get(char **m, char **r) | ||
31 | { | ||
32 | char *q; | ||
33 | int l = 0; | ||
34 | |||
35 | if (!m || !*m) | ||
36 | return ECORE_CONFIG_ERR_NODATA; | ||
37 | if (!r) | ||
38 | return ECORE_CONFIG_ERR_FAIL; | ||
39 | q = *m; | ||
40 | if (*q != 's') | ||
41 | return ECORE_CONFIG_ERR_TYPEMISMATCH; | ||
42 | q++; | ||
43 | l = (*(q++)) << 8; | ||
44 | l += *(q++); | ||
45 | *r = q; | ||
46 | q += l; | ||
47 | *m = q; | ||
48 | WRN("IPC/eCore: got string-%d \"%s\"", l, *r); | ||
49 | return ECORE_CONFIG_ERR_SUCC; | ||
50 | } | ||
51 | |||
52 | static char * | ||
53 | _ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv __UNUSED__, long serial __UNUSED__) | ||
54 | { | ||
55 | Ecore_Config_DB_File *db; | ||
56 | char **keys; | ||
57 | int key_count, x; | ||
58 | estring *s; | ||
59 | int f; | ||
60 | char buf[PATH_MAX], *p; | ||
61 | // char *data; UNUSED | ||
62 | Ecore_Config_Type type; | ||
63 | |||
64 | db = NULL; | ||
65 | s = estring_new(8192); | ||
66 | f = 0; | ||
67 | if ((p = getenv("HOME"))) | ||
68 | { | ||
69 | snprintf(buf, sizeof(buf), "%s/.e/config.eet", p); | ||
70 | if (!(db = _ecore_config_db_open_read(buf))) | ||
71 | { | ||
72 | strcpy(buf, PACKAGE_DATA_DIR"/system.eet"); | ||
73 | if (!(db = _ecore_config_db_open_read(buf))) | ||
74 | return NULL; | ||
75 | } | ||
76 | } | ||
77 | if (!db) return NULL; | ||
78 | key_count = 0; | ||
79 | keys = _ecore_config_db_keys_get(db, &key_count); | ||
80 | if (keys) | ||
81 | { | ||
82 | for (x = 0; x < key_count; x++) | ||
83 | { | ||
84 | type = _ecore_config_db_key_type_get(db, keys[x]); | ||
85 | switch (type) | ||
86 | { | ||
87 | case ECORE_CONFIG_INT: | ||
88 | estring_appendf(s, "%s%s: integer", f ? "\n" : "", keys[x]); | ||
89 | break; | ||
90 | case ECORE_CONFIG_BLN: | ||
91 | estring_appendf(s, "%s%s: boolean", f ? "\n" : "", keys[x]); | ||
92 | break; | ||
93 | case ECORE_CONFIG_FLT: | ||
94 | estring_appendf(s, "%s%s: float", f ? "\n" : "", keys[x]); | ||
95 | break; | ||
96 | case ECORE_CONFIG_STR: | ||
97 | estring_appendf(s, "%s%s: string", f ? "\n" : "", keys[x]); | ||
98 | break; | ||
99 | case ECORE_CONFIG_RGB: | ||
100 | estring_appendf(s, "%s%s: colour", f ? "\n" : "", keys[x]); | ||
101 | break; | ||
102 | case ECORE_CONFIG_THM: | ||
103 | estring_appendf(s, "%s%s: theme", f ? "\n" : "", keys[x]); | ||
104 | break; | ||
105 | case ECORE_CONFIG_SCT: | ||
106 | estring_appendf(s, "%s%s: structure", f ? "\n" : "", keys[x]); | ||
107 | break; | ||
108 | default: | ||
109 | estring_appendf(s, "%s%s: unknown", f ? "\n" : "", keys[x]); | ||
110 | continue; | ||
111 | } | ||
112 | f = 1; | ||
113 | } | ||
114 | } | ||
115 | _ecore_config_db_close(db); | ||
116 | if (keys) | ||
117 | { | ||
118 | for (x = 0; x < key_count; x++) | ||
119 | { | ||
120 | free(keys[x]); | ||
121 | } | ||
122 | free(keys); | ||
123 | } | ||
124 | |||
125 | return estring_disown(s); | ||
126 | } | ||
127 | |||
128 | /*****************************************************************************/ | ||
129 | |||
130 | static int | ||
131 | _ecore_config_ipc_ecore_send(Ecore_Ipc_Event_Client_Data * e, int code, | ||
132 | char *reply) | ||
133 | { | ||
134 | static int our_ref = 0; | ||
135 | int len = reply ? strlen(reply) + 1 : 0; | ||
136 | |||
137 | our_ref++; | ||
138 | WRN("IPC/eCore: replying [0,0] %d IRT %d => %d {\"%s\":%d}", our_ref, | ||
139 | e->ref, code, reply ? reply : "", len); | ||
140 | return ecore_ipc_client_send(e->client, 0, 0, our_ref, e->ref, code, reply, | ||
141 | len); | ||
142 | } | ||
143 | |||
144 | /*****************************************************************************/ | ||
145 | |||
146 | static int | ||
147 | _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server, | ||
148 | Ecore_Ipc_Event_Client_Data * e) | ||
149 | { | ||
150 | Ecore_Config_Server *srv; | ||
151 | long serial; | ||
152 | int ret; | ||
153 | char *r, *k, *v, *m; | ||
154 | |||
155 | srv = _ecore_config_server_convert(server); | ||
156 | serial = e->minor; | ||
157 | r = NULL; | ||
158 | m = (char *)e->data; | ||
159 | INF("IPC/eCore: client sent: [%d,%d] #%d (%d) @ %p", e->major, e->minor, | ||
160 | e->ref, e->size, server); | ||
161 | |||
162 | switch (e->major) | ||
163 | { | ||
164 | case IPC_PROP_LIST: | ||
165 | if (srv == __ecore_config_server_global) | ||
166 | r = _ecore_config_ipc_global_prop_list(srv, serial); | ||
167 | else | ||
168 | r = _ecore_config_ipc_prop_list(srv, serial); | ||
169 | break; | ||
170 | case IPC_PROP_DESC: | ||
171 | if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) | ||
172 | r = _ecore_config_ipc_prop_desc(srv, serial, k); | ||
173 | break; | ||
174 | case IPC_PROP_GET: | ||
175 | if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) | ||
176 | r = _ecore_config_ipc_prop_get(srv, serial, k); | ||
177 | break; | ||
178 | case IPC_PROP_SET: | ||
179 | if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) | ||
180 | { | ||
181 | if (_ecore_config_ipc_ecore_string_get(&m, &v) == | ||
182 | ECORE_CONFIG_ERR_SUCC) | ||
183 | return _ecore_config_ipc_ecore_send(e, | ||
184 | _ecore_config_ipc_prop_set | ||
185 | (srv, serial, k, v), NULL); | ||
186 | } | ||
187 | break; | ||
188 | |||
189 | case IPC_BUNDLE_LIST: | ||
190 | r = _ecore_config_ipc_bundle_list(srv); | ||
191 | break; | ||
192 | case IPC_BUNDLE_NEW: | ||
193 | if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) | ||
194 | return _ecore_config_ipc_ecore_send(e, | ||
195 | k ? | ||
196 | _ecore_config_ipc_bundle_new(srv, | ||
197 | k) : | ||
198 | ECORE_CONFIG_ERR_FAIL, NULL); | ||
199 | break; | ||
200 | case IPC_BUNDLE_LABEL_SET: | ||
201 | if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) | ||
202 | return _ecore_config_ipc_ecore_send(e, | ||
203 | k ? | ||
204 | _ecore_config_ipc_bundle_label_set | ||
205 | (srv, serial, | ||
206 | k) : ECORE_CONFIG_ERR_FAIL, | ||
207 | NULL); | ||
208 | break; | ||
209 | case IPC_BUNDLE_LABEL_FIND: | ||
210 | if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) | ||
211 | return _ecore_config_ipc_ecore_send(e, | ||
212 | _ecore_config_ipc_bundle_label_find | ||
213 | (srv, k), NULL); | ||
214 | break; | ||
215 | case IPC_BUNDLE_LABEL_GET: | ||
216 | r = _ecore_config_ipc_bundle_label_get(srv, serial); | ||
217 | break; | ||
218 | } | ||
219 | |||
220 | ret = | ||
221 | _ecore_config_ipc_ecore_send(e, | ||
222 | r ? ECORE_CONFIG_ERR_SUCC : | ||
223 | ECORE_CONFIG_ERR_FAIL, r); | ||
224 | if (r) | ||
225 | { | ||
226 | free(r); | ||
227 | return ret; | ||
228 | } | ||
229 | return ECORE_CONFIG_ERR_NOTFOUND; | ||
230 | } | ||
231 | |||
232 | /*****************************************************************************/ | ||
233 | |||
234 | static Eina_Bool | ||
235 | _ecore_config_ipc_client_add(void *data, int type __UNUSED__, void *event) | ||
236 | { | ||
237 | Ecore_Ipc_Server **server; | ||
238 | Ecore_Ipc_Event_Client_Data *e; | ||
239 | |||
240 | server = (Ecore_Ipc_Server **) data; | ||
241 | e = (Ecore_Ipc_Event_Client_Data *) event; | ||
242 | |||
243 | if (*server != ecore_ipc_client_server_get(e->client)) | ||
244 | return EINA_TRUE; | ||
245 | |||
246 | INF("IPC/eCore: Client connected. @ %p", server); | ||
247 | return EINA_TRUE; | ||
248 | } | ||
249 | |||
250 | static Eina_Bool | ||
251 | _ecore_config_ipc_client_del(void *data, int type __UNUSED__, void *event) | ||
252 | { | ||
253 | Ecore_Ipc_Server **server; | ||
254 | Ecore_Ipc_Event_Client_Data *e; | ||
255 | |||
256 | server = (Ecore_Ipc_Server **) data; | ||
257 | e = (Ecore_Ipc_Event_Client_Data *) event; | ||
258 | |||
259 | if (*server != ecore_ipc_client_server_get(e->client)) | ||
260 | return EINA_TRUE; | ||
261 | |||
262 | INF("IPC/eCore: Client disconnected. @ %p", server); | ||
263 | return EINA_TRUE; | ||
264 | } | ||
265 | |||
266 | static Eina_Bool | ||
267 | _ecore_config_ipc_client_sent(void *data, int type __UNUSED__, void *event) | ||
268 | { | ||
269 | Ecore_Ipc_Server **server; | ||
270 | Ecore_Ipc_Event_Client_Data *e; | ||
271 | |||
272 | server = (Ecore_Ipc_Server **) data; | ||
273 | e = (Ecore_Ipc_Event_Client_Data *) event; | ||
274 | |||
275 | if (*server != ecore_ipc_client_server_get(e->client)) | ||
276 | return EINA_TRUE; | ||
277 | |||
278 | _ecore_config_ipc_ecore_handle_request(*server, e); | ||
279 | return EINA_TRUE; | ||
280 | } | ||
281 | |||
282 | /*****************************************************************************/ | ||
283 | |||
284 | int | ||
285 | _ecore_config_ipc_ecore_init(const char *pipe_name, void **data) | ||
286 | { | ||
287 | Ecore_Ipc_Server **server; | ||
288 | struct stat st; | ||
289 | char *p; | ||
290 | int port; | ||
291 | char socket[PATH_MAX]; | ||
292 | |||
293 | server = (Ecore_Ipc_Server **) data; | ||
294 | port = 0; | ||
295 | if (!server) | ||
296 | return ECORE_CONFIG_ERR_FAIL; | ||
297 | |||
298 | /* if(*server) | ||
299 | return ECORE_CONFIG_ERR_IGNORED; */ | ||
300 | |||
301 | ecore_init(); | ||
302 | if (ecore_ipc_init() < 1) | ||
303 | return ECORE_CONFIG_ERR_FAIL; | ||
304 | |||
305 | if ((p = getenv("HOME"))) | ||
306 | { /* debug-only ### FIXME */ | ||
307 | int stale; | ||
308 | |||
309 | stale = 1; | ||
310 | while (stale) | ||
311 | { | ||
312 | snprintf(socket, PATH_MAX, "%s/.ecore/%s/%d", p, pipe_name, port); | ||
313 | |||
314 | if (!stat(socket, &st)) | ||
315 | { | ||
316 | INF("IPC/eCore: pipe \"%s\" already exists!?", socket); | ||
317 | /* if(unlink(buf)) | ||
318 | E(0,"IPC/eCore: could not remove pipe \"%s\": %d\n",buf,errno); }}*/ | ||
319 | port++; | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | stale = 0; | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | *server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, pipe_name, port, NULL); | ||
328 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, | ||
329 | _ecore_config_ipc_client_add, server); | ||
330 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, | ||
331 | _ecore_config_ipc_client_del, server); | ||
332 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, | ||
333 | _ecore_config_ipc_client_sent, server); | ||
334 | |||
335 | if (*server) | ||
336 | { | ||
337 | INF("IPC/eCore: Server is listening on %s.", pipe_name); | ||
338 | } | ||
339 | |||
340 | return ECORE_CONFIG_ERR_SUCC; | ||
341 | } | ||
342 | |||
343 | int | ||
344 | _ecore_config_ipc_ecore_exit(void **data) | ||
345 | { | ||
346 | int ret; | ||
347 | Ecore_Ipc_Server **server; | ||
348 | |||
349 | ret = ECORE_CONFIG_ERR_SUCC; | ||
350 | server = (Ecore_Ipc_Server **) data; | ||
351 | |||
352 | if (!server) | ||
353 | return ECORE_CONFIG_ERR_FAIL; | ||
354 | |||
355 | if (*server) | ||
356 | { | ||
357 | ecore_ipc_server_del(*server); | ||
358 | *server = NULL; | ||
359 | } | ||
360 | |||
361 | ecore_ipc_shutdown(); | ||
362 | ecore_shutdown(); | ||
363 | |||
364 | return ret; | ||
365 | } | ||
366 | |||
367 | /*****************************************************************************/ | ||
368 | |||
369 | int | ||
370 | _ecore_config_ipc_ecore_poll(void **data) | ||
371 | { | ||
372 | Ecore_Ipc_Server **server; | ||
373 | |||
374 | server = (Ecore_Ipc_Server **) data; | ||
375 | |||
376 | if (!server) | ||
377 | return ECORE_CONFIG_ERR_FAIL; | ||
378 | |||
379 | ecore_main_loop_iterate(); | ||
380 | |||
381 | return ECORE_CONFIG_ERR_SUCC; | ||
382 | } | ||
383 | |||
384 | /*****************************************************************************/ | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c deleted file mode 100644 index 35bd783..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c +++ /dev/null | |||
@@ -1,275 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | /* ############## bad */ | ||
6 | #define HAVE_EVAS2 | ||
7 | |||
8 | #include <signal.h> | ||
9 | #include <dlfcn.h> | ||
10 | #include <stdio.h> | ||
11 | #include <glob.h> | ||
12 | #include <sys/param.h> | ||
13 | #include <limits.h> | ||
14 | #include <string.h> | ||
15 | #include <stdlib.h> /* malloc(), free() */ | ||
16 | |||
17 | #include "Ecore.h" | ||
18 | #include "Ecore_Config.h" | ||
19 | #include "ecore_config_util.h" | ||
20 | #include "ecore_config_ipc.h" | ||
21 | |||
22 | #include "ecore_config_private.h" | ||
23 | |||
24 | static Ecore_Config_Server *__ecore_config_servers; | ||
25 | Ecore_Timer *ipc_timer = NULL; | ||
26 | |||
27 | Ecore_Config_Server * | ||
28 | _ecore_config_server_convert(void *srv) | ||
29 | { | ||
30 | Ecore_Config_Server *srv_tmp; | ||
31 | |||
32 | srv_tmp = __ecore_config_servers; | ||
33 | while (srv_tmp) | ||
34 | { | ||
35 | if (srv_tmp->server == srv) | ||
36 | return srv_tmp; | ||
37 | srv_tmp = srv_tmp->next; | ||
38 | } | ||
39 | |||
40 | return __ecore_config_server_global; | ||
41 | } | ||
42 | |||
43 | /*****************************************************************************/ | ||
44 | /* INTERFACE FOR IPC MODULES */ | ||
45 | /*****************************/ | ||
46 | |||
47 | char * | ||
48 | _ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial) | ||
49 | { | ||
50 | Ecore_Config_Bundle *theme; | ||
51 | Ecore_Config_Prop *e; | ||
52 | estring *s; | ||
53 | int f; | ||
54 | |||
55 | theme = ecore_config_bundle_by_serial_get(srv, serial); | ||
56 | e = theme ? theme->data : NULL; | ||
57 | s = estring_new(8192); | ||
58 | f = 0; | ||
59 | while (e) | ||
60 | { | ||
61 | /* ignore system properties in listings, unless they have been overridden */ | ||
62 | if (e->flags & ECORE_CONFIG_FLAG_SYSTEM && !(e->flags & ECORE_CONFIG_FLAG_MODIFIED)) | ||
63 | { | ||
64 | e = e->next; | ||
65 | continue; | ||
66 | } | ||
67 | estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key, | ||
68 | ecore_config_type_get(e)); | ||
69 | if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) | ||
70 | { | ||
71 | if (e->type == ECORE_CONFIG_FLT) | ||
72 | estring_appendf(s, ", range %le..%le", | ||
73 | (float)e->lo / ECORE_CONFIG_FLOAT_PRECISION, | ||
74 | (float)e->hi / ECORE_CONFIG_FLOAT_PRECISION); | ||
75 | else | ||
76 | estring_appendf(s, ", range %d..%d", e->lo, e->hi); | ||
77 | } | ||
78 | if (e->type == ECORE_CONFIG_THM) | ||
79 | estring_appendf(s, ", group %s", e->data ? e->data : "Main"); | ||
80 | f = 1; | ||
81 | e = e->next; | ||
82 | } | ||
83 | |||
84 | return estring_disown(s); | ||
85 | } | ||
86 | |||
87 | char * | ||
88 | _ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, const long serial, | ||
89 | const char *key) | ||
90 | { | ||
91 | #ifdef HAVE_EVAS2 | ||
92 | Ecore_Config_Prop *e; | ||
93 | |||
94 | e = ecore_config_get(key); | ||
95 | if (e) | ||
96 | { | ||
97 | estring *s = estring_new(512); | ||
98 | |||
99 | estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e)); | ||
100 | if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) | ||
101 | estring_appendf(s, ", range %d..%d", e->lo, e->hi); | ||
102 | return estring_disown(s); | ||
103 | } | ||
104 | #endif | ||
105 | return strdup("<undefined>"); | ||
106 | } | ||
107 | |||
108 | char * | ||
109 | _ecore_config_ipc_prop_get(Ecore_Config_Server * srv, const long serial, | ||
110 | const char *key) | ||
111 | { | ||
112 | #ifdef HAVE_EVAS2 | ||
113 | char *ret; | ||
114 | |||
115 | if ((ret = ecore_config_as_string_get(key))) | ||
116 | return ret; | ||
117 | #endif | ||
118 | return strdup("<undefined>"); | ||
119 | } | ||
120 | |||
121 | int | ||
122 | _ecore_config_ipc_prop_set(Ecore_Config_Server * srv, const long serial, | ||
123 | const char *key, const char *val) | ||
124 | { | ||
125 | #ifdef HAVE_EVAS2 | ||
126 | int ret; | ||
127 | Ecore_Config_Bundle *theme; | ||
128 | |||
129 | theme = ecore_config_bundle_by_serial_get(srv, serial); | ||
130 | ret = ecore_config_set(key, (char *)val); | ||
131 | ERR("ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "", | ||
132 | key, val, ret); | ||
133 | return ret; | ||
134 | #else | ||
135 | return ECORE_CONFIG_ERR_NOTSUPP; | ||
136 | #endif | ||
137 | } | ||
138 | |||
139 | /*****************************************************************************/ | ||
140 | |||
141 | char * | ||
142 | _ecore_config_ipc_bundle_list(Ecore_Config_Server * srv) | ||
143 | { | ||
144 | Ecore_Config_Bundle *ns; | ||
145 | estring *s; | ||
146 | int f; | ||
147 | |||
148 | ns = ecore_config_bundle_1st_get(srv); | ||
149 | s = estring_new(8192); | ||
150 | f = 0; | ||
151 | if (!ns) | ||
152 | return strdup("<no_bundles_created>"); | ||
153 | |||
154 | while (ns) | ||
155 | { | ||
156 | estring_appendf(s, "%s%d: %s", f ? "\n" : "", | ||
157 | ecore_config_bundle_serial_get(ns), | ||
158 | ecore_config_bundle_label_get(ns)); | ||
159 | f = 1; | ||
160 | ns = ecore_config_bundle_next_get(ns); | ||
161 | } | ||
162 | |||
163 | return estring_disown(s); | ||
164 | } | ||
165 | |||
166 | int | ||
167 | _ecore_config_ipc_bundle_new(Ecore_Config_Server * srv, const char *label) | ||
168 | { | ||
169 | if (ecore_config_bundle_new(srv, label)) | ||
170 | return ECORE_CONFIG_ERR_SUCC; | ||
171 | return ECORE_CONFIG_ERR_FAIL; | ||
172 | } | ||
173 | |||
174 | char * | ||
175 | _ecore_config_ipc_bundle_label_get(Ecore_Config_Server * srv, const long serial) | ||
176 | { | ||
177 | Ecore_Config_Bundle *ns; | ||
178 | char *label; | ||
179 | |||
180 | ns = ecore_config_bundle_by_serial_get(srv, serial); | ||
181 | label = ecore_config_bundle_label_get(ns); | ||
182 | return strdup(label ? label : "<no such bundle>"); | ||
183 | } | ||
184 | |||
185 | int | ||
186 | _ecore_config_ipc_bundle_label_set(Ecore_Config_Server * srv, const long serial, | ||
187 | const char *label) | ||
188 | { | ||
189 | Ecore_Config_Bundle *ns; | ||
190 | |||
191 | ns = ecore_config_bundle_by_serial_get(srv, serial); | ||
192 | if (!(ns->identifier = malloc(sizeof(label)))) | ||
193 | return ECORE_CONFIG_ERR_OOM; | ||
194 | memcpy(ns->identifier, label, sizeof(label)); | ||
195 | return ECORE_CONFIG_ERR_SUCC; | ||
196 | } | ||
197 | |||
198 | long | ||
199 | _ecore_config_ipc_bundle_label_find(Ecore_Config_Server * srv, | ||
200 | const char *label) | ||
201 | { | ||
202 | Ecore_Config_Bundle *ns; | ||
203 | |||
204 | ns = ecore_config_bundle_by_label_get(srv, label); | ||
205 | return ns ? ecore_config_bundle_serial_get(ns) : -1; | ||
206 | } | ||
207 | |||
208 | static Eina_Bool | ||
209 | _ecore_config_ipc_poll(void *data __UNUSED__) | ||
210 | { | ||
211 | Ecore_Config_Server *s; | ||
212 | |||
213 | s = __ecore_config_servers; | ||
214 | while (s) | ||
215 | { | ||
216 | _ecore_config_ipc_ecore_poll(&s->server); | ||
217 | s = s->next; | ||
218 | } | ||
219 | |||
220 | return EINA_TRUE; | ||
221 | } | ||
222 | |||
223 | int | ||
224 | _ecore_config_ipc_exit(void) | ||
225 | { | ||
226 | Ecore_Config_Server *l; | ||
227 | |||
228 | if (ipc_timer) | ||
229 | ecore_timer_del(ipc_timer); | ||
230 | |||
231 | l = __ecore_config_servers; | ||
232 | while (l) | ||
233 | { | ||
234 | _ecore_config_ipc_ecore_exit(&l->server); | ||
235 | if (l->name) | ||
236 | free(l->name); | ||
237 | l = l->next; | ||
238 | } | ||
239 | |||
240 | return ECORE_CONFIG_ERR_SUCC; | ||
241 | } | ||
242 | |||
243 | Ecore_Config_Server * | ||
244 | _ecore_config_ipc_init(const char *pipe_name) | ||
245 | { | ||
246 | int ret; | ||
247 | Ecore_Config_Server *list; | ||
248 | Ecore_Config_Server *ret_srv; | ||
249 | |||
250 | list = NULL; | ||
251 | ret_srv = NULL; | ||
252 | list = NULL; | ||
253 | |||
254 | list = calloc(1, sizeof(Ecore_Config_Server)); | ||
255 | if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC) | ||
256 | { | ||
257 | ERR("_ecore_config_ipc_init: failed to register %s, code %d", | ||
258 | pipe_name, ret); | ||
259 | } | ||
260 | |||
261 | ERR("_ecore_config_ipc_init: registered \"%s\"...", pipe_name); | ||
262 | |||
263 | list->name = strdup(pipe_name); | ||
264 | list->next = __ecore_config_servers; | ||
265 | |||
266 | __ecore_config_servers = list; | ||
267 | if (!ret_srv) | ||
268 | ret_srv = list; | ||
269 | |||
270 | if (!ipc_timer) | ||
271 | ipc_timer = ecore_timer_add(100, _ecore_config_ipc_poll, NULL); | ||
272 | |||
273 | return ret_srv; | ||
274 | } | ||
275 | /*****************************************************************************/ | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_private.h b/libraries/ecore/src/lib/ecore_config/ecore_config_private.h deleted file mode 100644 index b97f695..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_private.h +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #ifndef _ECORE_CONFIG_PRIVATE_H | ||
2 | # define _ECORE_CONFIG_PRIVATE_H | ||
3 | #ifdef ECORE_CONFIG_DEFAULT_LOG_COLOR | ||
4 | # undef ECORE_CONFIG_DEFAULT_LOG_COLOR | ||
5 | #endif | ||
6 | #define ECORE_CONFIG_DEFAULT_LOG_COLOR EINA_COLOR_BLUE | ||
7 | /* eina_log related things */ | ||
8 | |||
9 | extern int _ecore_config_log_dom; | ||
10 | #ifdef ERR | ||
11 | # undef ERR | ||
12 | #endif | ||
13 | #define ERR(...) EINA_LOG_DOM_ERR(_ecore_config_log_dom, __VA_ARGS__) | ||
14 | |||
15 | #ifdef DBG | ||
16 | # undef DBG | ||
17 | #endif | ||
18 | #define DBG(...) EINA_LOG_DOM_DBG(_ecore_config_log_dom, __VA_ARGS__) | ||
19 | |||
20 | #ifdef INF | ||
21 | # undef INF | ||
22 | #endif | ||
23 | #define INF(...) EINA_LOG_DOM_INFO(_ecore_config_log_dom, __VA_ARGS__) | ||
24 | |||
25 | #ifdef WRN | ||
26 | # undef WRN | ||
27 | #endif | ||
28 | #define WRN(...) EINA_LOG_DOM_WARN(_ecore_config_log_dom, __VA_ARGS__) | ||
29 | |||
30 | #ifdef CRIT | ||
31 | # undef CRIT | ||
32 | #endif | ||
33 | #define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_config_log_dom, __VA_ARGS__) | ||
34 | |||
35 | /* debug */ | ||
36 | extern int DEBUG; | ||
37 | |||
38 | |||
39 | typedef struct _Ecore_Config_DB_File Ecore_Config_DB_File; | ||
40 | |||
41 | int _ecore_config_mod_init(const char *pipe_name, void **data); | ||
42 | int _ecore_config_mod_exit(void **data); | ||
43 | int _ecore_config_mod_poll(void **data); | ||
44 | |||
45 | Ecore_Config_DB_File *_ecore_config_db_open_read(const char *file); | ||
46 | Ecore_Config_DB_File *_ecore_config_db_open_write(const char *file); | ||
47 | void _ecore_config_db_close(Ecore_Config_DB_File *db); | ||
48 | char **_ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret); | ||
49 | Ecore_Config_Type _ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key); | ||
50 | int _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key); | ||
51 | void _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e); | ||
52 | |||
53 | int _ecore_config_boolean_get(Ecore_Config_Prop *e); | ||
54 | char *_ecore_config_string_get(Ecore_Config_Prop *e); | ||
55 | long _ecore_config_int_get(Ecore_Config_Prop *e); | ||
56 | int _ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, | ||
57 | int *g, int *b); | ||
58 | char *_ecore_config_argbstr_get(Ecore_Config_Prop *e); | ||
59 | long _ecore_config_argbint_get(Ecore_Config_Prop *e); | ||
60 | float _ecore_config_float_get(Ecore_Config_Prop *e); | ||
61 | char *_ecore_config_theme_get(Ecore_Config_Prop *e); | ||
62 | |||
63 | int _ecore_config_ipc_ecore_init(const char *pipe_name, void **data); | ||
64 | int _ecore_config_ipc_ecore_exit(void **data); | ||
65 | int _ecore_config_ipc_ecore_poll(void **data); | ||
66 | |||
67 | #include "Ecore.h" | ||
68 | #include "ecore_private.h" | ||
69 | |||
70 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c b/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c deleted file mode 100644 index d059645..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <stdio.h> | ||
7 | #include <string.h> | ||
8 | #include <limits.h> | ||
9 | |||
10 | #include <sys/param.h> | ||
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <unistd.h> | ||
14 | |||
15 | #include "Ecore_Config.h" | ||
16 | #include "ecore_config_private.h" | ||
17 | |||
18 | /** | ||
19 | * Loads the default configuration. | ||
20 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA | ||
21 | * is returned if the file cannot be loaded. | ||
22 | * @ingroup Ecore_Config_File_Group | ||
23 | */ | ||
24 | EAPI int | ||
25 | ecore_config_load(void) | ||
26 | { | ||
27 | char file[PATH_MAX]; | ||
28 | |||
29 | if (!__ecore_config_app_name) | ||
30 | return ECORE_CONFIG_ERR_FAIL; | ||
31 | |||
32 | snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.eet", getenv("HOME"), | ||
33 | __ecore_config_app_name); | ||
34 | return ecore_config_file_load(file); | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * Saves the current configuration to the default file. | ||
39 | * @return @c ECORE_CONFIG_ERR_SUCC is returned on success. | ||
40 | * @c ECORE_CONFIG_ERR_FAIL is returned if the data cannot be | ||
41 | * saved. | ||
42 | * @ingroup Ecore_Config_File_Group | ||
43 | */ | ||
44 | EAPI int | ||
45 | ecore_config_save(void) | ||
46 | { | ||
47 | char file[PATH_MAX]; | ||
48 | |||
49 | if (!__ecore_config_app_name) | ||
50 | return ECORE_CONFIG_ERR_FAIL; | ||
51 | |||
52 | snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.eet", getenv("HOME"), | ||
53 | __ecore_config_app_name); | ||
54 | return ecore_config_file_save(file); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * Load the given configuration file to the local configuration. | ||
59 | * @param file Name of the file to load. | ||
60 | * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA | ||
61 | * is returned if the file cannot be loaded. | ||
62 | * @ingroup Ecore_Config_File_Group | ||
63 | */ | ||
64 | EAPI int | ||
65 | ecore_config_file_load(const char *file) | ||
66 | { | ||
67 | Ecore_Config_DB_File *db; | ||
68 | char **keys; | ||
69 | int key_count; | ||
70 | int x; | ||
71 | // double ftmp; UNUSED | ||
72 | // int pt; UNUSED | ||
73 | // int itmp; UNUSED | ||
74 | // Ecore_Config_Type type; UNUSED | ||
75 | char *data; | ||
76 | |||
77 | db = NULL; | ||
78 | data = NULL; | ||
79 | |||
80 | db = _ecore_config_db_open_read(file); | ||
81 | if (!db) | ||
82 | { | ||
83 | ERR("Cannot open database from file %s!", file); | ||
84 | return ECORE_CONFIG_ERR_NODATA; | ||
85 | } | ||
86 | key_count = 0; | ||
87 | keys = _ecore_config_db_keys_get(db, &key_count); | ||
88 | if (keys) | ||
89 | { | ||
90 | for (x = 0; x < key_count; x++) | ||
91 | { | ||
92 | _ecore_config_db_read(db, keys[x]); | ||
93 | } | ||
94 | } | ||
95 | _ecore_config_db_close(db); | ||
96 | if (keys) | ||
97 | { | ||
98 | for (x = 0; x < key_count; x++) | ||
99 | { | ||
100 | free(keys[x]); | ||
101 | } | ||
102 | free(keys); | ||
103 | } | ||
104 | return ECORE_CONFIG_ERR_SUCC; | ||
105 | } | ||
106 | |||
107 | static void | ||
108 | _ecore_config_recurse_mkdir(const char *file) | ||
109 | { | ||
110 | char *file_ptr; | ||
111 | char *file_tmp; | ||
112 | struct stat status; | ||
113 | |||
114 | file_tmp = strdup(file); | ||
115 | file_ptr = file_tmp + strlen(file_tmp); | ||
116 | while (*file_ptr != '/' && file_ptr > file_tmp) | ||
117 | file_ptr--; | ||
118 | *file_ptr = '\0'; | ||
119 | |||
120 | if ((file_tmp[0] != 0) && stat(file_tmp, &status)) | ||
121 | { | ||
122 | _ecore_config_recurse_mkdir(file_tmp); | ||
123 | mkdir(file_tmp, S_IRUSR | S_IWUSR | S_IXUSR); | ||
124 | } | ||
125 | free(file_tmp); | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * Saves the local configuration to the given file. | ||
130 | * @param file Name of the file to save to. | ||
131 | * @return @c ECORE_CONFIG_ERR_SUCC is returned on success. | ||
132 | * @c ECORE_CONFIG_ERR_FAIL is returned if the data cannot be | ||
133 | * saved. | ||
134 | * @ingroup Ecore_Config_File_Group | ||
135 | */ | ||
136 | EAPI int | ||
137 | ecore_config_file_save(const char *file) | ||
138 | { | ||
139 | Ecore_Config_Prop *next; | ||
140 | Ecore_Config_DB_File *db; | ||
141 | struct stat status; | ||
142 | |||
143 | next = __ecore_config_bundle_local->data; | ||
144 | db = NULL; | ||
145 | |||
146 | /* if file does not exist check to see if the dirs exist, creating if not */ | ||
147 | if (stat(file, &status)) | ||
148 | _ecore_config_recurse_mkdir(file); | ||
149 | |||
150 | db = _ecore_config_db_open_write(file); | ||
151 | if (!db) | ||
152 | { | ||
153 | ERR("Cannot open database from file %s!", file); | ||
154 | return ECORE_CONFIG_ERR_FAIL; | ||
155 | } | ||
156 | |||
157 | while (next) | ||
158 | { | ||
159 | /* let the config_db deal with this | ||
160 | * handyande: hmm, not sure that it ever does - reinstating until | ||
161 | * further discussions satisfy me! | ||
162 | */ | ||
163 | if (!(next->flags & ECORE_CONFIG_FLAG_MODIFIED) || next->flags & ECORE_CONFIG_FLAG_CMDLN) | ||
164 | { | ||
165 | next = next->next; | ||
166 | continue; | ||
167 | } | ||
168 | |||
169 | _ecore_config_db_write(db, next); | ||
170 | |||
171 | next = next->next; | ||
172 | } | ||
173 | |||
174 | _ecore_config_db_close(db); | ||
175 | return ECORE_CONFIG_ERR_SUCC; | ||
176 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_util.c b/libraries/ecore/src/lib/ecore_config/ecore_config_util.c deleted file mode 100644 index 6156936..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_util.c +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | /* azundris */ | ||
6 | |||
7 | #include <sys/types.h> | ||
8 | #include <stdlib.h> /* malloc(), free() */ | ||
9 | #include <stdio.h> | ||
10 | #include <string.h> /* str...() */ | ||
11 | |||
12 | #include <stdarg.h> /* varargs in sprintf/appendf */ | ||
13 | |||
14 | #include "Ecore.h" | ||
15 | #include "ecore_private.h" | ||
16 | |||
17 | #include "Ecore_Config.h" | ||
18 | #include "ecore_config_util.h" | ||
19 | |||
20 | #include "ecore_config_private.h" | ||
21 | |||
22 | #define CHUNKLEN 4096 | ||
23 | |||
24 | /*****************************************************************************/ | ||
25 | /* STRINGS */ | ||
26 | /***********/ | ||
27 | |||
28 | estring * | ||
29 | estring_new(int size) | ||
30 | { | ||
31 | estring *e = malloc(sizeof(estring)); | ||
32 | |||
33 | if (e) | ||
34 | { | ||
35 | memset(e, 0, sizeof(estring)); | ||
36 | if ((size > 0) && (e->str = malloc(size))) | ||
37 | e->alloc = size; | ||
38 | } | ||
39 | return e; | ||
40 | } | ||
41 | |||
42 | char * | ||
43 | estring_disown(estring * e) | ||
44 | { | ||
45 | if (e) | ||
46 | { | ||
47 | char *r = e->str; | ||
48 | |||
49 | free(e); | ||
50 | return r; | ||
51 | } | ||
52 | return NULL; | ||
53 | } | ||
54 | |||
55 | int | ||
56 | estring_appendf(estring * e, const char *fmt, ...) | ||
57 | { | ||
58 | int need; | ||
59 | va_list ap; | ||
60 | char *p; | ||
61 | |||
62 | if (!e) | ||
63 | return ECORE_CONFIG_ERR_FAIL; | ||
64 | |||
65 | if (!e->str) | ||
66 | { | ||
67 | e->used = e->alloc = 0; | ||
68 | if (!(e->str = (char *)malloc(e->alloc = CHUNKLEN))) | ||
69 | return ECORE_CONFIG_ERR_OOM; | ||
70 | } | ||
71 | |||
72 | va_start(ap, fmt); | ||
73 | need = vsnprintf(NULL, 0, fmt, ap); | ||
74 | va_end(ap); | ||
75 | |||
76 | if (need >= (e->alloc - e->used)) | ||
77 | { | ||
78 | e->alloc = e->used + need + (CHUNKLEN - (need % CHUNKLEN)); | ||
79 | |||
80 | if (!(p = (char *)realloc(e->str, e->alloc))) | ||
81 | { | ||
82 | free(e->str); | ||
83 | e->alloc = e->used = 0; | ||
84 | return ECORE_CONFIG_ERR_OOM; | ||
85 | } | ||
86 | e->str = p; | ||
87 | } | ||
88 | |||
89 | va_start(ap, fmt); | ||
90 | need = vsnprintf(e->str + e->used, e->alloc - e->used, fmt, ap); | ||
91 | va_end(ap); | ||
92 | |||
93 | return e->used += need; | ||
94 | } | ||
95 | |||
96 | int | ||
97 | esprintf(char **result, const char *fmt, ...) | ||
98 | { | ||
99 | va_list ap; | ||
100 | size_t need; | ||
101 | char *n; | ||
102 | |||
103 | if (!result) | ||
104 | return ECORE_CONFIG_ERR_FAIL; | ||
105 | |||
106 | va_start(ap, fmt); | ||
107 | need = vsnprintf(NULL, 0, fmt, ap) + 1; | ||
108 | va_end(ap); | ||
109 | n = malloc(need + 1); | ||
110 | |||
111 | if (n) | ||
112 | { | ||
113 | va_start(ap, fmt); | ||
114 | need = vsnprintf(n, need, fmt, ap); | ||
115 | va_end(ap); | ||
116 | |||
117 | n[need] = 0; | ||
118 | |||
119 | if(*result) | ||
120 | free(result); | ||
121 | *result = n; | ||
122 | |||
123 | return need; | ||
124 | } | ||
125 | |||
126 | return ECORE_CONFIG_ERR_OOM; | ||
127 | } | ||
128 | |||
129 | /*****************************************************************************/ | ||
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_util.h b/libraries/ecore/src/lib/ecore_config/ecore_config_util.h deleted file mode 100644 index 5bee9d6..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_util.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #define TIMER_STOP 0 | ||
2 | #define TIMER_CONT 1 | ||
3 | |||
4 | typedef struct _estring | ||
5 | { | ||
6 | char *str; | ||
7 | int alloc, used; | ||
8 | } estring; | ||
9 | |||
10 | estring *estring_new(int size); | ||
11 | char *estring_disown(estring * e); | ||
12 | int estring_appendf(estring * e, const char *fmt, ...); | ||
13 | |||
14 | int esprintf(char **result, const char *fmt, ...); | ||