Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_config.c ewl_config.h 


Log Message:
- add the ability to remove keys from the ewl_config

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_config.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_config.c        26 Dec 2007 18:10:36 -0000      1.37
+++ ewl_config.c        20 Mar 2008 02:25:18 -0000      1.38
@@ -352,8 +352,7 @@
        DCHECK_PARAM_PTR(k);
 
        val = ewl_config_get(cfg, k);
-       if (val)
-               sscanf(val, "%i %i %i %i", &tmp_r, &tmp_g, &tmp_b, &tmp_a);
+       if (val) sscanf(val, "%i %i %i %i", &tmp_r, &tmp_g, &tmp_b, &tmp_a);
 
        if (r) *r = tmp_r;
        if (g) *g = tmp_g;
@@ -363,6 +362,82 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+/**
+ * @param cfg: The Ewl_Config to work with
+ * @param k: The key to remove
+ * @return Returns no value
+ * @brief Removes key from configuration
+ */
+void
+ewl_config_key_remove(Ewl_Config *cfg, const char *k)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(cfg);
+       DCHECK_PARAM_PTR(k);
+
+       ewl_config_instance_key_remove(cfg, k);
+       ewl_config_system_key_remove(cfg, k);
+       ewl_config_user_key_remove(cfg, k);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param cfg: The Ewl_Config to work with
+ * @param k: The key to remove
+ * @return Returns no value
+ * @brief Removes the given key from the instance configuration data
+ */
+void
+ewl_config_instance_key_remove(Ewl_Config *cfg, const char *k)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(cfg);
+       DCHECK_PARAM_PTR(k);
+
+       if (cfg->data.instance && (ecore_hash_get(cfg->data.instance, k)))
+               ecore_hash_remove(cfg->data.instance, k);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param cfg: The Ewl_Config to work with
+ * @param k: The key to remove
+ * @return Returns no value
+ * @brief Removes the given key from the system configuration data
+ */
+void
+ewl_config_system_key_remove(Ewl_Config *cfg, const char *k)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(cfg);
+       DCHECK_PARAM_PTR(k);
+
+       if (cfg->data.system && (ecore_hash_get(cfg->data.system, k)))
+               ecore_hash_remove(cfg->data.system, k);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param cfg: The Ewl_Config to work with
+ * @param k: The key to remove
+ * @return Returns no value
+ * @brief Removes the given key from the user configuration data
+ */
+void
+ewl_config_user_key_remove(Ewl_Config *cfg, const char *k)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(cfg);
+       DCHECK_PARAM_PTR(k);
+
+       if (cfg->data.user && (ecore_hash_get(cfg->data.user, k)))
+               ecore_hash_remove(cfg->data.user, k);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
 
 /**
  * @param cfg: The Ewl_Config to work with
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_config.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_config.h        23 Aug 2007 05:26:50 -0000      1.23
+++ ewl_config.h        20 Mar 2008 02:25:19 -0000      1.24
@@ -56,6 +56,11 @@
                                                int *r, int *g,
                                                int *b, int *a);
 
+void            ewl_config_key_remove(Ewl_Config *cfg, const char *k);
+void            ewl_config_instance_key_remove(Ewl_Config *cfg, const char *k);
+void            ewl_config_system_key_remove(Ewl_Config *cfg, const char *k);
+void            ewl_config_user_key_remove(Ewl_Config *cfg, const char *k);
+
 int             ewl_config_can_save_system(Ewl_Config *cfg);
 int             ewl_config_system_save(Ewl_Config *cfg);
 int             ewl_config_user_save(Ewl_Config *cfg);



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to