decided to make another, trivial, patch..
this fixes the config_listener and list examples.
it also tweaks the config_basic example a bit...
--
Morten
:wq
Index: Makefile.am
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/examples/Makefile.am,v
retrieving revision 1.14
diff -u -r1.14 Makefile.am
--- Makefile.am 11 Dec 2005 06:52:07 -0000 1.14
+++ Makefile.am 2 Jan 2006 05:34:46 -0000
@@ -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
Index: config_basic_example.c
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/examples/config_basic_example.c,v
retrieving revision 1.2
diff -u -r1.2 config_basic_example.c
--- config_basic_example.c 8 May 2004 14:51:05 -0000 1.2
+++ config_basic_example.c 2 Jan 2006 05:34:46 -0000
@@ -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;
}
Index: config_listener_example.c
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/examples/config_listener_example.c,v
retrieving revision 1.1
diff -u -r1.1 config_listener_example.c
--- config_listener_example.c 14 Jul 2004 14:15:50 -0000 1.1
+++ config_listener_example.c 2 Jan 2006 05:34:46 -0000
@@ -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,
Index: list_example.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/examples/list_example.c,v
retrieving revision 1.1
diff -u -r1.1 list_example.c
--- list_example.c 14 Jul 2004 14:15:50 -0000 1.1
+++ list_example.c 2 Jan 2006 05:34:46 -0000
@@ -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;
}