From d9dc860f6ed4ffae7a264be0086efdd7865f6965 Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Thu, 8 Dec 2016 21:42:21 +0900 Subject: [PATCH] config: update config data for processes which are launched before lazy mounting @tizen_only Change-Id: Ib4f256860854a9f6f5e72b15377b3b7b01f39b51 --- src/lib/elm_config.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index 26b1043..ae6f773 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -139,6 +139,10 @@ static void _color_overlays_cancel(void); #define TIZEN_UNMOUNT_FALLBACK_BASE_DIR "/opt" // END +/* TIZEN_ONLY(20161208): update config data for processes which are launched before lazy mounting */ +typedef size_t (*Elm_Config_Snprintf_Func)(char *dst, size_t size, const char *fmt, ...); +/* END */ + static void _elm_font_overlays_del_free(void) { @@ -588,6 +592,26 @@ _user_data_path_mounted() return ecore_file_is_dir(TIZEN_MOUNT_CHECK_PATH); } //END + +/* TIZEN_ONLY(20161208): update config data for processes which are launched before lazy mounting */ +size_t +_elm_config_user_fallback_dir_snprintf(char *dst, size_t size, const char *fmt, ...) +{ + size_t user_dir_len = 0, off = 0; + va_list ap; + + user_dir_len = _elm_config_user_fallback_dir(dst, size); + off = user_dir_len + 1; + if (off >= size) return off; + dst[user_dir_len] = '/'; + va_start(ap, fmt); + off += vsnprintf(dst + off, size - off, fmt, ap); + va_end(ap); + + return off; +} +/* END */ + size_t _elm_config_user_dir_snprintf(char *dst, size_t size, @@ -1989,8 +2013,13 @@ err: return EINA_FALSE; } +/* TIZEN_ONLY(20161208): update config data for processes which are launched before lazy mounting Eina_Bool _elm_config_save(Elm_Config *cfg, const char *profile) + */ +Eina_Bool +_elm_config_save_internal(Elm_Config *cfg, const char *profile, Elm_Config_Snprintf_Func snprintf_func) +/* END */ { char buf[4096], buf2[4096]; int ok = 0, ret; @@ -1998,7 +2027,11 @@ _elm_config_save(Elm_Config *cfg, const char *profile) Eet_File *ef; size_t len; + /* TIZEN_ONLY(20161208): update config data for processes which are launched before lazy mounting len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/"); + */ + len = snprintf_func(buf, sizeof(buf), "themes/"); + /* END */ if (len + 1 >= sizeof(buf)) return EINA_FALSE; @@ -2010,8 +2043,13 @@ _elm_config_save(Elm_Config *cfg, const char *profile) return EINA_FALSE; } + /* TIZEN_ONLY(20161208): update config data for processes which are launched before lazy mounting len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", profile ? profile : _elm_profile); + */ + len = snprintf_func(buf, sizeof(buf), "config/%s", + profile ? profile : _elm_profile); + /* END */ if (len + 1 >= sizeof(buf)) return EINA_FALSE; @@ -2075,6 +2113,19 @@ err: return EINA_FALSE; } +/* TIZEN_ONLY(20161208): update config data for processes which are launched before lazy mounting */ +Eina_Bool +_elm_config_save(Elm_Config *cfg, const char *profile) +{ + Eina_Bool ret = EINA_TRUE; + + ret &= _elm_config_save_internal(cfg, profile, _elm_config_user_dir_snprintf); + ret &= _elm_config_save_internal(cfg, profile, _elm_config_user_fallback_dir_snprintf); + + return ret; +} +/* END */ + // TIZEN_ONLY(20150705): Genlist item align feature void _elm_config_scroll_item_valign_set(const char *scroll_item_valign) -- 2.7.4