恢复设置语言时,通过回调重新加载属性,在流程中过滤不重复加载

This commit is contained in:
gb 2023-06-17 16:11:32 +08:00
parent f04fa05a4e
commit 776541ad77
1 changed files with 5 additions and 3 deletions

View File

@ -532,7 +532,7 @@ hg_sane_middleware::hg_sane_middleware(void) : opt_0_(nullptr), init_ok_(false)
if (lang_get_cur_code_page() != DEFAULT_CODE_PAGE)
lang_refresh_language();
// register_language_changed_notify(&hg_sane_middleware::language_changed, true); - called when reload_option
register_language_changed_notify(&hg_sane_middleware::language_changed, true);
#if !defined(WIN32) && !defined(_WIN64)
char path[512] = { 0 };
@ -1977,7 +1977,8 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "the setting '%s' affects other options value, RELOAD ...\n", desc_title.c_str());
//on_SCANNER_ERR_CONFIGURATION_CHANGED(dev);
reload_options(handle);
if(dev->fixed_id.count(SANE_OPT_ID_LANGUAGE) && dev->fixed_id[SANE_OPT_ID_LANGUAGE] != id) // language reload by callback already
reload_options(handle);
err = (scanner_err)SANE_INFO_RELOAD_OPTIONS;
}
else if(err == SCANNER_ERR_RELOAD_IMAGE_PARAM)
@ -1989,7 +1990,8 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "the setting '%s' affects image parameter and options, APP should re-get image info and reload options...\n", desc_title.c_str());
//on_SCANNER_ERR_CONFIGURATION_CHANGED(dev);
reload_options(handle);
if (dev->fixed_id.count(SANE_OPT_ID_LANGUAGE) && dev->fixed_id[SANE_OPT_ID_LANGUAGE] != id) // language reload by callback already
reload_options(handle);
err = (scanner_err)(SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS);
}
else if (err == SCANNER_ERR_ACCESS_DENIED)