diff options
author | Ji-hoon Lee <dalton.lee@samsung.com> | 2018-04-04 15:05:57 +0900 |
---|---|---|
committer | Ji-hoon Lee <dalton.lee@samsung.com> | 2018-04-04 17:31:15 +0900 |
commit | 4959a8115a878fc34a8a65b32f6944dfcdf2e5ef (patch) | |
tree | ab68855193c4ba7596c6f8c5a3819c60be7a99fe /ism/extras | |
parent | 76311a5e7b9f305962482053b357272ec4f84b04 (diff) | |
download | isf-4959a8115a878fc34a8a65b32f6944dfcdf2e5ef.tar.gz isf-4959a8115a878fc34a8a65b32f6944dfcdf2e5ef.tar.bz2 isf-4959a8115a878fc34a8a65b32f6944dfcdf2e5ef.zip |
Extract function for restoring global config
Change-Id: I3474bf1f50f5dd30cd69e65b0e1dedfd5a0c0cda
Diffstat (limited to 'ism/extras')
-rw-r--r-- | ism/extras/efl_panel/isf_panel_efl.cpp | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index be60ad60..473822f3 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -7524,6 +7524,32 @@ static Eina_Bool x_event_window_focus_out_cb (void *data, int ev_type, void *eve } #endif +static void restore_config () +{ + if (!_config.null ()) { + String uuid = _initial_ise_uuid; + + String global_uuid = scim_global_config_read (String(SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String("")); + if (global_uuid.length () > 0) uuid = global_uuid; + + String default_uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String("")); + if (default_uuid.length() > 0) uuid = default_uuid; + + if (global_uuid.length() == 0) { + scim_global_config_write (String(SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), uuid); + } + if (default_uuid.length() == 0) { + _config->write (SCIM_CONFIG_DEFAULT_HELPER_ISE, uuid); + } + + scim_global_config_flush (); + _config->flush(); + + scim_global_config_reload (); + _config->reload (); + } +} + /** * @brief : Launches default soft keyboard for performance enhancement (It's not mandatory) */ @@ -7531,19 +7557,16 @@ static void launch_default_soft_keyboard (keynode_t *key, void* data) { SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; - String helper_uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String("")); + String helper_uuid; + if (!_config.null()) { + helper_uuid = _config->read(SCIM_CONFIG_DEFAULT_HELPER_ISE, String("")); + } if (helper_uuid.length () > 0) { /* Start default ISE */ change_keyboard_mode (TOOLBAR_HELPER_MODE); } else { set_temporary_ise (_initial_ise_uuid); - if (!_config.null()) { - scim_global_config_write(String(SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), _initial_ise_uuid); - scim_global_config_flush(); - - _config->flush(); - _config->reload(); - } + restore_config(); } } @@ -7584,9 +7607,7 @@ static Eina_Bool monitor_user_data_path_timer(void *data) LOGW ("'%s' exists : %d, is_dir : %d", path, (user_data_path_exists ? 1 : 0), (user_data_path_is_dir ? 1 : 0)); - /* Flush config before reloading */ - scim_global_config_flush (); - scim_global_config_reload (); + scim_global_config_reload (true); load_config (); @@ -7602,8 +7623,11 @@ static Eina_Bool monitor_user_data_path_timer(void *data) launch = false; } String default_ise_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), _initial_ise_uuid); + set_active_ise (default_ise_uuid, launch); + restore_config (); + g_monitor_user_data_path_timer = NULL; return ECORE_CALLBACK_CANCEL; } |