Update font initiate code.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 26 Jun 2013 04:32:12 +0000 (13:32 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 26 Jun 2013 04:32:12 +0000 (13:32 +0900)
[model] Redwood
[binary_type] AP
[customer] Docomo/Orange/Open
[issue#] N/A
[problem] Initial font is not able to get using vconf.
[cause] vconf doesn't care the first system font
[solution] Get the first font using system_settings API only once.
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I506a6e5554e67cbdf6703ffe4b09eb14316e6123

icon_src/main.c
packaging/com.samsung.data-provider-slave.spec
src/main.c

index 6662763..73d3ca2 100644 (file)
@@ -41,6 +41,8 @@
 #include <livebox-errno.h>
 #include <provider.h>
 
+#include <system_settings.h>
+
 #include <packet.h>
 #include <com-core.h>
 #include <com-core_packet.h>
@@ -423,22 +425,30 @@ static void font_changed_cb(keynode_t *node, void *user_data)
 {
        char *font_name;
 
-       font_name = vconf_get_str("db/setting/accessibility/font_name");
-       if (!font_name) {
-               ErrPrint("Invalid font name (NULL)\n");
-               return;
-       }
+       if (s_info.font_name) {
+               font_name = vconf_get_str("db/setting/accessibility/font_name");
+               if (!font_name) {
+                       ErrPrint("Invalid font name (NULL)\n");
+                       return;
+               }
 
-       if (s_info.font_name && !strcmp(s_info.font_name, font_name)) {
-               DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
-               free(font_name);
-               return;
-       }
+               if (!strcmp(s_info.font_name, font_name)) {
+                       DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
+                       free(font_name);
+                       return;
+               }
 
-       if (s_info.font_name) {
                DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
                free(s_info.font_name);
-               s_info.font_name = NULL;
+       } else {
+               int ret;
+
+               font_name = NULL;
+               ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
+               if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
+                       ErrPrint("system settings: %d, font_name[%p]\n", ret, font_name);
+                       return;
+               }
        }
 
        s_info.font_name = font_name;
@@ -485,6 +495,7 @@ static void app_terminate(void *data)
        client_fini();
 
        free(s_info.font_name);
+       s_info.font_name = NULL;
        return;
 }
 
index f68e281..24617f5 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: com.samsung.data-provider-slave
 Summary: Plugin type livebox service provider.
-Version: 0.11.9
+Version: 0.11.10
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 6ce3160..de77d0b 100644 (file)
@@ -102,22 +102,30 @@ static void font_changed_cb(keynode_t *node, void *user_data)
 {
        char *font_name;
 
-       font_name = vconf_get_str("db/setting/accessibility/font_name");
-       if (!font_name) {
-               ErrPrint("Invalid font name (NULL)\n");
-               return;
-       }
+       if (s_info.font_name) {
+               font_name = vconf_get_str("db/setting/accessibility/font_name");
+               if (!font_name) {
+                       ErrPrint("Invalid font name (NULL)\n");
+                       return;
+               }
 
-       if (s_info.font_name && !strcmp(s_info.font_name, font_name)) {
-               DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
-               free(font_name);
-               return;
-       }
+               if (!strcmp(s_info.font_name, font_name)) {
+                       DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
+                       free(font_name);
+                       return;
+               }
 
-       if (s_info.font_name) {
                DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
                free(s_info.font_name);
-               s_info.font_name = NULL;
+       } else {
+               int ret;
+
+               font_name = NULL;
+               ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
+               if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
+                       ErrPrint("System settings: %d, font_name[%p]\n", ret, font_name);
+                       return;
+               }
        }
 
        s_info.font_name = font_name;
@@ -193,7 +201,6 @@ static void time_changed_cb(keynode_t *node, void *user_data)
 static bool app_create(void *data)
 {
        int ret;
-       int size = DEFAULT_FONT_SIZE;
 
        DbgPrint("Scale factor: %lf\n", elm_config_scale_get());
 
@@ -232,15 +239,8 @@ static bool app_create(void *data)
        ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb, NULL);
        DbgPrint("MMC status changed event callback added: %d\n", ret);
 
-       s_info.font_name = vconf_get_str("db/setting/accessibility/font_name");
-       DbgPrint("Current font is [%s]\n", s_info.font_name);
-
-       ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size);
-       DbgPrint("Current font size get: %d\n", ret);
-
-       s_info.font_size = convert_font_size(size);
-       DbgPrint("Current font size: %d\n", s_info.font_size);
-
+       font_changed_cb(NULL, NULL);
+       font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
        return TRUE;
 }
 
@@ -275,6 +275,8 @@ static void app_terminate(void *data)
        ret = livebox_service_fini();
        DbgPrint("livebox service fini: %d\n", ret);
 
+       free(s_info.font_name);
+       s_info.font_name = NULL;
        return;
 }