config: update config data for processes which are launched before lazy mounting 10/103510/4 accepted/tizen/3.0/common/20161212.060801 accepted/tizen/3.0/ivi/20161212.024005 accepted/tizen/3.0/mobile/20161212.024216 accepted/tizen/3.0/tv/20161212.024402 accepted/tizen/3.0/wearable/20161212.024454 accepted/tizen/ivi/20161212.023703 accepted/tizen/mobile/20161212.023250 accepted/tizen/tv/20161212.023522 accepted/tizen/wearable/20161212.023549 submit/tizen/20150127.011226 submit/tizen_3.0/20161211.083148
authorYoungbok Shin <youngb.shin@samsung.com>
Thu, 8 Dec 2016 12:42:21 +0000 (21:42 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Sun, 11 Dec 2016 05:15:59 +0000 (21:15 -0800)
@tizen_only

Change-Id: Ib4f256860854a9f6f5e72b15377b3b7b01f39b51

src/lib/elm_config.c

index 26b1043..ae6f773 100644 (file)
@@ -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)