Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/examples


Modified Files:
        Makefile.am config_basic_example.c config_listener_example.c 
        list_example.c 


Log Message:


example fixes

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/examples/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- Makefile.am 11 Dec 2005 06:52:07 -0000      1.14
+++ Makefile.am 6 Jan 2006 15:32:46 -0000       1.15
@@ -12,7 +12,9 @@
 endif
 
 if BUILD_ECORE_CONFIG
-CONFIG_EXAMPLES = config_basic_example
+CONFIG_EXAMPLES = \
+config_basic_example \
+config_listener_example
 endif
 
 if BUILD_ECORE_X
@@ -58,6 +60,11 @@
                                 
$(top_builddir)/src/lib/ecore_config/libecore_config.la \
                                 
$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \
                                 
$(top_builddir)/src/lib/ecore_con/libecore_con.la
+config_listener_example_SOURCES  = config_listener_example.c
+config_listener_example_LDADD    = $(top_builddir)/src/lib/ecore/libecore.la \
+                                   
$(top_builddir)/src/lib/ecore_config/libecore_config.la \
+                                   
$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \
+                                   
$(top_builddir)/src/lib/ecore_con/libecore_con.la
 endif
 
 if BUILD_ECORE_X
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/examples/config_basic_example.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- config_basic_example.c      8 May 2004 14:51:05 -0000       1.2
+++ config_basic_example.c      6 Jan 2006 15:32:46 -0000       1.3
@@ -5,11 +5,11 @@
 #include <string.h>
 #include <Ecore_Config.h>
 
-#define INT_VAL_KEY "int_val"
-#define FLT_VAL_KEY "flt_val"
-#define STR_VAL_KEY "str_val"
-#define RGB_VAL_KEY "rgb_val"
-#define THM_VAL_KEY "thm_val"
+#define INT_VAL_KEY "/example/integer"
+#define FLT_VAL_KEY "/example/float"
+#define STR_VAL_KEY "/example/string"
+#define RGB_VAL_KEY "/example/colour"
+#define THM_VAL_KEY "/example/theme"
 
 long   int_val;
 float  flt_val;
@@ -21,7 +21,7 @@
   ecore_config_int_default(INT_VAL_KEY, 0);
   ecore_config_float_default(FLT_VAL_KEY, 0.0);
   ecore_config_string_default(STR_VAL_KEY, "test1");
-  ecore_config_rgb_default(RGB_VAL_KEY, "#000000");
+  ecore_config_argb_default(RGB_VAL_KEY, "#FF000000");
   ecore_config_theme_default(THM_VAL_KEY, "default");
 }
 
@@ -34,7 +34,7 @@
   int_val = ecore_config_int_get(INT_VAL_KEY);
   flt_val = ecore_config_float_get(FLT_VAL_KEY);
   str_val = ecore_config_string_get(STR_VAL_KEY);
-  rgb_val = ecore_config_rgbstr_get(RGB_VAL_KEY);
+  rgb_val = ecore_config_argbstr_get(RGB_VAL_KEY);
   thm_val = ecore_config_theme_get(THM_VAL_KEY);
 }
 
@@ -46,18 +46,20 @@
   } else {
     str_val[4] += 1;
   }
-  if('9' == rgb_val[1]) {
-    rgb_val[1] = '\0';
-    rgb_val[3] = '\0';
-    rgb_val[5] = '\0';
+  if('9' == rgb_val[3]) {
+    rgb_val[3] = '0';
+    rgb_val[5] = '0';
+    rgb_val[7] = '0';
   } else {
-    rgb_val[1] += 1;
     rgb_val[3] += 1;
     rgb_val[5] += 1;
+    rgb_val[7] += 1;
   }
   if(!strcmp(thm_val, "default")) {
+    if(thm_val) free(thm_val);
     thm_val = strdup("winter");
   } else {
+    if(thm_val) free(thm_val);
     thm_val = strdup("default");
   }
 }
@@ -66,17 +68,17 @@
   ecore_config_int_set(INT_VAL_KEY, int_val);
   ecore_config_float_set(FLT_VAL_KEY, flt_val);
   ecore_config_string_set(STR_VAL_KEY, str_val);
-  ecore_config_rgb_set(RGB_VAL_KEY, rgb_val);
+  ecore_config_argb_set(RGB_VAL_KEY, rgb_val);
   ecore_config_theme_set(THM_VAL_KEY, thm_val);
   ecore_config_save();
 }
 
 void dump_settings (void) {
   printf("  Int Value:    %li\n", int_val);
-  printf("  Float Value:  %f\n", flt_val);
-  printf("  String Value: %s\n", str_val);
-  printf("  RGB Value:    %s\n", rgb_val);
-  printf("  Theme Value:  %s\n", thm_val);
+  printf("  Float Value:  %f\n",  flt_val);
+  printf("  String Value: %s\n",  str_val);
+  printf("  RGB Value:    %s\n",  rgb_val);
+  printf("  Theme Value:  %s\n",  thm_val);
 }
 
 int main (int argc, char **argv) {
@@ -88,6 +90,9 @@
   printf("--- Values to be Saved ---\n");
   dump_settings();
   save_settings();
+  if(str_val) free(str_val);
+  if(rgb_val) free(rgb_val);
+  if(thm_val) free(thm_val);
   ecore_config_shutdown();
   return 0;
 }
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/examples/config_listener_example.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- config_listener_example.c   14 Jul 2004 14:15:50 -0000      1.1
+++ config_listener_example.c   6 Jan 2006 15:32:46 -0000       1.2
@@ -5,7 +5,7 @@
 #include <Ecore.h>
 #include <Ecore_Config.h>
 
-#define INT_PROPERTY_KEY  "int_val"
+#define INT_PROPERTY_KEY  "/example/integer"
 #define CALLBACK_NAME     "change listener"
 
 int change_listener (const char *key, const Ecore_Config_Type type,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/examples/list_example.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- list_example.c      14 Jul 2004 14:15:50 -0000      1.1
+++ list_example.c      6 Jan 2006 15:32:46 -0000       1.2
@@ -18,11 +18,14 @@
   char *last   = "last";
 
   list = ecore_list_new();
+
   ecore_list_append(list, last);    // Insert
   ecore_list_prepend(list, first);  // Add to front
-  ecore_list_goto_index(list, 2);
+  ecore_list_goto_index(list, 1);   // counted from 0
   ecore_list_insert(list, second);  // Insert before item at index 2
   print_list(list);
 
+  ecore_list_destroy(list);
+
   return 0;
 }




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to