2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
14 #include <sys/param.h>
15 #include <sys/types.h>
21 #include "Ecore_Config.h"
22 #include "ecore_config_private.h"
23 #include "ecore_config_ipc.h"
25 #include "ecore_config_util.h"
26 int _ecore_config_log_dom = -1;
28 EAPI Ecore_Config_Server *__ecore_config_server_global = NULL;
29 EAPI Ecore_Config_Server *__ecore_config_server_local = NULL;
30 EAPI Ecore_Config_Bundle *__ecore_config_bundle_local = NULL;
31 EAPI char *__ecore_config_app_name = NULL;
32 int __ecore_config_system_init = 0;
34 static int _ecore_config_system_init_no_load(void);
35 static int _ecore_config_system_load(void);
37 static inline void *__ecore_argb_to_long(int a, int r, int g, int b, long *v);
38 static inline void *__ecore_argbstr_to_long(const char *argb, long *v);
40 static const char *_ecore_config_type[] =
41 { "undefined", "integer", "float", "string", "colour", "theme", "boolean", "structure" };
44 * @defgroup Ecore_Config_Property_Group Ecore Config Property Functions
46 * Functions that retrieve or set the attributes relating to a property.
50 * Removes the given property from the local configuration and destroys it.
51 * @param e Property to destroy.
53 * @ingroup Ecore_Config_Property_Group
55 EAPI Ecore_Config_Prop *
56 ecore_config_dst(Ecore_Config_Prop * e)
58 Ecore_Config_Bundle *t;
59 Ecore_Config_Prop *p, *c;
60 Ecore_Config_Listener_List *l;
63 t = __ecore_config_bundle_local;
79 while (c && (c != e));
80 if (c) /* remove from list if even in there */
88 e->listeners = e->listeners->next;
94 if (e->ptr && ((e->type == ECORE_CONFIG_STR) || (e->type == ECORE_CONFIG_THM)))
97 memset(e, 0, sizeof(Ecore_Config_Prop));
104 * @defgroup Ecore_Config_Get_Group Configuration Retrieve Functions
106 * Functions that retrieve configuration values, based on type.
110 * Returns the property with the given key.
111 * @param key The unique name of the wanted property.
112 * @return The property that corresponds to the given key. @c NULL if the
113 * key could not be found.
114 * @ingroup Ecore_Config_Get_Group
116 EAPI Ecore_Config_Prop *
117 ecore_config_get(const char *key)
119 Ecore_Config_Bundle *t;
120 Ecore_Config_Prop *e;
122 t = __ecore_config_bundle_local;
128 if (!strcmp(key, e->key))
136 * Returns the type of the property.
137 * @param e Property to get the type of.
138 * @returns The type of the property. If the property is invalid, then the
139 * string "not found" is returned.
140 * @ingroup Ecore_Config_Property_Group
143 ecore_config_type_get(const Ecore_Config_Prop * e)
147 return _ecore_config_type[e->type];
153 * Returns the specified property as a string.
154 * @param key The property key.
155 * @return The string value of the property. The function returns @c NULL if
156 * the property is not a string or is not set.
157 * @ingroup Ecore_Config_Get_Group
160 ecore_config_string_get(const char *key)
162 return _ecore_config_string_get( ecore_config_get(key) );
166 _ecore_config_string_get(Ecore_Config_Prop *e)
168 return (e && (e->type == ECORE_CONFIG_STR) && e->ptr) ? strdup(e->ptr) : NULL;
172 * Returns the specified property as an integer.
173 * @param key The property key.
174 * @return The value of the property. The function returns -1 if the
175 * property is not an integer or is not set.
176 * @ingroup Ecore_Config_Get_Group
179 ecore_config_boolean_get(const char *key)
181 return _ecore_config_boolean_get( ecore_config_get(key) );
185 _ecore_config_boolean_get(Ecore_Config_Prop *e)
187 return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_BLN))) ? (e->val != 0) : -1;
191 * Returns the specified property as a long integer.
192 * @param key The property key.
193 * @return The integer value of the property. The function returns 0 if the
194 * property is not an integer or is not set.
195 * @ingroup Ecore_Config_Get_Group
198 ecore_config_int_get(const char *key)
200 return _ecore_config_int_get( ecore_config_get(key) );
204 _ecore_config_int_get(Ecore_Config_Prop *e)
206 return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_RGB))) ? e->val : 0L;
210 * Returns the specified property as a float.
211 * @param key The property key.
212 * @return The float value of the property. The function returns 0.0 if the
213 * property is not a float or is not set.
214 * @ingroup Ecore_Config_Get_Group
217 ecore_config_float_get(const char *key)
219 return _ecore_config_float_get( ecore_config_get(key) );
223 _ecore_config_float_get(Ecore_Config_Prop *e)
225 return (e && (e->type == ECORE_CONFIG_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0;
229 * Finds the alpha, red, green and blue values of a color property.
230 * @param key The property key.
231 * @param a A pointer to an integer to store the alpha value into.
232 * @param r A pointer to an integer to store the red value into.
233 * @param g A pointer to an integer to store the green value into.
234 * @param b A pointer to an integer to store the blue value into.
235 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL
237 * @ingroup Ecore_Config_Get_Group
240 ecore_config_argb_get(const char *key, int *a, int *r, int *g, int *b)
242 return _ecore_config_argb_get( ecore_config_get(key), a, r, g, b);
246 _ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, int *g, int *b)
248 if (e && ((e->type == ECORE_CONFIG_RGB)))
250 if(a) *a = (e->val >> 24) & 0xff;
251 if(r) *r = (e->val >> 16) & 0xff;
252 if(g) *g = (e->val >> 8) & 0xff;
253 if(b) *b = e->val & 0xff;
254 return ECORE_CONFIG_ERR_SUCC;
256 return ECORE_CONFIG_ERR_FAIL;
260 * Returns a color property as a long
261 * @param key The property key.
262 * @return ARGB data as long
263 * @ingroup Ecore_Config_Get_Group
266 ecore_config_argbint_get(const char *key)
268 return _ecore_config_argbint_get( ecore_config_get(key) );
272 _ecore_config_argbint_get(Ecore_Config_Prop *e)
274 if (e && ((e->type == ECORE_CONFIG_RGB)))
282 * Returns a color property as a string of hexadecimal characters.
283 * @param key The property key.
284 * @return A string of hexadecimal characters in the format #aarrggbb.
285 * @ingroup Ecore_Config_Get_Group
288 ecore_config_argbstr_get(const char *key)
290 return _ecore_config_argbstr_get( ecore_config_get(key) );
294 _ecore_config_argbstr_get(Ecore_Config_Prop *e)
299 esprintf(&r, "#%08x", _ecore_config_int_get(e));
304 * Returns a theme property.
305 * @param key The property key.
306 * @return The name of the theme the property refers to. The function returns
307 * @c NULL if the property is not a theme or is not set.
308 * @ingroup Ecore_Config_Get_Group
311 ecore_config_theme_get(const char *key)
313 return _ecore_config_theme_get( ecore_config_get(key) );
317 _ecore_config_theme_get(Ecore_Config_Prop *e)
319 return (e && (e->type == ECORE_CONFIG_THM)) ? strdup(e->ptr) : NULL;
323 * Retrieves the key as a string.
324 * @param key The property key.
325 * @return Returns a character array in the form of 'key:type=value'. @c NULL
326 * is returned if the property does not exist.
327 * @ingroup Ecore_Config_Get_Group
330 ecore_config_as_string_get(const char *key)
332 Ecore_Config_Prop *e;
338 if (!(e = ecore_config_get(key)))
339 ERR("no such property, \"%s\"...", key);
344 case ECORE_CONFIG_NIL:
345 val = strdup("<nil>");
347 case ECORE_CONFIG_INT:
348 esprintf(&val, "%ld", _ecore_config_int_get(e));
350 case ECORE_CONFIG_BLN:
351 esprintf(&val, "%ld", _ecore_config_boolean_get(e));
353 case ECORE_CONFIG_FLT:
354 esprintf(&val, "%lf", _ecore_config_float_get(e));
356 case ECORE_CONFIG_STR:
357 esprintf(&val, "\"%s\"", _ecore_config_string_get(e));
359 case ECORE_CONFIG_RGB:
360 esprintf(&val, "#%08x", _ecore_config_int_get(e));
362 case ECORE_CONFIG_THM:
363 esprintf(&val, "\"%s\"", _ecore_config_theme_get(e));
365 case ECORE_CONFIG_SCT:
368 esprintf(&r, "%s:unknown_type", key);
373 esprintf(&r, "%s:%s=%s", key, _ecore_config_type[e->type], val);
381 ecore_config_bound(Ecore_Config_Prop * e)
386 ret = ECORE_CONFIG_ERR_SUCC;
389 return ECORE_CONFIG_ERR_FAIL;
390 if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
392 if ((e->val < e->lo))
394 WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
395 e->key, e->val, e->lo);
398 else if ((e->val > e->hi))
400 WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
401 e->key, e->val, e->hi);
405 ret = ECORE_CONFIG_ERR_IGNORED;
408 ret = ECORE_CONFIG_ERR_IGNORED;
412 v = ((int)(e->val / e->step)) * e->step;
415 if (e->type == ECORE_CONFIG_FLT)
416 WRN("ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...",
417 e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION,
418 ((double)e->step) / ECORE_CONFIG_FLOAT_PRECISION,
419 ((double)v) / ECORE_CONFIG_FLOAT_PRECISION);
421 WRN("ecore_config_bound(\"%s\"): integer value %ld not a multiple of %ld, adjusted to %ld...",
422 e->key, e->val, e->step, v);
423 ret = ECORE_CONFIG_ERR_SUCC;
432 * Tries to guess the type of a property.
434 * This function first checks to see if the property exists. If it does, then
435 * the type of the stored property is returned. Otherwise, the function tries
436 * to guess the type of the property based on @p val.
438 * @param key The property key.
439 * @param val The value in string form.
440 * @return The type of the property determined by the function. Note that if
441 * val is @c NULL, @c ECORE_CONFIG_NIL will be returned.
444 ecore_config_type_guess(const char *key, const char *val)
446 Ecore_Config_Prop *p;
451 if (key && (p = ecore_config_get(key)) && p->type != ECORE_CONFIG_NIL)
455 return ECORE_CONFIG_NIL;
457 return ECORE_CONFIG_RGB;
463 if (sscanf(val, "%f%*s", &f) != 1)
464 return ECORE_CONFIG_STR;
465 return ECORE_CONFIG_FLT;
467 return ECORE_CONFIG_INT;
471 ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type)
475 return ECORE_CONFIG_ERR_NODATA;
477 if (!(val) && (type != ECORE_CONFIG_NIL && type != ECORE_CONFIG_SCT))
481 if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
483 e->val = (long) *((int *)val);
486 else if (type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM)
488 if (!(e->ptr = strdup(val)))
489 return ECORE_CONFIG_ERR_OOM;
490 if (e->type == ECORE_CONFIG_NIL)
493 else if (type == ECORE_CONFIG_RGB)
495 __ecore_argbstr_to_long((char *)val, &e->val);
496 e->type = ECORE_CONFIG_RGB;
498 else if (type == ECORE_CONFIG_FLT)
500 e->val = (long) ((*((float *)val)) * ECORE_CONFIG_FLOAT_PRECISION);
501 e->type = ECORE_CONFIG_FLT;
503 else if (type == ECORE_CONFIG_SCT)
505 e->type = ECORE_CONFIG_SCT;
509 e->type = ECORE_CONFIG_NIL;
512 ecore_config_bound(e);
513 e->flags |= ECORE_CONFIG_FLAG_MODIFIED;
514 e->flags &= ~ECORE_CONFIG_FLAG_CMDLN;
515 return ECORE_CONFIG_ERR_SUCC;
517 return ECORE_CONFIG_ERR_IGNORED;
521 ecore_config_typed_add(const char *key, const void *val, int type)
523 int error = ECORE_CONFIG_ERR_SUCC;
524 Ecore_Config_Prop *e = NULL;
525 Ecore_Config_Bundle *t;
527 t = __ecore_config_bundle_local;
529 return ECORE_CONFIG_ERR_NODATA;
531 if (!(e = calloc(1, sizeof(Ecore_Config_Prop))))
533 return ECORE_CONFIG_ERR_OOM;
535 else if (!(e->key = strdup(key)))
537 error = ECORE_CONFIG_ERR_OOM;
539 else if ((error = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
546 return ECORE_CONFIG_ERR_SUCC;
554 if (error == ECORE_CONFIG_ERR_SUCC)
555 error = ECORE_CONFIG_ERR_FAIL;
561 ecore_config_add(const char *key, const char *val)
565 type = ecore_config_type_guess(key, val);
566 return ecore_config_typed_add(key, val, type);
570 * Sets the description field of the indicated property.
571 * @param key The property key.
572 * @param desc Description string.
573 * @note The description string is copied for the property's use. You can
574 * free @p desc once this function is called.
575 * @ingroup Ecore_Config_Property_Group
578 ecore_config_describe(const char *key, const char *desc)
580 Ecore_Config_Prop *e;
582 if (!(e = ecore_config_get(key)))
583 return ECORE_CONFIG_ERR_NODATA;
584 e->description = strdup(desc);
585 return ECORE_CONFIG_ERR_SUCC;
589 * Set the short option character of a property.
590 * @param key The property key.
591 * @param short_opt Character used to indicate the value of a property
592 * given on the command line.
593 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
594 * is returned if the property does not exist.
595 * @ingroup Ecore_Config_Property_Group
598 ecore_config_short_opt_set(const char *key, char short_opt)
600 Ecore_Config_Prop *e;
602 if (!(e = ecore_config_get(key)))
603 return ECORE_CONFIG_ERR_NODATA;
604 e->short_opt = short_opt;
605 return ECORE_CONFIG_ERR_SUCC;
609 * Set the long option string of the property.
610 * @param key The property key.
611 * @param long_opt String used to indicate the value of a property given
612 * on the command line.
613 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
614 * is returned if the property does not exist.
615 * @ingroup Ecore_Config_Property_Group
618 ecore_config_long_opt_set(const char *key, const char *long_opt)
620 Ecore_Config_Prop *e;
622 if (!(e = ecore_config_get(key)))
623 return ECORE_CONFIG_ERR_NODATA;
627 e->long_opt = strdup(long_opt);
628 return ECORE_CONFIG_ERR_SUCC;
632 _ecore_config_listener_fire(Ecore_Config_Prop *prop)
634 Ecore_Config_Listener_List *l;
635 for (l = prop->listeners; l; l = l->next)
636 l->listener(prop->key, prop->type, l->tag, l->data);
638 /* fire change listeners for the generic struct container etc */
640 _ecore_config_listener_fire(prop->parent);
644 * Sets the indicated property to the given value and type.
645 * @param key The property key.
646 * @param val A pointer to the value to set the property to.
647 * @param type The type of the property.
648 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
649 * @ingroup Ecore_Config_Property_Group
652 ecore_config_typed_set(const char *key, const void *val, int type)
654 Ecore_Config_Prop *e;
658 return ECORE_CONFIG_ERR_NODATA;
659 /* if (!t) { * global prop *
660 e=ecore_config_get(key);
662 for(l=e->listeners;l;l=l->next)
663 l->listener(e->key,e->type,l->tag,l->data,t);
664 return ECORE_CONFIG_ERR_SUCC;
667 if (!(e = ecore_config_get(key)))
668 return ecore_config_typed_add(key, val, type);
670 if ((ret = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
672 _ecore_config_listener_fire(e);
676 ERR("ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d",
684 * @defgroup Ecore_Config_Set_Group Ecore Config Setters
686 * Functions that set the value of a property.
690 * Sets the indicated property to the value indicated by @a val.
691 * @param key The property key.
692 * @param val String representation of value to set.
693 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
694 * @ingroup Ecore_Config_Set_Group
697 ecore_config_set(const char *key, const char *val)
704 type = ecore_config_type_guess(key, val);
705 if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
708 return ecore_config_typed_set(key, &tmpi, type);
710 else if (type == ECORE_CONFIG_FLT)
713 return ecore_config_typed_set(key, &tmpf, type);
715 else if (type == ECORE_CONFIG_RGB)
717 __ecore_argbstr_to_long(val, &tmpl);
718 return ecore_config_typed_set(key, &tmpl, type);
721 return ecore_config_typed_set(key, val, type);
725 * Sets the indicated property to the value given in the string.
726 * @param key The property key.
727 * @param val String representation of the value.
728 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
729 * @ingroup Ecore_Config_Set_Group
732 ecore_config_as_string_set(const char *key, const char *val)
734 return ecore_config_set(key, val);
738 * Sets the indicated property to the given boolean.
739 * @param key The property key.
740 * @param val Boolean integer to set the property to.
741 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
742 * @ingroup Ecore_Config_Set_Group
745 ecore_config_boolean_set(const char *key, int val)
748 return ecore_config_typed_set(key, &val, ECORE_CONFIG_BLN);
752 * Sets the indicated property to the given integer.
753 * @param key The property key.
754 * @param val Integer to set the property to.
755 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
756 * @ingroup Ecore_Config_Set_Group
759 ecore_config_int_set(const char *key, int val)
761 return ecore_config_typed_set(key, &val, ECORE_CONFIG_INT);
765 * Sets the indicated property to the given string.
766 * @param key The property key.
767 * @param val String to set the property to.
768 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
769 * @ingroup Ecore_Config_Set_Group
772 ecore_config_string_set(const char *key, const char *val)
774 return ecore_config_typed_set(key, val, ECORE_CONFIG_STR);
778 * Sets the indicated property to the given float value.
779 * @param key The property key.
780 * @param val Float to set the property to.
781 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
782 * @ingroup Ecore_Config_Set_Group
785 ecore_config_float_set(const char *key, float val)
787 return ecore_config_typed_set(key, &val, ECORE_CONFIG_FLT);
791 * Sets the indicated property to a color value.
792 * @param key The property key
793 * @param a integer 0..255
794 * @param r integer 0..255
795 * @param g integer 0..255
796 * @param b integer 0..255
797 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
798 * @ingroup Ecore_Config_Set_Group
801 ecore_config_argb_set(const char *key, int a, int r, int g, int b)
804 return ecore_config_typed_set(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB);
808 * Sets the indicated property to a color value.
809 * @param key The property key
810 * @param argb ARGB data as long
811 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
812 * @ingroup Ecore_Config_Set_Group
815 ecore_config_argbint_set(const char *key, long argb)
817 return ecore_config_typed_set(key, &argb, ECORE_CONFIG_RGB);
821 * Sets the indicated property to a color value.
822 * @param key The property key
823 * @param val Color value in ARGB format.
824 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
825 * @ingroup Ecore_Config_Set_Group
828 ecore_config_argbstr_set(const char *key, const char *val)
831 return ecore_config_typed_set(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB);
835 * Sets the indicated property to a theme name.
836 * @param key The property key.
837 * @param val String giving the name of the theme.
838 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
839 * @ingroup Ecore_Config_Set_Group
842 ecore_config_theme_set(const char *key, const char *val)
844 return ecore_config_typed_set(key, val, ECORE_CONFIG_THM);
848 * Sets the theme preview group of an indicated property.
849 * @param key The property key.
850 * @param group The group name.
851 * @return @c ECORE_CONFIG_ERR_SUCC on success.
852 * @ingroup Ecore_Config_Set_Group
855 ecore_config_theme_preview_group_set(const char *key, const char *group)
858 Ecore_Config_Prop *e;
860 ret = ECORE_CONFIG_ERR_SUCC;
861 if (!(e = ecore_config_get(key)))
862 { /* prop doesn't exist yet */
863 if ((ret = ecore_config_typed_add(key, "", ECORE_CONFIG_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
864 return ret; /* ...failed */
865 if (!(e = ecore_config_get(key))) /* get handle */
866 return ECORE_CONFIG_ERR_FAIL;
870 e->data = strdup(group);
876 ecore_config_typed_default(const char *key, const void *val, int type)
879 Ecore_Config_Prop *e;
881 ret = ECORE_CONFIG_ERR_SUCC;
883 if (!(e = ecore_config_get(key)))
884 { /* prop doesn't exist yet */
885 if ((ret = ecore_config_typed_add(key, val, type)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
886 return ret; /* ...failed */
887 if (!(e = ecore_config_get(key))) /* get handle */
888 return ECORE_CONFIG_ERR_FAIL;
889 e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED;
891 else if (!(e->flags & ECORE_CONFIG_FLAG_MODIFIED) && !(e->flags & ECORE_CONFIG_FLAG_SYSTEM))
893 ecore_config_typed_set(key, val, type);
894 if (!(e = ecore_config_get(key))) /* get handle */
895 return ECORE_CONFIG_ERR_FAIL;
896 e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED;
902 * @defgroup Ecore_Config_Default_Group Ecore Config Defaults
904 * Functions that are used to set the default values of properties.
908 * Sets the indicated property if it has not already been set or loaded.
909 * @param key The property key.
910 * @param val Default value of the key.
911 * @param lo Lowest valid value for the key.
912 * @param hi Highest valid value for the key.
913 * @param step Used by integer and float values.
914 * @return @c ECORE_CONFIG_ERR_SUCC if there are no errors.
915 * @note The @p lo, @p hi and @p step parameters are only used when storing
916 * integer and float properties.
917 * @ingroup Ecore_Config_Default_Group
920 ecore_config_default(const char *key, const char *val, float lo, float hi, float step)
923 Ecore_Config_Prop *e;
925 type = ecore_config_type_guess(key, val);
926 ret = ecore_config_typed_default(key, val, type);
927 e = ecore_config_get(key);
930 if (type == ECORE_CONFIG_INT)
933 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
936 ecore_config_bound(e);
938 else if (type == ECORE_CONFIG_FLT)
940 e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
941 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
942 e->lo = (int)(lo * ECORE_CONFIG_FLOAT_PRECISION);
943 e->hi = (int)(hi * ECORE_CONFIG_FLOAT_PRECISION);
944 ecore_config_bound(e);
952 * Sets the indicated property to the given boolean if the property has not yet
954 * @param key The property key.
955 * @param val Boolean Integer to set the value to.
956 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
957 * @ingroup Ecore_Config_Default_Group
960 ecore_config_boolean_default(const char *key, int val)
963 return ecore_config_typed_default(key, &val, ECORE_CONFIG_BLN);
967 * Sets the indicated property to the given integer if the property has not yet
969 * @param key The property key.
970 * @param val Integer to set the value to.
971 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
972 * @ingroup Ecore_Config_Default_Group
975 ecore_config_int_default(const char *key, int val)
977 return ecore_config_typed_default(key, &val, ECORE_CONFIG_INT);
981 * Sets the indicated property to the given integer if the property has not yet
984 * The bounds and step values are set regardless.
986 * @param key The property key.
987 * @param val Integer to set the property to.
988 * @param low Lowest valid integer value for the property.
989 * @param high Highest valid integer value for the property.
990 * @param step Increment value for the property.
991 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
992 * @ingroup Ecore_Config_Default_Group
995 ecore_config_int_default_bound(const char *key, int val, int low, int high,
998 Ecore_Config_Prop *e;
1001 ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_INT);
1002 e = ecore_config_get(key);
1006 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
1009 ecore_config_bound(e);
1016 * Sets the indicated property to the given string if the property has not yet
1018 * @param key The property key.
1019 * @param val String to set the property to.
1020 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
1021 * @ingroup Ecore_Config_Default_Group
1024 ecore_config_string_default(const char *key, const char *val)
1026 return ecore_config_typed_default(key, val, ECORE_CONFIG_STR);
1030 * Sets the indicated property to the given float if the property has not yet
1032 * @param key The property key.
1033 * @param val Float to set the property to.
1034 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
1035 * @ingroup Ecore_Config_Default_Group
1038 ecore_config_float_default(const char *key, float val)
1040 return ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT);
1044 * Sets the indicated property to the given float if the property has not yet
1047 * The bounds and step values are set regardless.
1049 * @param key The property key.
1050 * @param val Float to set the property to.
1051 * @param low Lowest valid integer value for the property.
1052 * @param high Highest valid float value for the property.
1053 * @param step Increment value for the property.
1054 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
1055 * @ingroup Ecore_Config_Default_Group
1058 ecore_config_float_default_bound(const char *key, float val, float low,
1059 float high, float step)
1061 Ecore_Config_Prop *e;
1064 ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT);
1065 e = ecore_config_get(key);
1068 e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
1069 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
1070 e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION);
1071 e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION);
1072 ecore_config_bound(e);
1079 * Sets the indicated property to a color value if the property has not yet
1081 * @param key The property key.
1082 * @param a integer 0..255
1083 * @param r integer 0..255
1084 * @param g integer 0..255
1085 * @param b integer 0..255
1086 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
1087 * @ingroup Ecore_Config_Default_Group
1090 ecore_config_argb_default(const char *key, int a, int r, int g, int b)
1093 return ecore_config_typed_default(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB);
1097 * Sets the indicated property to a color value if the property has not yet
1099 * @param key The property key.
1100 * @param argb ARGB data as long
1101 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
1102 * @ingroup Ecore_Config_Default_Group
1105 ecore_config_argbint_default(const char *key, long argb)
1107 return ecore_config_typed_default(key, &argb, ECORE_CONFIG_RGB);
1111 * Sets the indicated property to a color value if the property has not yet
1113 * @param key The property key.
1114 * @param val Color value in ARGB format.
1115 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
1116 * @ingroup Ecore_Config_Default_Group
1119 ecore_config_argbstr_default(const char *key, const char *val)
1122 return ecore_config_typed_default(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB);
1126 * Sets the indicated property to a theme name if the property has not yet
1128 * @param key The property key.
1129 * @param val String giving the name of the theme.
1130 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1131 * @ingroup Ecore_Config_Default_Group
1134 ecore_config_theme_default(const char *key, const char *val)
1136 return ecore_config_typed_default(key, val, ECORE_CONFIG_THM);
1140 * @defgroup Ecore_Config_Struct_Group Ecore Config Structures
1142 * Functions that are used to create structures of properties.
1146 * Sets the indicated property to a structure if the property has not yet
1148 * @param key The property key.
1149 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1150 * @ingroup Ecore_Config_Struct_Group
1153 ecore_config_struct_create(const char *key)
1155 WRN("you are using ecore_config structures. These are very young");
1156 WRN(" and not complete - you have been warned");
1158 return ecore_config_typed_default(key, NULL, ECORE_CONFIG_SCT);
1162 _ecore_config_struct_append(Ecore_Config_Prop *sct, Ecore_Config_Prop *add)
1166 if (!sct || !add || sct->type != ECORE_CONFIG_SCT)
1167 return ECORE_CONFIG_ERR_IGNORED;
1170 sct->data = eina_list_append(l, add);
1173 return ECORE_CONFIG_ERR_SUCC;
1177 _ecore_config_struct_typed_add(const char *key, const char *name, const void *val,
1183 subkey = malloc((strlen(key) + strlen(name) + 2) * sizeof(char));
1184 strcpy(subkey, key);
1185 strcat(subkey, ".");
1186 strcat(subkey, name);
1188 ecore_config_typed_default(subkey, val, type);
1189 ret = _ecore_config_struct_append(ecore_config_get(key),
1190 ecore_config_get(subkey));
1196 * Add an int property to the named structure. The property is set if it has not
1198 * @param key The key of the structure to add to.
1199 * @param name The name of the item to add - this will be appended to the key
1200 * @param val the int to default to
1201 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1202 * @ingroup Ecore_Config_Struct_Group
1205 ecore_config_struct_int_add(const char *key, const char *name, int val)
1207 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_INT);
1211 * Add a float property to the named structure. The property is set if it has
1213 * @param key The key of the structure to add to.
1214 * @param name The name of the item to add - this will be appended to the key
1215 * @param val The float to default to
1216 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1217 * @ingroup Ecore_Config_Struct_Group
1220 ecore_config_struct_float_add(const char *key, const char *name, float val)
1222 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_FLT);
1226 * Add a string property to the named structure. The property is set if it has
1228 * @param key The key of the structure to add to.
1229 * @param name The name of the item to add - this will be appended to the key
1230 * @param val The string to default to
1231 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1232 * @ingroup Ecore_Config_Struct_Group
1235 ecore_config_struct_string_add(const char *key, const char *name, const char* val)
1237 return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_STR);
1241 * Add an argb property to the named structure. The property is set if it has
1243 * @param key The key of the structure to add to.
1244 * @param name The name of the item to add - this will be appended to the key
1245 * @param a The alpha to default to
1246 * @param r The red to default to
1247 * @param g The green to default to
1248 * @param b The blue to default to
1249 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1250 * @ingroup Ecore_Config_Struct_Group
1253 ecore_config_struct_argb_add(const char *key, const char *name, int a, int r,
1258 __ecore_argb_to_long(a, r, g, b, &argb);
1259 return _ecore_config_struct_typed_add(key, name, &argb, ECORE_CONFIG_RGB);
1263 * Add a theme property to the named structure. The property is set if it has
1265 * @param key The key of the structure to add to.
1266 * @param name The name of the item to add - this will be appended to the key
1267 * @param val The theme name to default to
1268 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1269 * @ingroup Ecore_Config_Struct_Group
1272 ecore_config_struct_theme_add(const char *key, const char *name, const char* val)
1274 return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_THM);
1278 * Add a boolean property to the named structure. The property is set if it has
1280 * @param key The key of the structure to add to.
1281 * @param name The name of the item to add - this will be appended to the key
1282 * @param val The boolean to default to
1283 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1284 * @ingroup Ecore_Config_Struct_Group
1287 ecore_config_struct_boolean_add(const char *key, const char *name, int val)
1290 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_BLN);
1294 * Get the contents of a defined structure property and load it into the passed
1296 * @param key The name of the structure property to look up.
1297 * @param data The struct to write into.
1298 * @return @c ECORE_CONFIG_ERR_SUCC if the structure is written successfully.
1299 * @ingroup Ecore_Config_Struct_Group
1302 ecore_config_struct_get(const char *key, void *data)
1304 Ecore_Config_Prop *e, *f;
1309 e = ecore_config_get(key);
1311 return ECORE_CONFIG_ERR_NODATA;
1317 f = (Ecore_Config_Prop *) l->data;
1320 case ECORE_CONFIG_INT:
1321 *((int *) ptr) = _ecore_config_int_get(f);
1324 case ECORE_CONFIG_BLN:
1325 *((int *) ptr) = _ecore_config_boolean_get(f);
1328 case ECORE_CONFIG_FLT:
1329 *((float *) ptr) = _ecore_config_float_get(f);
1330 ptr += sizeof(float);
1332 case ECORE_CONFIG_STR:
1333 case ECORE_CONFIG_THM:
1334 *((char **) ptr) = _ecore_config_string_get(f);
1335 ptr += sizeof(char *);
1337 case ECORE_CONFIG_RGB:
1338 argb = _ecore_config_argbint_get(f);
1339 *((int *) ptr) = (argb >> 24) & 0xff;
1341 *((int *) ptr) = (argb >> 16) & 0xff;
1343 *((int *) ptr) = (argb >> 8) & 0xff;
1345 *((int *) ptr) = argb & 0xff;
1349 WRN("ARGH - STRUCT coding not implemented yet");
1351 l = eina_list_next(l);
1353 return ECORE_CONFIG_ERR_SUCC;
1357 * @defgroup Ecore_Config_Listeners_Group Ecore Config Listeners
1359 * Functions that set and unset property listener callbacks.
1363 * Adds a callback function to the list of functions called when a property
1365 * @param name Name of the callback.
1366 * @param key The key of the property to listen to.
1367 * @param listener Listener callback function.
1368 * @param tag Tag to pass to @p listener when it is called.
1369 * @param data Data to pass to @p listener when it is called.
1370 * @return @c ECORE_CONFIG_ERR_SUCC if successful in setting up the callback.
1371 * @ingroup Ecore_Config_Listeners_Group
1374 ecore_config_listen(const char *name, const char *key,
1375 Ecore_Config_Listener listener, int tag, void *data)
1377 Ecore_Config_Prop *e;
1378 Ecore_Config_Listener_List *l;
1381 return ECORE_CONFIG_ERR_NODATA;
1383 if (!(e = ecore_config_get(key)))
1385 int ret = ecore_config_add(key, "");
1387 if (ret != ECORE_CONFIG_ERR_SUCC)
1389 ERR("ecore_config_listen: ecore_config_add(\"%s\") failed: %d",
1393 if (!(e = ecore_config_get(key)))
1395 ERR("ecore_config_listen: list of properties corrupted!?");
1396 return ECORE_CONFIG_ERR_FAIL;
1400 for (l = e->listeners; l; l = l->next)
1401 if (!strcmp(l->name, name) || (l->listener == listener))
1403 ERR("ecore_config_listen: %s is already listening for changes of %s...",
1405 return ECORE_CONFIG_ERR_IGNORED;
1408 if (!(l = malloc(sizeof(Ecore_Config_Listener_List))))
1409 return ECORE_CONFIG_ERR_OOM;
1411 ERR("registering listener \"%s\" for \"%s\" (%d)...", name, key, e->type);
1413 memset(l, 0, sizeof(Ecore_Config_Listener_List));
1415 l->listener = listener;
1419 l->next = e->listeners;
1422 if (e->type != ECORE_CONFIG_NIL) /* call right on creation if prop exists and has val */
1423 listener(key, e->type, tag, data);
1425 return ECORE_CONFIG_ERR_SUCC;
1429 * Removes a listener callback.
1430 * @param name Name of the callback to remove.
1431 * @param key The property key the callback is listening to.
1432 * @param listener The callback function to remove.
1433 * @return @c ECORE_CONFIG_ERR_SUCC if successful in removing the callback.
1434 * If no callback matches the given parameters, then
1435 * @c ECORE_CONFIG_ERR_NOTFOUND is returned. If @c NULL is passed
1436 * for the key pointer, @c ECORE_CONFIG_ERR_NODATA is returned.
1437 * @ingroup Ecore_Config_Listeners_Group
1440 ecore_config_deaf(const char *name, const char *key,
1441 Ecore_Config_Listener listener)
1443 Ecore_Config_Prop *e;
1444 Ecore_Config_Listener_List *l, *p;
1447 ret = ECORE_CONFIG_ERR_NOTFOUND;
1450 return ECORE_CONFIG_ERR_NODATA;
1452 if (!(e = ecore_config_get(key)))
1453 return ECORE_CONFIG_ERR_NOTFOUND;
1455 for (p = NULL, l = e->listeners; l; p = l)
1457 Ecore_Config_Listener_List *nl;
1460 if ((name && !strcmp(l->name, name)) || (l->listener == listener))
1462 ret = ECORE_CONFIG_ERR_SUCC;
1464 e->listeners = e->listeners->next;
1467 memset(l, 0, sizeof(Ecore_Config_Listener));
1477 * Locates the first configuration bundle on the given server.
1478 * @param srv The configuration server.
1479 * @return Pointer to the first configuration bundle.
1481 EAPI Ecore_Config_Bundle *
1482 ecore_config_bundle_1st_get(Ecore_Config_Server * srv)
1483 { /* anchor: global, but read-only */
1484 return srv->bundles;
1488 * Locates the configuration bundle after the given one.
1489 * @param ns The configuration bundle.
1490 * @return The next configuration bundle.
1492 EAPI Ecore_Config_Bundle *
1493 ecore_config_bundle_next_get(Ecore_Config_Bundle * ns)
1495 return ns ? ns->next : NULL;
1499 * Locates a configuration bundle on a configuration server based on its serial
1501 * @param srv The configuration server.
1502 * @param serial Serial number.
1503 * @return The configuration bundle with the given serial number.
1505 EAPI Ecore_Config_Bundle *
1506 ecore_config_bundle_by_serial_get(Ecore_Config_Server * srv, long serial)
1508 Ecore_Config_Bundle *eb;
1514 else if (serial == 0)
1516 Ecore_Config_Bundle *r = eb;
1523 if (eb->serial == serial)
1531 * Gets the Ecore_Config_Bundle with the given identifier from the given
1533 * @param srv The configuration server.
1534 * @param label The bundle's identifier string.
1535 * @return The bundle with the given identifier string, or @c NULL if it
1536 * could not be found.
1538 EAPI Ecore_Config_Bundle *
1539 ecore_config_bundle_by_label_get(Ecore_Config_Server * srv, const char *label)
1541 Ecore_Config_Bundle *ns;
1547 if (ns->identifier && !strcmp(ns->identifier, label))
1555 * Retrieves the bundle's serial number.
1556 * @param ns The configuration bundle.
1557 * @return The bundle's identifier string, or -1 if ns is @c NULL.
1560 ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns)
1562 return ns ? ns->serial : -1;
1566 * Retrieves the bundle's identifier.
1567 * @param ns The configuration bundle.
1568 * @return The bundle's identifer string.
1571 ecore_config_bundle_label_get(Ecore_Config_Bundle * ns)
1573 return ns ? ns->identifier : NULL;
1577 * Creates a new Ecore_Config_Bundle.
1578 * @param srv Config server.
1579 * @param identifier Identifier string for the new bundle.
1580 * @return A pointer to a new Ecore_Config_Bundle. @c NULL is returned if the
1581 * structure couldn't be allocated.
1583 EAPI Ecore_Config_Bundle *
1584 ecore_config_bundle_new(Ecore_Config_Server * srv, const char *identifier)
1586 Ecore_Config_Bundle *t;
1589 ss = 0; /* bundle unique serial */
1591 if ((t = malloc(sizeof(Ecore_Config_Bundle))))
1593 memset(t, 0, sizeof(Ecore_Config_Bundle));
1595 t->identifier = (char *)identifier;
1597 t->owner = srv->name;
1598 t->next = srv->bundles;
1604 static Ecore_Config_Server *
1605 do_init(const char *name)
1607 return _ecore_config_ipc_init(name);
1610 static Ecore_Config_Server *
1611 ecore_config_init_local(const char *name)
1616 if ((p = getenv("HOME")))
1617 { /* debug-only ### FIXME */
1618 if (!(buf = malloc(PATH_MAX * sizeof(char))))
1620 snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name);
1626 return do_init(name);
1629 static Ecore_Config_Server *
1630 ecore_config_init_global(const char *name)
1636 if ((p = getenv("HOME")))
1637 { /* debug-only ### FIXME */
1638 if (!(buf = malloc(PATH_MAX * sizeof(char))))
1640 snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name);
1641 global = creat(buf, S_IRWXU);
1649 return do_init(name);
1653 * @defgroup Ecore_Config_App_Lib_Group Ecore Config App Library Functions
1655 * Functions that are used to start up and shutdown the Enlightened
1656 * Property Library when used directly by an application.
1660 * Initializes the Enlightened Property Library.
1662 * Either this function or @ref ecore_config_system_init must be run
1663 * before any other function in the Enlightened Property Library, even
1664 * if you have run @ref ecore_init . The name given is used to
1665 * determine the default configuration to load.
1667 * @param name Application name
1668 * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up.
1669 * @c ECORE_CONFIG_ERR_FAIL otherwise.
1670 * @ingroup Ecore_Config_App_Lib_Group
1673 ecore_config_init(const char *name)
1676 Ecore_Config_Prop *list;
1677 _ecore_config_log_dom = eina_log_domain_register("EcoreConfig", ECORE_CONFIG_DEFAULT_LOG_COLOR);
1678 if(_ecore_config_log_dom < 0)
1680 EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module.");
1683 _ecore_config_system_init_no_load();
1685 __ecore_config_app_name = strdup(name);
1686 __ecore_config_server_local = ecore_config_init_local(name);
1687 if (!__ecore_config_server_local)
1688 return ECORE_CONFIG_ERR_FAIL;
1690 list = __ecore_config_bundle_local->data;
1691 free( __ecore_config_bundle_local );
1692 __ecore_config_bundle_local =
1693 ecore_config_bundle_new(__ecore_config_server_local, "config");
1694 __ecore_config_bundle_local->data = list;
1696 path = ecore_config_theme_default_path_get();
1697 ecore_config_string_default("/e/themes/search_path", path);
1701 list = ecore_config_get("/e/themes/search_path");
1704 list->flags |= ECORE_CONFIG_FLAG_SYSTEM;
1705 list->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
1708 return _ecore_config_system_load();
1712 * Frees memory and shuts down the library for an application.
1713 * @return @c ECORE_CONFIG_ERR_IGNORED .
1714 * @ingroup Ecore_Config_App_Lib_Group
1717 ecore_config_shutdown(void)
1719 return ecore_config_system_shutdown();
1723 * @defgroup Ecore_Config_Lib_Lib_Group Ecore Config Library Functions
1725 * Functions that are used to start up and shutdown the Enlightened
1726 * Property Library when used directly by an application.
1730 * Initializes the Enlightened Property Library.
1732 * This function is meant to be run from other programming libraries.
1733 * It should not be called from applications.
1735 * This function (or @ref ecore_config_init )
1736 * must be run before any other function in the
1737 * Enlightened Property Library, even if you have run @ref ecore_init .
1739 * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up.
1740 * @c ECORE_CONFIG_ERR_FAIL otherwise.
1741 * @ingroup Ecore_Config_Lib_Lib_Group
1744 ecore_config_system_init(void)
1746 _ecore_config_system_init_no_load();
1747 return _ecore_config_system_load();
1751 _ecore_config_system_init_no_load(void)
1755 __ecore_config_system_init++;
1756 if (__ecore_config_system_init > 1)
1757 return ECORE_CONFIG_ERR_IGNORED;
1760 if ((p = getenv("ECORE_CONFIG_DEBUG")) && p[0] != 0)
1765 __ecore_config_server_global =
1766 ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID);
1767 if (!__ecore_config_server_global)
1768 return ECORE_CONFIG_ERR_FAIL;
1770 __ecore_config_bundle_local =
1771 ecore_config_bundle_new(__ecore_config_server_global, "system");
1773 /* set up a simple default path */
1774 ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes");
1776 return ECORE_CONFIG_ERR_SUCC;
1781 _ecore_config_system_load(void)
1784 Ecore_Config_Prop *sys;
1786 if (__ecore_config_system_init != 1)
1787 return ECORE_CONFIG_ERR_FAIL;
1789 if ((p = getenv("HOME")))
1790 { /* debug-only ### FIXME */
1791 if ((buf = malloc(PATH_MAX * sizeof(char))))
1793 snprintf(buf, PATH_MAX, "%s/.e/config.eet", p);
1794 if (ecore_config_file_load(buf) != 0) {
1795 /* even if this file (system.eet) dosen't exist we can
1796 * continue without it as it isn't striclty necessary.
1798 ecore_config_file_load(PACKAGE_DATA_DIR "/system.eet");
1800 sys = __ecore_config_bundle_local->data;
1803 /* unmark it modified - modification will mean it has been overridden */
1804 sys->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
1805 /* mark as system so that examine can hide them */
1806 sys->flags |= ECORE_CONFIG_FLAG_SYSTEM;
1813 return ECORE_CONFIG_ERR_SUCC;
1818 * Frees memory and shuts down the library for other programming libraries.
1819 * @return @c ECORE_CONFIG_ERR_IGNORED
1820 * @ingroup Ecore_Config_Lib_Lib_Group
1823 ecore_config_system_shutdown(void)
1827 __ecore_config_system_init--;
1828 if (__ecore_config_system_init > 0)
1829 return ECORE_CONFIG_ERR_IGNORED;
1831 ret = _ecore_config_ipc_exit();
1832 if (__ecore_config_app_name)
1833 free(__ecore_config_app_name);
1834 while(__ecore_config_bundle_local->data)
1835 ecore_config_dst(__ecore_config_bundle_local->data);
1836 free(__ecore_config_bundle_local);
1837 free(__ecore_config_server_local);
1838 free(__ecore_config_server_global);
1839 eina_log_domain_unregister(_ecore_config_log_dom);
1840 _ecore_config_log_dom = -1;
1844 static inline void *
1845 __ecore_argb_to_long(int a, int r, int g, int b, long *v)
1847 *v = ((a << 24) & 0xff000000 )
1848 | ((r << 16) & 0xff0000 )
1849 | ((g << 8) & 0xff00 )
1855 static inline void *
1856 __ecore_argbstr_to_long(const char *argb, long *v)
1860 // convert hexadecimal string #..., #0x..., 0x..., ... to long
1863 *v = (long)strtoul( argb, &l, 16);
1867 ERR("ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?", argb);