From a437b5202a8cfe2e08ebe7d336b3fe550979587b Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 24 Jul 2017 13:22:19 +0100 Subject: [PATCH] config: Be less notification-happy when saving Let's not force all our editors to reload when we don't have to! --- src/bin/edi_config.c | 32 +++++++++++++-------------- src/bin/edi_private.h | 2 ++ src/bin/mainview/edi_mainview_panel.c | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/bin/edi_config.c b/src/bin/edi_config.c index f1fcaa7..d108830 100644 --- a/src/bin/edi_config.c +++ b/src/bin/edi_config.c @@ -342,8 +342,8 @@ _edi_config_load(void) void _edi_config_save(void) { - if (_edi_config_domain_save(_edi_config_dir_get(), EDI_CONFIG_NAME, _edi_cfg_edd, _edi_config)) - ecore_event_add(EDI_EVENT_CONFIG_CHANGED, NULL, NULL, NULL); + if (!_edi_config_domain_save(_edi_config_dir_get(), EDI_CONFIG_NAME, _edi_cfg_edd, _edi_config)) + ERR("Could not save configuration"); } void @@ -414,6 +414,19 @@ _edi_config_mime_search(const char *mime) return NULL; } +Eina_Bool +_edi_project_config_save_no_notify() +{ + return _edi_config_domain_save(_edi_project_config_dir_get(), EDI_PROJECT_CONFIG_NAME, _edi_proj_cfg_edd, _edi_project_config); +} + +void +_edi_project_config_save() +{ + if (_edi_project_config_save_no_notify()) + ecore_event_add(EDI_EVENT_CONFIG_CHANGED, NULL, NULL, NULL); +} + void _edi_project_config_load() { @@ -487,20 +500,7 @@ _edi_project_config_load() _edi_project_config->version = EDI_PROJECT_CONFIG_FILE_VERSION; - if (save) _edi_project_config_save(); -} - -static Eina_Bool -_edi_project_config_save_no_notify() -{ - return _edi_config_domain_save(_edi_project_config_dir_get(), EDI_PROJECT_CONFIG_NAME, _edi_proj_cfg_edd, _edi_project_config); -} - -void -_edi_project_config_save() -{ - if (_edi_project_config_save_no_notify()) - ecore_event_add(EDI_EVENT_CONFIG_CHANGED, NULL, NULL, NULL); + if (save) _edi_project_config_save_no_notify(); } void diff --git a/src/bin/edi_private.h b/src/bin/edi_private.h index 470cdf7..2b7cfbc 100644 --- a/src/bin/edi_private.h +++ b/src/bin/edi_private.h @@ -45,4 +45,6 @@ Eina_Bool edi_noproject(); void edi_launcher_config_missing(); +Eina_Bool _edi_project_config_save_no_notify(void); + #endif diff --git a/src/bin/mainview/edi_mainview_panel.c b/src/bin/mainview/edi_mainview_panel.c index 0c28357..e558d32 100644 --- a/src/bin/mainview/edi_mainview_panel.c +++ b/src/bin/mainview/edi_mainview_panel.c @@ -242,7 +242,7 @@ edi_mainview_panel_item_select(Edi_Mainview_Panel *panel, Edi_Mainview_Item *ite evas_object_geometry_get(item->tab, NULL, NULL, &tabw, NULL); elm_scroller_region_bring_in(panel->tabs, region_x, 0, tabw, 0); _edi_project_config->current_tab = edi_mainview_panel_item_current_tab_get(panel); - _edi_project_config_save(); + _edi_project_config_save_no_notify(); } ecore_event_add(EDI_EVENT_TAB_CHANGED, NULL, NULL, NULL);