From ca73c0ff588857e40e870ca3d83546fd75a9a7c5 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 8 Feb 2005 03:51:08 +0000 Subject: [PATCH] only save config when/if it changes, not always... and fix module data dir... SVN revision: 13236 --- src/bin/e_config.c | 14 +++++++++++++- src/bin/e_config.h | 1 + src/bin/e_main.c | 5 +++-- src/bin/e_module.c | 9 +++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/bin/e_config.c b/src/bin/e_config.c index f52d7c928..79d97d8a4 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -142,6 +142,7 @@ e_config_init(void) eb->action = E_BINDING_ACTION_MENU; e_config->bindings = evas_list_append(e_config->bindings, eb); } + e_config_save_queue(); } E_CONFIG_LIMIT(e_config->menus_scroll_speed, 1.0, 20000.0); @@ -198,6 +199,17 @@ e_config_save(void) return e_config_domain_save("e", _e_config_edd, e_config); } +void +e_config_save_flush(void) +{ + if (_e_config_save_job) + { + ecore_job_del(_e_config_save_job); + _e_config_save_job = NULL; + e_config_domain_save("e", _e_config_edd, e_config); + } +} + void e_config_save_queue(void) { @@ -250,8 +262,8 @@ e_config_domain_save(char *domain, E_Config_DD *edd, void *data) static void _e_config_save_cb(void *data) { + printf("SAVE!!!!\n"); e_module_save_all(); - e_config_domain_save("e", _e_config_edd, e_config); _e_config_save_job = NULL; } diff --git a/src/bin/e_config.h b/src/bin/e_config.h index c0a30f509..cff4ff352 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -87,6 +87,7 @@ EAPI void *e_config_domain_load(char *domain, E_Config_DD *edd); EAPI int e_config_domain_save(char *domain, E_Config_DD *edd, void *data); EAPI int e_config_save(void); +EAPI void e_config_save_flush(void); EAPI void e_config_save_queue(void); extern EAPI E_Config *e_config; diff --git a/src/bin/e_main.c b/src/bin/e_main.c index cb3a5a0e3..e54ecb34d 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -320,8 +320,9 @@ main(int argc, char **argv) ecore_main_loop_begin(); /* ask all modules to save their config and then shutdown */ - e_module_save_all(); - e_config_save(); + /* NB: no need to do this as config shutdown will flush any saves */ + /* and all changed config was already saved before */ + e_config_save_flush(); e_module_shutdown(); /* unroll our stack of shutdown functions with exit code of 0 */ diff --git a/src/bin/e_module.c b/src/bin/e_module.c index 973627211..b0e576669 100644 --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@ -78,7 +78,7 @@ e_module_new(char *name) { E_Module *m; char buf[4096]; - char *modpath; + char *modpath, *s; Evas_List *l; int in_list = 0; @@ -140,7 +140,12 @@ e_module_new(char *name) } _e_modules = evas_list_append(_e_modules, m); m->name = strdup(name); - m->dir = e_file_get_dir(modpath); + s = e_file_get_dir(modpath); + if (s) + { + m->dir = e_file_get_dir(s); + free(s); + } m->func.info(m); for (l = e_config->modules; l; l = l->next) {