10 #include <sys/param.h>
11 #include <sys/types.h>
17 #include "Ecore_Config.h"
18 #include "ecore_config_private.h"
19 #include "ecore_config_ipc.h"
21 #include "ecore_config_util.h"
22 int _ecore_config_log_dom = -1;
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;
30 static int _ecore_config_system_init_no_load(void);
31 static int _ecore_config_system_load(void);
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);
36 static const char *_ecore_config_type[] =
37 { "undefined", "integer", "float", "string", "colour", "theme", "boolean", "structure" };
40 * @defgroup Ecore_Config_Property_Group Ecore Config Property Functions
42 * Functions that retrieve or set the attributes relating to a property.
46 * Removes the given property from the local configuration and destroys it.
47 * @param e Property to destroy.
49 * @ingroup Ecore_Config_Property_Group
51 EAPI Ecore_Config_Prop *
52 ecore_config_dst(Ecore_Config_Prop * e)
54 Ecore_Config_Bundle *t;
55 Ecore_Config_Prop *p, *c;
56 Ecore_Config_Listener_List *l;
59 t = __ecore_config_bundle_local;
75 while (c && (c != e));
76 if (c) /* remove from list if even in there */
84 e->listeners = e->listeners->next;
90 if (e->ptr && ((e->type == ECORE_CONFIG_STR) || (e->type == ECORE_CONFIG_THM)))
93 memset(e, 0, sizeof(Ecore_Config_Prop));
100 * @defgroup Ecore_Config_Get_Group Configuration Retrieve Functions
102 * Functions that retrieve configuration values, based on type.
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
112 EAPI Ecore_Config_Prop *
113 ecore_config_get(const char *key)
115 Ecore_Config_Bundle *t;
116 Ecore_Config_Prop *e;
118 t = __ecore_config_bundle_local;
124 if (!strcmp(key, e->key))
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
139 ecore_config_type_get(const Ecore_Config_Prop * e)
143 return _ecore_config_type[e->type];
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
156 ecore_config_string_get(const char *key)
158 return _ecore_config_string_get( ecore_config_get(key) );
162 _ecore_config_string_get(Ecore_Config_Prop *e)
164 return (e && (e->type == ECORE_CONFIG_STR) && e->ptr) ? strdup(e->ptr) : NULL;
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
175 ecore_config_boolean_get(const char *key)
177 return _ecore_config_boolean_get( ecore_config_get(key) );
181 _ecore_config_boolean_get(Ecore_Config_Prop *e)
183 return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_BLN))) ? (e->val != 0) : -1;
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
194 ecore_config_int_get(const char *key)
196 return _ecore_config_int_get( ecore_config_get(key) );
200 _ecore_config_int_get(Ecore_Config_Prop *e)
202 return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_RGB))) ? e->val : 0L;
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
213 ecore_config_float_get(const char *key)
215 return _ecore_config_float_get( ecore_config_get(key) );
219 _ecore_config_float_get(Ecore_Config_Prop *e)
221 return (e && (e->type == ECORE_CONFIG_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0;
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
233 * @ingroup Ecore_Config_Get_Group
236 ecore_config_argb_get(const char *key, int *a, int *r, int *g, int *b)
238 return _ecore_config_argb_get( ecore_config_get(key), a, r, g, b);
242 _ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, int *g, int *b)
244 if (e && ((e->type == ECORE_CONFIG_RGB)))
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;
252 return ECORE_CONFIG_ERR_FAIL;
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
262 ecore_config_argbint_get(const char *key)
264 return _ecore_config_argbint_get( ecore_config_get(key) );
268 _ecore_config_argbint_get(Ecore_Config_Prop *e)
270 if (e && ((e->type == ECORE_CONFIG_RGB)))
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
284 ecore_config_argbstr_get(const char *key)
286 return _ecore_config_argbstr_get( ecore_config_get(key) );
290 _ecore_config_argbstr_get(Ecore_Config_Prop *e)
295 esprintf(&r, "#%08x", _ecore_config_int_get(e));
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
307 ecore_config_theme_get(const char *key)
309 return _ecore_config_theme_get( ecore_config_get(key) );
313 _ecore_config_theme_get(Ecore_Config_Prop *e)
315 return (e && (e->type == ECORE_CONFIG_THM)) ? strdup(e->ptr) : NULL;
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
326 ecore_config_as_string_get(const char *key)
328 Ecore_Config_Prop *e;
334 if (!(e = ecore_config_get(key)))
335 ERR("no such property, \"%s\"...", key);
340 case ECORE_CONFIG_NIL:
341 val = strdup("<nil>");
343 case ECORE_CONFIG_INT:
344 esprintf(&val, "%ld", _ecore_config_int_get(e));
346 case ECORE_CONFIG_BLN:
347 esprintf(&val, "%ld", _ecore_config_boolean_get(e));
349 case ECORE_CONFIG_FLT:
350 esprintf(&val, "%lf", _ecore_config_float_get(e));
352 case ECORE_CONFIG_STR:
353 esprintf(&val, "\"%s\"", _ecore_config_string_get(e));
355 case ECORE_CONFIG_RGB:
356 esprintf(&val, "#%08x", _ecore_config_int_get(e));
358 case ECORE_CONFIG_THM:
359 esprintf(&val, "\"%s\"", _ecore_config_theme_get(e));
361 case ECORE_CONFIG_SCT:
364 esprintf(&r, "%s:unknown_type", key);
369 esprintf(&r, "%s:%s=%s", key, _ecore_config_type[e->type], val);
377 ecore_config_bound(Ecore_Config_Prop * e)
382 ret = ECORE_CONFIG_ERR_SUCC;
385 return ECORE_CONFIG_ERR_FAIL;
386 if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
388 if ((e->val < e->lo))
390 WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
391 e->key, e->val, e->lo);
394 else if ((e->val > e->hi))
396 WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
397 e->key, e->val, e->hi);
401 ret = ECORE_CONFIG_ERR_IGNORED;
404 ret = ECORE_CONFIG_ERR_IGNORED;
408 v = ((int)(e->val / e->step)) * e->step;
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);
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;
428 * Tries to guess the type of a property.
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.
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.
440 ecore_config_type_guess(const char *key, const char *val)
442 Ecore_Config_Prop *p;
447 if (key && (p = ecore_config_get(key)) && p->type != ECORE_CONFIG_NIL)
451 return ECORE_CONFIG_NIL;
453 return ECORE_CONFIG_RGB;
459 if (sscanf(val, "%f%*s", &f) != 1)
460 return ECORE_CONFIG_STR;
461 return ECORE_CONFIG_FLT;
463 return ECORE_CONFIG_INT;
467 ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type)
471 return ECORE_CONFIG_ERR_NODATA;
473 if (!(val) && (type != ECORE_CONFIG_NIL && type != ECORE_CONFIG_SCT))
477 if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
479 e->val = (long) *((int *)val);
482 else if (type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM)
484 if (!(e->ptr = strdup(val)))
485 return ECORE_CONFIG_ERR_OOM;
486 if (e->type == ECORE_CONFIG_NIL)
489 else if (type == ECORE_CONFIG_RGB)
491 __ecore_argbstr_to_long((char *)val, &e->val);
492 e->type = ECORE_CONFIG_RGB;
494 else if (type == ECORE_CONFIG_FLT)
496 e->val = (long) ((*((float *)val)) * ECORE_CONFIG_FLOAT_PRECISION);
497 e->type = ECORE_CONFIG_FLT;
499 else if (type == ECORE_CONFIG_SCT)
501 e->type = ECORE_CONFIG_SCT;
505 e->type = ECORE_CONFIG_NIL;
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;
513 return ECORE_CONFIG_ERR_IGNORED;
517 ecore_config_typed_add(const char *key, const void *val, int type)
519 int error = ECORE_CONFIG_ERR_SUCC;
520 Ecore_Config_Prop *e = NULL;
521 Ecore_Config_Bundle *t;
523 t = __ecore_config_bundle_local;
525 return ECORE_CONFIG_ERR_NODATA;
527 if (!(e = calloc(1, sizeof(Ecore_Config_Prop))))
529 return ECORE_CONFIG_ERR_OOM;
531 else if (!(e->key = strdup(key)))
533 error = ECORE_CONFIG_ERR_OOM;
535 else if ((error = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
542 return ECORE_CONFIG_ERR_SUCC;
550 if (error == ECORE_CONFIG_ERR_SUCC)
551 error = ECORE_CONFIG_ERR_FAIL;
557 ecore_config_add(const char *key, const char *val)
561 type = ecore_config_type_guess(key, val);
562 return ecore_config_typed_add(key, val, type);
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
574 ecore_config_describe(const char *key, const char *desc)
576 Ecore_Config_Prop *e;
578 if (!(e = ecore_config_get(key)))
579 return ECORE_CONFIG_ERR_NODATA;
580 e->description = strdup(desc);
581 return ECORE_CONFIG_ERR_SUCC;
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
594 ecore_config_short_opt_set(const char *key, char short_opt)
596 Ecore_Config_Prop *e;
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;
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
614 ecore_config_long_opt_set(const char *key, const char *long_opt)
616 Ecore_Config_Prop *e;
618 if (!(e = ecore_config_get(key)))
619 return ECORE_CONFIG_ERR_NODATA;
623 e->long_opt = strdup(long_opt);
624 return ECORE_CONFIG_ERR_SUCC;
628 _ecore_config_listener_fire(Ecore_Config_Prop *prop)
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);
634 /* fire change listeners for the generic struct container etc */
636 _ecore_config_listener_fire(prop->parent);
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
648 ecore_config_typed_set(const char *key, const void *val, int type)
650 Ecore_Config_Prop *e;
654 return ECORE_CONFIG_ERR_NODATA;
655 /* if (!t) { * global prop *
656 e=ecore_config_get(key);
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;
663 if (!(e = ecore_config_get(key)))
664 return ecore_config_typed_add(key, val, type);
666 if ((ret = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
668 _ecore_config_listener_fire(e);
672 ERR("ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d",
680 * @defgroup Ecore_Config_Set_Group Ecore Config Setters
682 * Functions that set the value of a property.
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
693 ecore_config_set(const char *key, const char *val)
700 type = ecore_config_type_guess(key, val);
701 if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
704 return ecore_config_typed_set(key, &tmpi, type);
706 else if (type == ECORE_CONFIG_FLT)
709 return ecore_config_typed_set(key, &tmpf, type);
711 else if (type == ECORE_CONFIG_RGB)
713 __ecore_argbstr_to_long(val, &tmpl);
714 return ecore_config_typed_set(key, &tmpl, type);
717 return ecore_config_typed_set(key, val, type);
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
728 ecore_config_as_string_set(const char *key, const char *val)
730 return ecore_config_set(key, val);
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
741 ecore_config_boolean_set(const char *key, int val)
744 return ecore_config_typed_set(key, &val, ECORE_CONFIG_BLN);
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
755 ecore_config_int_set(const char *key, int val)
757 return ecore_config_typed_set(key, &val, ECORE_CONFIG_INT);
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
768 ecore_config_string_set(const char *key, const char *val)
770 return ecore_config_typed_set(key, val, ECORE_CONFIG_STR);
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
781 ecore_config_float_set(const char *key, float val)
783 return ecore_config_typed_set(key, &val, ECORE_CONFIG_FLT);
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
797 ecore_config_argb_set(const char *key, int a, int r, int g, int b)
800 return ecore_config_typed_set(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB);
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
811 ecore_config_argbint_set(const char *key, long argb)
813 return ecore_config_typed_set(key, &argb, ECORE_CONFIG_RGB);
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
824 ecore_config_argbstr_set(const char *key, const char *val)
827 return ecore_config_typed_set(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB);
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
838 ecore_config_theme_set(const char *key, const char *val)
840 return ecore_config_typed_set(key, val, ECORE_CONFIG_THM);
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
851 ecore_config_theme_preview_group_set(const char *key, const char *group)
854 Ecore_Config_Prop *e;
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;
866 e->data = strdup(group);
872 ecore_config_typed_default(const char *key, const void *val, int type)
875 Ecore_Config_Prop *e;
877 ret = ECORE_CONFIG_ERR_SUCC;
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;
887 else if (!(e->flags & ECORE_CONFIG_FLAG_MODIFIED) && !(e->flags & ECORE_CONFIG_FLAG_SYSTEM))
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;
898 * @defgroup Ecore_Config_Default_Group Ecore Config Defaults
900 * Functions that are used to set the default values of properties.
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
916 ecore_config_default(const char *key, const char *val, float lo, float hi, float step)
919 Ecore_Config_Prop *e;
921 type = ecore_config_type_guess(key, val);
922 ret = ecore_config_typed_default(key, val, type);
923 e = ecore_config_get(key);
926 if (type == ECORE_CONFIG_INT)
929 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
932 ecore_config_bound(e);
934 else if (type == ECORE_CONFIG_FLT)
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);
948 * Sets the indicated property to the given boolean if the property has not yet
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
956 ecore_config_boolean_default(const char *key, int val)
959 return ecore_config_typed_default(key, &val, ECORE_CONFIG_BLN);
963 * Sets the indicated property to the given integer if the property has not yet
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
971 ecore_config_int_default(const char *key, int val)
973 return ecore_config_typed_default(key, &val, ECORE_CONFIG_INT);
977 * Sets the indicated property to the given integer if the property has not yet
980 * The bounds and step values are set regardless.
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
991 ecore_config_int_default_bound(const char *key, int val, int low, int high,
994 Ecore_Config_Prop *e;
997 ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_INT);
998 e = ecore_config_get(key);
1002 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
1005 ecore_config_bound(e);
1012 * Sets the indicated property to the given string if the property has not yet
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
1020 ecore_config_string_default(const char *key, const char *val)
1022 return ecore_config_typed_default(key, val, ECORE_CONFIG_STR);
1026 * Sets the indicated property to the given float if the property has not yet
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
1034 ecore_config_float_default(const char *key, float val)
1036 return ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT);
1040 * Sets the indicated property to the given float if the property has not yet
1043 * The bounds and step values are set regardless.
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
1054 ecore_config_float_default_bound(const char *key, float val, float low,
1055 float high, float step)
1057 Ecore_Config_Prop *e;
1060 ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT);
1061 e = ecore_config_get(key);
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);
1075 * Sets the indicated property to a color value if the property has not yet
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
1086 ecore_config_argb_default(const char *key, int a, int r, int g, int b)
1089 return ecore_config_typed_default(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB);
1093 * Sets the indicated property to a color value if the property has not yet
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
1101 ecore_config_argbint_default(const char *key, long argb)
1103 return ecore_config_typed_default(key, &argb, ECORE_CONFIG_RGB);
1107 * Sets the indicated property to a color value if the property has not yet
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
1115 ecore_config_argbstr_default(const char *key, const char *val)
1118 return ecore_config_typed_default(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB);
1122 * Sets the indicated property to a theme name if the property has not yet
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
1130 ecore_config_theme_default(const char *key, const char *val)
1132 return ecore_config_typed_default(key, val, ECORE_CONFIG_THM);
1136 * @defgroup Ecore_Config_Struct_Group Ecore Config Structures
1138 * Functions that are used to create structures of properties.
1142 * Sets the indicated property to a structure if the property has not yet
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
1149 ecore_config_struct_create(const char *key)
1151 WRN("you are using ecore_config structures. These are very young");
1152 WRN(" and not complete - you have been warned");
1154 return ecore_config_typed_default(key, NULL, ECORE_CONFIG_SCT);
1158 _ecore_config_struct_append(Ecore_Config_Prop *sct, Ecore_Config_Prop *add)
1162 if (!sct || !add || sct->type != ECORE_CONFIG_SCT)
1163 return ECORE_CONFIG_ERR_IGNORED;
1166 sct->data = eina_list_append(l, add);
1169 return ECORE_CONFIG_ERR_SUCC;
1173 _ecore_config_struct_typed_add(const char *key, const char *name, const void *val,
1179 subkey = malloc((strlen(key) + strlen(name) + 2) * sizeof(char));
1180 strcpy(subkey, key);
1181 strcat(subkey, ".");
1182 strcat(subkey, name);
1184 ecore_config_typed_default(subkey, val, type);
1185 ret = _ecore_config_struct_append(ecore_config_get(key),
1186 ecore_config_get(subkey));
1192 * Add an int property to the named structure. The property is set if it has not
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
1201 ecore_config_struct_int_add(const char *key, const char *name, int val)
1203 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_INT);
1207 * Add a float property to the named structure. The property is set if it has
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
1216 ecore_config_struct_float_add(const char *key, const char *name, float val)
1218 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_FLT);
1222 * Add a string property to the named structure. The property is set if it has
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
1231 ecore_config_struct_string_add(const char *key, const char *name, const char* val)
1233 return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_STR);
1237 * Add an argb property to the named structure. The property is set if it has
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
1249 ecore_config_struct_argb_add(const char *key, const char *name, int a, int r,
1254 __ecore_argb_to_long(a, r, g, b, &argb);
1255 return _ecore_config_struct_typed_add(key, name, &argb, ECORE_CONFIG_RGB);
1259 * Add a theme property to the named structure. The property is set if it has
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
1268 ecore_config_struct_theme_add(const char *key, const char *name, const char* val)
1270 return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_THM);
1274 * Add a boolean property to the named structure. The property is set if it has
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
1283 ecore_config_struct_boolean_add(const char *key, const char *name, int val)
1286 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_BLN);
1290 * Get the contents of a defined structure property and load it into the passed
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
1298 ecore_config_struct_get(const char *key, void *data)
1300 Ecore_Config_Prop *e, *f;
1305 e = ecore_config_get(key);
1307 return ECORE_CONFIG_ERR_NODATA;
1313 f = (Ecore_Config_Prop *) l->data;
1316 case ECORE_CONFIG_INT:
1317 *((int *) ptr) = _ecore_config_int_get(f);
1320 case ECORE_CONFIG_BLN:
1321 *((int *) ptr) = _ecore_config_boolean_get(f);
1324 case ECORE_CONFIG_FLT:
1325 *((float *) ptr) = _ecore_config_float_get(f);
1326 ptr += sizeof(float);
1328 case ECORE_CONFIG_STR:
1329 case ECORE_CONFIG_THM:
1330 *((char **) ptr) = _ecore_config_string_get(f);
1331 ptr += sizeof(char *);
1333 case ECORE_CONFIG_RGB:
1334 argb = _ecore_config_argbint_get(f);
1335 *((int *) ptr) = (argb >> 24) & 0xff;
1337 *((int *) ptr) = (argb >> 16) & 0xff;
1339 *((int *) ptr) = (argb >> 8) & 0xff;
1341 *((int *) ptr) = argb & 0xff;
1345 WRN("ARGH - STRUCT coding not implemented yet");
1347 l = eina_list_next(l);
1349 return ECORE_CONFIG_ERR_SUCC;
1353 * @defgroup Ecore_Config_Listeners_Group Ecore Config Listeners
1355 * Functions that set and unset property listener callbacks.
1359 * Adds a callback function to the list of functions called when a property
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
1370 ecore_config_listen(const char *name, const char *key,
1371 Ecore_Config_Listener listener, int tag, void *data)
1373 Ecore_Config_Prop *e;
1374 Ecore_Config_Listener_List *l;
1377 return ECORE_CONFIG_ERR_NODATA;
1379 if (!(e = ecore_config_get(key)))
1381 int ret = ecore_config_add(key, "");
1383 if (ret != ECORE_CONFIG_ERR_SUCC)
1385 ERR("ecore_config_listen: ecore_config_add(\"%s\") failed: %d",
1389 if (!(e = ecore_config_get(key)))
1391 ERR("ecore_config_listen: list of properties corrupted!?");
1392 return ECORE_CONFIG_ERR_FAIL;
1396 for (l = e->listeners; l; l = l->next)
1397 if (!strcmp(l->name, name) || (l->listener == listener))
1399 ERR("ecore_config_listen: %s is already listening for changes of %s...",
1401 return ECORE_CONFIG_ERR_IGNORED;
1404 if (!(l = malloc(sizeof(Ecore_Config_Listener_List))))
1405 return ECORE_CONFIG_ERR_OOM;
1407 ERR("registering listener \"%s\" for \"%s\" (%d)...", name, key, e->type);
1409 memset(l, 0, sizeof(Ecore_Config_Listener_List));
1411 l->listener = listener;
1415 l->next = e->listeners;
1418 if (e->type != ECORE_CONFIG_NIL) /* call right on creation if prop exists and has val */
1419 listener(key, e->type, tag, data);
1421 return ECORE_CONFIG_ERR_SUCC;
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
1436 ecore_config_deaf(const char *name, const char *key,
1437 Ecore_Config_Listener listener)
1439 Ecore_Config_Prop *e;
1440 Ecore_Config_Listener_List *l, *p;
1443 ret = ECORE_CONFIG_ERR_NOTFOUND;
1446 return ECORE_CONFIG_ERR_NODATA;
1448 if (!(e = ecore_config_get(key)))
1449 return ECORE_CONFIG_ERR_NOTFOUND;
1451 for (p = NULL, l = e->listeners; l; p = l)
1453 Ecore_Config_Listener_List *nl;
1456 if ((name && !strcmp(l->name, name)) || (l->listener == listener))
1458 ret = ECORE_CONFIG_ERR_SUCC;
1460 e->listeners = e->listeners->next;
1463 memset(l, 0, sizeof(Ecore_Config_Listener));
1473 * Locates the first configuration bundle on the given server.
1474 * @param srv The configuration server.
1475 * @return Pointer to the first configuration bundle.
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;
1484 * Locates the configuration bundle after the given one.
1485 * @param ns The configuration bundle.
1486 * @return The next configuration bundle.
1488 EAPI Ecore_Config_Bundle *
1489 ecore_config_bundle_next_get(Ecore_Config_Bundle * ns)
1491 return ns ? ns->next : NULL;
1495 * Locates a configuration bundle on a configuration server based on its serial
1497 * @param srv The configuration server.
1498 * @param serial Serial number.
1499 * @return The configuration bundle with the given serial number.
1501 EAPI Ecore_Config_Bundle *
1502 ecore_config_bundle_by_serial_get(Ecore_Config_Server * srv, long serial)
1504 Ecore_Config_Bundle *eb;
1510 else if (serial == 0)
1512 Ecore_Config_Bundle *r = eb;
1519 if (eb->serial == serial)
1527 * Gets the Ecore_Config_Bundle with the given identifier from the given
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.
1534 EAPI Ecore_Config_Bundle *
1535 ecore_config_bundle_by_label_get(Ecore_Config_Server * srv, const char *label)
1537 Ecore_Config_Bundle *ns;
1543 if (ns->identifier && !strcmp(ns->identifier, label))
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.
1556 ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns)
1558 return ns ? ns->serial : -1;
1562 * Retrieves the bundle's identifier.
1563 * @param ns The configuration bundle.
1564 * @return The bundle's identifer string.
1567 ecore_config_bundle_label_get(Ecore_Config_Bundle * ns)
1569 return ns ? ns->identifier : NULL;
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.
1579 EAPI Ecore_Config_Bundle *
1580 ecore_config_bundle_new(Ecore_Config_Server * srv, const char *identifier)
1582 Ecore_Config_Bundle *t;
1585 ss = 0; /* bundle unique serial */
1587 if ((t = malloc(sizeof(Ecore_Config_Bundle))))
1589 memset(t, 0, sizeof(Ecore_Config_Bundle));
1591 t->identifier = (char *)identifier;
1593 t->owner = srv->name;
1594 t->next = srv->bundles;
1600 static Ecore_Config_Server *
1601 do_init(const char *name)
1603 return _ecore_config_ipc_init(name);
1606 static Ecore_Config_Server *
1607 ecore_config_init_local(const char *name)
1612 if ((p = getenv("HOME")))
1613 { /* debug-only ### FIXME */
1614 if (!(buf = malloc(PATH_MAX * sizeof(char))))
1616 snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name);
1622 return do_init(name);
1625 static Ecore_Config_Server *
1626 ecore_config_init_global(const char *name)
1632 if ((p = getenv("HOME")))
1633 { /* debug-only ### FIXME */
1634 if (!(buf = malloc(PATH_MAX * sizeof(char))))
1636 snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name);
1637 global = creat(buf, S_IRWXU);
1645 return do_init(name);
1649 * @defgroup Ecore_Config_App_Lib_Group Ecore Config App Library Functions
1651 * Functions that are used to start up and shutdown the Enlightened
1652 * Property Library when used directly by an application.
1656 * Initializes the Enlightened Property Library.
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.
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
1669 ecore_config_init(const char *name)
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)
1677 EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module.");
1680 _ecore_config_system_init_no_load();
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;
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;
1693 path = ecore_config_theme_default_path_get();
1694 ecore_config_string_default("/e/themes/search_path", path);
1698 list = ecore_config_get("/e/themes/search_path");
1701 list->flags |= ECORE_CONFIG_FLAG_SYSTEM;
1702 list->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
1705 return _ecore_config_system_load();
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
1714 ecore_config_shutdown(void)
1716 return ecore_config_system_shutdown();
1720 * @defgroup Ecore_Config_Lib_Lib_Group Ecore Config Library Functions
1722 * Functions that are used to start up and shutdown the Enlightened
1723 * Property Library when used directly by an application.
1727 * Initializes the Enlightened Property Library.
1729 * This function is meant to be run from other programming libraries.
1730 * It should not be called from applications.
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 .
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
1741 ecore_config_system_init(void)
1743 _ecore_config_system_init_no_load();
1744 return _ecore_config_system_load();
1748 _ecore_config_system_init_no_load(void)
1752 __ecore_config_system_init++;
1753 if (__ecore_config_system_init > 1)
1754 return ECORE_CONFIG_ERR_IGNORED;
1757 if ((p = getenv("ECORE_CONFIG_DEBUG")) && p[0] != 0)
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;
1767 __ecore_config_bundle_local =
1768 ecore_config_bundle_new(__ecore_config_server_global, "system");
1770 /* set up a simple default path */
1771 ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes");
1773 return ECORE_CONFIG_ERR_SUCC;
1778 _ecore_config_system_load(void)
1781 Ecore_Config_Prop *sys;
1783 if (__ecore_config_system_init != 1)
1784 return ECORE_CONFIG_ERR_FAIL;
1786 if ((p = getenv("HOME")))
1787 { /* debug-only ### FIXME */
1788 if ((buf = malloc(PATH_MAX * sizeof(char))))
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.
1795 ecore_config_file_load(PACKAGE_DATA_DIR "/system.eet");
1797 sys = __ecore_config_bundle_local->data;
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;
1810 return ECORE_CONFIG_ERR_SUCC;
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
1820 ecore_config_system_shutdown(void)
1824 __ecore_config_system_init--;
1825 if (__ecore_config_system_init > 0)
1826 return ECORE_CONFIG_ERR_IGNORED;
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;
1841 static inline void *
1842 __ecore_argb_to_long(int a, int r, int g, int b, long *v)
1844 *v = ((a << 24) & 0xff000000 )
1845 | ((r << 16) & 0xff0000 )
1846 | ((g << 8) & 0xff00 )
1852 static inline void *
1853 __ecore_argbstr_to_long(const char *argb, long *v)
1857 // convert hexadecimal string #..., #0x..., 0x..., ... to long
1860 *v = (long)strtoul( argb, &l, 16);
1864 ERR("ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?", argb);