Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_config.c ewl_config.h 


Log Message:
add ewl_config_color_set/get

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_config.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_config.c        8 Oct 2006 02:08:06 -0000       1.17
+++ ewl_config.c        10 Oct 2006 20:40:38 -0000      1.18
@@ -278,6 +278,69 @@
 
 /**
  * @param cfg: The Ewl_Config to work with
+ * @param k: the key to set in the configuration database
+ * @param r: the red value that will be associated with the key
+ * @param g: the green value that will be associated with the key
+ * @param b: the blue value that will be associated with the key
+ * @param a: the alpha value that will be associated with the key
+ * @return Returns no value
+ * @brief Set the value of key to the specified color
+ *
+ * Sets the color value associated with the key @a k to @a v in the
+ * configuration database.
+ */
+void
+ewl_config_color_set(Ewl_Config *cfg, const char *k, int r, int g,
+                                       int b, int a,
+                                       Ewl_State_Type state)
+{
+       char buf[128];
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("k", k);
+
+       snprintf(buf, sizeof(buf), "%i %i %i %i", r, g, b, a);
+       ecore_hash_set(ewl_config_set_hash_get(cfg, state), 
+                                       strdup(k), strdup(buf));
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param cfg: The Ewl_Config to work with
+ * @param k: the key to search
+ * @param r: the red value that is associated with the key
+ * @param g: the green value that is associated with the key
+ * @param b: the blue value that is associated with the key
+ * @param a: the alpha value that is associated with the key
+ * @return Returns no value
+ * @brief Retrieve color associated with a key
+ */
+void
+ewl_config_color_get(Ewl_Config *cfg, const char *k, int *r, int *g,
+                                               int *b, int *a)
+{
+       const char *val;
+       int tmp_r = 0, tmp_g = 0, tmp_b = 0, tmp_a = 0;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("k", k);
+
+       val = ewl_config_get(cfg, k);
+       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;
+       if (b) *b = tmp_b;
+       if (a) *a = tmp_a;
+       
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+
+/**
+ * @param cfg: The Ewl_Config to work with
  * @return Returns TRUE if the user can write to the system conf file, FALSE
  * otherwise
  * @brief Determines if the user can write the system config file
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_config.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_config.h        2 Oct 2006 05:19:24 -0000       1.18
+++ ewl_config.h        10 Oct 2006 20:40:38 -0000      1.19
@@ -48,6 +48,13 @@
                                                Ewl_State_Type state);
 float           ewl_config_float_get(Ewl_Config *cfg, const char *k);
 
+void            ewl_config_color_set(Ewl_Config *cfg, const char *k, 
+                                               int r, int g, int b, int a,
+                                               Ewl_State_Type state);
+void            ewl_config_color_get(Ewl_Config *cfg, const char *k,
+                                               int *r, int *g,
+                                               int *b, int *a);
+
 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);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to