Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_config.c e_widget_fsel.c Log Message: config wites are atomic - either all or nothing. if nothing - u keep your old config. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_config.c,v retrieving revision 1.189 retrieving revision 1.190 diff -u -3 -r1.189 -r1.190 --- e_config.c 14 Aug 2006 11:08:40 -0000 1.189 +++ e_config.c 15 Aug 2006 06:47:22 -0000 1.190 @@ -15,7 +15,7 @@ static int _e_config_save_cb(void *data); static void _e_config_free(void); static int _e_config_cb_timer(void *data); -static void _e_config_eet_close_handle(Eet_File *ef, char *file); +static int _e_config_eet_close_handle(Eet_File *ef, char *file); /* local subsystem globals */ static int _e_config_save_block = 0; @@ -1496,7 +1496,7 @@ e_config_profile_save(void) { Eet_File *ef; - char buf[4096]; + char buf[4096], buf2[4096]; char *homedir; int ok = 0; @@ -1504,14 +1504,18 @@ homedir = e_user_homedir_get(); snprintf(buf, sizeof(buf), "%s/.e/e/config/profile.cfg", homedir); + snprintf(buf2, sizeof(buf2), "%s.tmp", buf); free(homedir); - ef = eet_open(buf, EET_FILE_MODE_WRITE); + ef = eet_open(buf2, EET_FILE_MODE_WRITE); if (ef) { ok = eet_write(ef, "config", _e_config_profile, strlen(_e_config_profile), 0); - _e_config_eet_close_handle(ef, buf); + if (_e_config_eet_close_handle(ef, buf2)) + ecore_file_mv(buf2, buf); + else + ecore_file_unlink(buf2); } return ok; } @@ -1520,7 +1524,7 @@ e_config_domain_save(char *domain, E_Config_DD *edd, void *data) { Eet_File *ef; - char buf[4096]; + char buf[4096], buf2[4096]; char *homedir; int ok = 0; @@ -1532,12 +1536,16 @@ ecore_file_mkpath(buf); snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/%s.cfg", homedir, _e_config_profile, domain); + snprintf(buf2, sizeof(buf2), "%s.tmp", buf); E_FREE(homedir); ef = eet_open(buf, EET_FILE_MODE_WRITE); if (ef) { ok = eet_data_write(ef, edd, "config", data, 1); - _e_config_eet_close_handle(ef, buf); + if (_e_config_eet_close_handle(ef, buf2)) + ecore_file_mv(buf2, buf); + else + ecore_file_unlink(buf2); } return ok; } @@ -1860,7 +1868,7 @@ return 0; } -static void +static int _e_config_eet_close_handle(Eet_File *ef, char *file) { Eet_Error err; @@ -1935,5 +1943,7 @@ ecore_file_unlink(file); e_util_dialog_show(_("Enlightenment Configration Write Problems"), erstr, file); + return 0; } + return 1; } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_fsel.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_widget_fsel.c 15 Aug 2006 01:43:00 -0000 1.14 +++ e_widget_fsel.c 15 Aug 2006 06:47:22 -0000 1.15 @@ -172,7 +172,7 @@ } wd->path = strdup(buf); if (wd->preview) - _e_wid_fsel_preview_file(wd); + _e_wid_fsel_preview_file(wd); e_widget_entry_text_set(wd->o_entry, ici->file); evas_list_free(selected); if (wd->chg_func) wd->chg_func(wd->chg_data, wd->obj); @@ -194,7 +194,8 @@ EAPI Evas_Object * e_widget_fsel_add(Evas *evas, char *dev, char *path, char *selected, char *filter, void (*sel_func) (void *data, Evas_Object *obj), void *sel_data, - void (*chg_func) (void *data, Evas_Object *obj), void *chg_data, int preview) + void (*chg_func) (void *data, Evas_Object *obj), void *chg_data, + int preview) { Evas_Object *obj, *o; E_Widget_Data *wd; ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs