config: Be less notification-happy when saving

Let's not force all our editors to reload when we don't have to!
This commit is contained in:
Andy Williams 2017-07-24 13:22:19 +01:00
parent be333dee6f
commit a437b5202a
3 changed files with 19 additions and 17 deletions

View File

@ -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

View File

@ -45,4 +45,6 @@ Eina_Bool edi_noproject();
void edi_launcher_config_missing();
Eina_Bool _edi_project_config_save_no_notify(void);
#endif

View File

@ -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);