only save config when/if it changes, not always... and fix module data dir...

SVN revision: 13236
This commit is contained in:
Carsten Haitzler 2005-02-08 03:51:08 +00:00
parent 6aebc52d48
commit ca73c0ff58
4 changed files with 24 additions and 5 deletions

View File

@ -142,6 +142,7 @@ e_config_init(void)
eb->action = E_BINDING_ACTION_MENU; eb->action = E_BINDING_ACTION_MENU;
e_config->bindings = evas_list_append(e_config->bindings, eb); 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); 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); 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 void
e_config_save_queue(void) e_config_save_queue(void)
{ {
@ -250,8 +262,8 @@ e_config_domain_save(char *domain, E_Config_DD *edd, void *data)
static void static void
_e_config_save_cb(void *data) _e_config_save_cb(void *data)
{ {
printf("SAVE!!!!\n");
e_module_save_all(); e_module_save_all();
e_config_domain_save("e", _e_config_edd, e_config); e_config_domain_save("e", _e_config_edd, e_config);
_e_config_save_job = NULL; _e_config_save_job = NULL;
} }

View File

@ -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_domain_save(char *domain, E_Config_DD *edd, void *data);
EAPI int e_config_save(void); EAPI int e_config_save(void);
EAPI void e_config_save_flush(void);
EAPI void e_config_save_queue(void); EAPI void e_config_save_queue(void);
extern EAPI E_Config *e_config; extern EAPI E_Config *e_config;

View File

@ -320,8 +320,9 @@ main(int argc, char **argv)
ecore_main_loop_begin(); ecore_main_loop_begin();
/* ask all modules to save their config and then shutdown */ /* ask all modules to save their config and then shutdown */
e_module_save_all(); /* NB: no need to do this as config shutdown will flush any saves */
e_config_save(); /* and all changed config was already saved before */
e_config_save_flush();
e_module_shutdown(); e_module_shutdown();
/* unroll our stack of shutdown functions with exit code of 0 */ /* unroll our stack of shutdown functions with exit code of 0 */

View File

@ -78,7 +78,7 @@ e_module_new(char *name)
{ {
E_Module *m; E_Module *m;
char buf[4096]; char buf[4096];
char *modpath; char *modpath, *s;
Evas_List *l; Evas_List *l;
int in_list = 0; int in_list = 0;
@ -140,7 +140,12 @@ e_module_new(char *name)
} }
_e_modules = evas_list_append(_e_modules, m); _e_modules = evas_list_append(_e_modules, m);
m->name = strdup(name); 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); m->func.info(m);
for (l = e_config->modules; l; l = l->next) for (l = e_config->modules; l; l = l->next)
{ {