Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/elicit
Dir : e17/apps/elicit/src Modified Files: conf.c shots.c swatches.c Log Message: a few cleanups removed unused _{load,save}_eet functions for swatches. start wrapping edb usage in ifdef's =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/conf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- conf.c 8 Mar 2005 05:02:13 -0000 1.12 +++ conf.c 30 Dec 2005 02:51:08 -0000 1.13 @@ -54,6 +54,7 @@ void elicit_config_theme_set(char *name) { + if (!name) return; ecore_config_theme_set("/settings/theme", name); } @@ -128,6 +129,7 @@ void elicit_config_editor_set(char *ed) { + if (!ed) return; ecore_config_string_set("/editor", ed); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/shots.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- shots.c 18 Dec 2005 06:53:46 -0000 1.12 +++ shots.c 30 Dec 2005 02:51:08 -0000 1.13 @@ -4,8 +4,8 @@ void _elicit_shots_update_scroll_bar(Elicit *el); void _elicit_shots_load_eet(Elicit *el); -void _elicit_shots_load_edb(Elicit *el); void _elicit_shots_save_eet(Elicit *el); +void _elicit_shots_load_edb(Elicit *el); void _elicit_shots_save_edb(Elicit *el); int @@ -115,6 +115,7 @@ void _elicit_shots_save_edb(Elicit *el) { +#ifdef HAVE_EDB Evas_List *l; E_DB_File *db; int i = 0; @@ -182,6 +183,7 @@ e_db_close(db); e_db_flush(); +#endif } void @@ -211,6 +213,7 @@ int i; char file[PATH_MAX]; char buf[PATH_MAX]; + char *name = NULL; char *ret = 0; int size_ret = 0; char *theme = NULL; @@ -222,11 +225,13 @@ if (!eet) return; ret = eet_read(eet, "shots/num", &size_ret); - if (size_ret >= PATH_MAX) return; + if (!ret || size_ret >= PATH_MAX) return; memcpy(buf, ret, size_ret); buf[size_ret] = '\0'; num = atoi(buf); + + free(ret); theme = elicit_config_theme_get(el); for (i = 0; i < num; i++) @@ -238,9 +243,19 @@ snprintf(buf, PATH_MAX, "/shots/%d/name", i); ret = eet_read(eet, buf, &size_ret); - memcpy(buf, ret, size_ret); - buf[size_ret] = '\0'; - sh->name = strdup(buf); + + if (ret) + { + name = calloc(size_ret+1, sizeof(char)); + memcpy(name, ret, size_ret); + name[size_ret] = '\0'; + sh->name = strdup(buf); + free(ret); + } + else + { + sh->name = strdup("Unknown"); + } sh->obj = edje_object_add(el->evas); sh->shot = evas_object_image_add(el->evas); @@ -281,6 +296,7 @@ void _elicit_shots_load_edb(Elicit *el) { +#ifdef HAVE_EDB E_DB_File *db; int num, ok; int i; @@ -350,6 +366,7 @@ el->shots.length = esmart_container_elements_length_get(el->shots.cont); e_db_close(db); +#endif } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/swatches.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- swatches.c 20 Dec 2005 20:44:06 -0000 1.15 +++ swatches.c 30 Dec 2005 02:51:08 -0000 1.16 @@ -4,8 +4,6 @@ void _elicit_swatches_update_scroll_bar(Elicit *el); -void _elicit_swatches_save_eet(Elicit *el); -void _elicit_swatches_load_eet(Elicit *el); void _elicit_swatches_load_edb(Elicit *el); void _elicit_swatches_load_gpl(Elicit *el); void _elicit_swatches_save_edb(Elicit *el); @@ -99,49 +97,9 @@ } void -_elicit_swatches_save_eet(Elicit *el) -{ - Evas_List *l; - Eet_File *eet; - int i = 0; - char buf[PATH_MAX]; - char *hex; - - snprintf(buf, PATH_MAX, "%s/.e/apps/%s/swatches.eet", getenv("HOME"), el->app_name); - - eet = eet_open(buf, EET_FILE_MODE_WRITE); - - if (!eet) return; - - for (l = esmart_container_elements_get(el->swatches.cont); l; l = l->next) - { - Evas_Object *obj; - Elicit_Swatch *sw; - - obj = (Evas_Object *)(l->data); - sw = evas_object_data_get(obj, "swatch"); - - snprintf(buf, PATH_MAX, "swatches/%d/name", i); - eet_write(eet, buf, sw->name, strlen(sw->name), 1); - - snprintf(buf, PATH_MAX, "swatches/%d/hex", i); - hex = elicit_color_rgb_to_hex(sw->r, sw->g, sw->b); - eet_write(eet, buf, hex, strlen(hex), 1); - free(hex); - - i++; - } - - snprintf(buf, PATH_MAX, "%d", i); - eet_write(eet, "swatches/num", buf, strlen(buf), 1); - - eet_close(eet); -} - - -void _elicit_swatches_save_edb(Elicit *el) { +#ifdef HAVE_EDB Evas_List *l; E_DB_File *db; int i = 0; @@ -200,6 +158,7 @@ } e_db_close(db); e_db_flush(); +#endif } void @@ -249,64 +208,10 @@ free(name); } - -void -_elicit_swatches_load_eet(Elicit *el) -{ - Eet_File *eet; - int num = 0; - int i = 0; - char buf[PATH_MAX]; - char *ret = NULL; - int size_ret; - char *name; - int r, g, b; - - snprintf(buf, PATH_MAX, "%s/.e/apps/%s/swatches.eet", getenv("HOME"), el->app_name); - - eet = eet_open(buf, EET_FILE_MODE_READ); - if (!eet) return; - - ret = eet_read(eet, "swatches/num", &size_ret); - if (ret) { - memcpy(buf, ret, size_ret); - buf[size_ret] = '\0'; - num = atoi(buf); - free(ret); - } - - for (i = 0; i < num; i++) - { - Elicit_Swatch *sw; - - snprintf(buf, PATH_MAX, "swatches/%d/name", i); - ret = eet_read(eet, buf, &size_ret); - if (ret) { - memcpy(buf, ret, size_ret); - buf[size_ret] = '\0'; - name = strdup(buf); - free(ret); - } - - snprintf(buf, PATH_MAX, "swatches/%d/hex", i); - ret = eet_read(eet, buf, &size_ret); - if (ret) { - memcpy(buf, ret, size_ret); - buf[size_ret] = '\0'; - elicit_color_hex_to_rgb(buf, &(r), &(g), &(b)); - free(ret); - } - - sw = elicit_swatch_new(el, name, r, g, b); - } - - el->swatches.length = esmart_container_elements_length_get(el->swatches.cont); - eet_close(eet); -} - void _elicit_swatches_load_edb(Elicit *el) { +#ifdef HAVE_EDB E_DB_File *db; int num; int i; @@ -339,6 +244,7 @@ } el->swatches.length = esmart_container_elements_length_get(el->swatches.cont); e_db_close(db); +#endif } void ------------------------------------------------------- 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