#include <unistd.h>
#include <errno.h>
#include <time.h>
+#include <dlfcn.h>
#include <string.h>
#include <sys/types.h>
#include <fontconfig/fontconfig.h>
-//#include <pkgmgr-info.h>
-
-#include <Elementary.h>
-#include <Evas.h>
-#include <Ecore_Evas.h>
+#include <alarm.h>
#include <pkgmgr-info.h>
#include <system_settings.h>
#include <system_settings_private.h>
+#include <tzplatform_config.h>
+
#ifdef USE_EFL_ASSIST
#include <efl_assist.h>
#endif
-#ifdef TIZEN_WEARABLE
-#define SMALL_FONT_DPI (-90)
-#endif
-#ifdef TIZEN_MOBILE
-#define SMALL_FONT_DPI (-80)
-#endif
-#define MIDDLE_FONT_DPI (-100)
-#ifdef TIZEN_WEARABLE
-#define LARGE_FONT_DPI (-110)
-#endif
-#ifdef TIZEN_MOBILE
-#define LARGE_FONT_DPI (-150)
-#endif
-#define HUGE_FONT_DPI (-190)
-#define GIANT_FONT_DPI (-250)
-
-#define SETTING_FONT_PRELOAD_FONT_PATH "/usr/share/fonts"
-#define SETTING_FONT_DOWNLOADED_FONT_PATH "/opt/share/fonts"
-
-#define SETTING_FONT_CONF_FILE "/opt/etc/fonts/conf.avail/99-slp.conf"
-#define SETTING_DEFAULT_FONT_CONF_FILE "/usr/opt/etc/fonts/conf.avail/99-slp.conf"
+#define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
+#define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
-#define SETTING_STR_LEN 256
-
-#define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
-#define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
+#define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
+#define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
#define SETTING_TZONE_SYMLINK_PATH "/etc/localtime"
-static char *_get_cur_font();
-static void __font_size_set();
-static int __font_size_get();
-static char *_get_default_font();
+int _is_file_accessible(const char *path);
+
+bool dl_is_supported_image_type_load(char *path);
+bool dl_font_config_set(char *font_name);
+char *dl_get_font_info(char *str);
+int dl_is_available_font(char *str);
+void dl_font_size_set();
+void dl_font_config_set_notification();
-static bool font_config_set(char *font_name);
-static void font_config_set_notification();
/**
* VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
* @return the ringtone file path specified by user in normal case
- * if it's not accessable, return the default ringtone path
+ * if it's not accessable, return the default ringtone path
*/
int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
SETTING_TRACE_BEGIN;
- char *font_name = _get_default_font();
+ char *font_name = dl_get_font_info("default");
if (font_name) {
*value = (void *)font_name;
return SYSTEM_SETTINGS_ERROR_NONE;
int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
SETTING_TRACE_BEGIN;
- char *font_name = _get_cur_font();
+ char *font_name = dl_get_font_info("cur");
*value = (void *)font_name;
return SYSTEM_SETTINGS_ERROR_NONE;
SETTING_TRACE("found the file %s", path);
return 0;
} else {
- // error code : 13
+ /* error code : 13 */
SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
- return -errno;
+ return -errno;
}
}
return SYSTEM_SETTINGS_ERROR_NONE;
}
+bool dl_is_supported_image_type_load(char *path)
+{
+ void *handle = NULL;
+ char *error;
+ bool ret = false;
+ bool (*image_type_check)(char *path);
+
+ handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
+
+ image_type_check = dlsym(handle, "__is_supported_image_type_load");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = image_type_check(path);
+ if (handle)
+ dlclose(handle);
+ return ret;
+}
-bool __is_supported_image_type_load(char *path)
+int dl_is_available_font(char *str)
{
- SETTING_TRACE_BEGIN;
- //evas_init();
- ecore_evas_init();
- Ecore_Evas *ee;
- Evas *evas;
+ void *handle = NULL;
+ char *error;
+ int ret = false;
+ int (*check_available_font)(char *font_name);
+
+ handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
+
+ check_available_font = dlsym(handle, "__is_available_font");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = check_available_font(str);
+ if (handle)
+ dlclose(handle);
+ return ret;
+}
- ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL);
- evas = ecore_evas_get(ee);
+void dl_font_size_set()
+{
+ void *handle = NULL;
+ char *error;
+ void (*set_font_size)();
- Evas_Object *img = evas_object_image_add(evas);
- evas_object_image_file_set(img, path, NULL);
- Evas_Load_Error ret = evas_object_image_load_error_get(img);
+ handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return;
+ }
- bool result = false;
- if (ret == EVAS_LOAD_ERROR_NONE) {
- SETTING_TRACE("%s - OK", path);
- result = true;
- } else {
- SETTING_TRACE("%s - NO", path);
- result = false;
+ set_font_size = dlsym(handle, "__font_size_set");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return;
}
- ecore_evas_free(ee);
- evas_shutdown();
- return result;
+ set_font_size();
+ if (handle)
+ dlclose(handle);
+ return;
}
-bool __is_supported_image_type(char *path)
+void dl_font_config_set_notification()
{
- SETTING_TRACE_BEGIN;
+ void *handle = NULL;
+ char *error;
+ void (*set_font_nodification)();
+
+ handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return;
+ }
+
+ set_font_nodification = dlsym(handle, "font_config_set_notification");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return;
+ }
+ set_font_nodification();
+ if (handle)
+ dlclose(handle);
+ return;
+}
+
+bool dl_font_config_set(char *font_name)
+{
+ void *handle = NULL;
+ char *error;
bool ret = false;
+ bool (*check_font_type)(char *font_name);
- evas_init();
- if (evas_object_image_extension_can_load_get(path))
- ret = true;
- else
- ret = false;
+ handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
+
+ check_font_type = dlsym(handle, "font_config_set");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = check_font_type(font_name);
+ if (handle)
+ dlclose(handle);
+ return ret;
+}
+
+char *dl_get_font_info(char *str)
+{
+ void *handle = NULL;
+ char *error;
+ char *ret = NULL;
+ char *(*get_font_info)();
+
+ handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
- evas_shutdown();
+ if (strcmp(str, "cur") == 0)
+ get_font_info = dlsym(handle, "_get_cur_font");
+ else
+ get_font_info = dlsym(handle, "_get_default_font");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = get_font_info();
+ if (handle)
+ dlclose(handle);
return ret;
}
if (!file_path) return false;
int ret = false;
- if (ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED)) {
+ if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
SETTING_TRACE("regular expresstion fail");
return 1;
}
unsigned int temp_image_num = 0;
int image_count = 0;
- if ((dp = opendir("/opt/usr/data/setting/wallpaper")) == NULL) {
+ if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
SETTING_TRACE("opendir error");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
char buf[512];
if (min_image_name) {
- snprintf(buf, sizeof(buf) - 1, "/opt/usr/data/setting/wallpaper/%s", min_image_name);
+ snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
if (remove(buf) < 0) { /* remove oldest image */
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
static int system_setting_check_extended_wallpaper(const char *file_path)
{
+ char buffer[512];
SETTING_TRACE_BEGIN;
if (!file_path || !strlen(file_path))
return 0;
- return (strstr(file_path, "/opt/usr/media/.bgwallpaper") != NULL);
+ snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
+ return (strstr(file_path, buffer) != NULL);
}
#define WALLPAPER_MAX_COUNT 10
char *vconf_value;
vconf_value = (char *)value;
- bool isok = __is_supported_image_type_load(vconf_value);
+ bool isok = dl_is_supported_image_type_load(vconf_value);
if (!isok) {
/* not supported */
SETTING_TRACE("path : %s is not supported file format", vconf_value);
#ifdef TIZEN_WEARABLE
if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
- DIR *dp;
+ DIR *dp = NULL;
struct dirent *dirp;
unsigned int max_image_num = 0;
unsigned int temp_image_num = 0;
int image_count = 0;
- if ((dp = opendir("/opt/usr/data/setting/wallpaper")) == NULL) {
+ if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
SETTING_TRACE("Setting - dir open error!");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
!= SYSTEM_SETTINGS_ERROR_NONE) {
+ if (dp)
+ closedir(dp);
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
image_count++;
}
+ if (dp)
+ closedir(dp);
/* Numbering rule: Gear is odd number */
max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
- : max_image_num + 2;
+ : max_image_num + 2;
char file_name_buffer[512];
snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
- "/opt/usr/data/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
+ _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
- /* Copy image to /opt/usr/data/setting/wallpaper/ */
+ /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
!= SYSTEM_SETTINGS_ERROR_NONE) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
- VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
+ VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
} else {
char *vconf_value;
vconf_value = (char *)value;
- bool isok = __is_supported_image_type_load(vconf_value);
+ bool isok = dl_is_supported_image_type_load(vconf_value);
if (!isok) {
/* not supported */
SETTING_TRACE("path : %s is not supported file format", vconf_value);
if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- __font_size_set();
+ dl_font_size_set();
SETTING_TRACE_END;
return SYSTEM_SETTINGS_ERROR_NONE;
}
cur = cur->xmlChildrenNode;
- Eina_Bool is_changed = EINA_FALSE;
+ bool is_changed = false;
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
cur2 = cur->xmlChildrenNode;
key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
xmlFree(key);
key = NULL;
- is_changed = EINA_TRUE;
+ is_changed = true;
}
cur3 = cur3->next;
}
key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
xmlFree(key);
key = NULL;
- is_changed = EINA_TRUE;
+ is_changed = true;
} else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
cur3 = cur2->xmlChildrenNode;
while (cur3 != NULL) {
key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
xmlFree(key);
key = NULL;
- is_changed = EINA_TRUE;
+ is_changed = true;
cur3 = cur3->next;
return doc;
}
font_name = (char *)value;
/* get current font list */
- int is_found = __is_available_font(font_name);
+ int is_found = dl_is_available_font(font_name);
if (is_found) {
SETTING_TRACE("found font : %s ", font_name);
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- bool bsave = font_config_set(font_name);
+ bool bsave = dl_font_config_set(font_name);
if (!bsave) {
SETTING_TRACE(" font type save error by font_config_set() ");
doc = NULL;
}
- font_config_set_notification();
+ dl_font_config_set_notification();
char *vconf_value;
vconf_value = (char *)value;
int r = 0;
pkgmgrinfo_appinfo_h handle;
- char *apptype = NULL;
r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
if (r != PMINFO_R_OK) {
SETTING_TRACE("*** pkginfo failed ");
return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
}
-static char *_get_cur_font()
-{
- SETTING_TRACE_BEGIN;
- xmlDocPtr doc = NULL;
- xmlNodePtr cur = NULL;
- xmlNodePtr cur2 = NULL;
- xmlNodePtr cur3 = NULL;
- xmlChar *key = NULL;
-
- char *font_name = NULL;
-
- doc = xmlParseFile(SETTING_FONT_CONF_FILE);
-
- cur = xmlDocGetRootElement(doc);
-
- if (cur == NULL) {
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
- }
-
- if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
- }
-
- cur = cur->xmlChildrenNode;
-
- while (cur != NULL) {
- if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
- cur2 = cur->xmlChildrenNode;
- while (cur2 != NULL) {
- if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
- cur3 = cur2->xmlChildrenNode;
- while (cur3 != NULL) {
- if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
- key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
-
- font_name = g_strdup((char *)key);
- xmlFree(key);
- key = NULL;
- xmlFreeDoc(doc);
- doc = NULL;
- return font_name;
- }
- cur3 = cur3->next;
- }
- }
- cur2 = cur2->next;
- }
- }
- cur = cur->next;
- }
-
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
-}
-
-static void font_config_set_notification()
-{
- SETTING_TRACE_BEGIN;
-#if 0
- /* notification */
- Ecore_X_Window ecore_win = ecore_x_window_root_first_get();
- Ecore_X_Atom atom = ecore_x_atom_get("FONT_TYPE_change");
- ecore_x_window_prop_string_set(ecore_win, atom, "tizen");
-#endif
-}
-
-int __is_available_font(char *font_name)
-{
- SETTING_TRACE_BEGIN;
- FcObjectSet *os = NULL;
- FcFontSet *fs = NULL;
- FcPattern *pat = NULL;
- Eina_List *list = NULL;
- FcConfig *font_config = NULL;
-
- int ret = 0;
-
- if (font_name == NULL)
- return -1;
-
- font_config = FcInitLoadConfigAndFonts();
-
- /*setting_retvm_if(font_config == NULL, NULL, "Failed: FcInitLoadConfigAndFonts"); */
-
- char *locale = setlocale(0, NULL);
-
- pat = FcPatternCreate();
-
- os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_FAMILYLANG, (char *) 0);
-
- if (os) {
- fs = FcFontList(font_config, pat, os);
- FcObjectSetDestroy(os);
- os = NULL;
- }
-
- if (pat) {
- FcPatternDestroy(pat);
- pat = NULL;
- }
-
- if (fs) {
- int j;
- SETTING_TRACE("fs->nfont = %d", fs->nfont);
-
- for (j = 0; j < fs->nfont; j++) {
- FcChar8 *family = NULL;
- FcChar8 *file = NULL;
-
- if (FcPatternGetString(fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch) {
- int preload_path_len = strlen(SETTING_FONT_PRELOAD_FONT_PATH);
- int download_path_len = strlen(SETTING_FONT_DOWNLOADED_FONT_PATH);
-
- if (file && (!strncmp((const char *)file, SETTING_FONT_PRELOAD_FONT_PATH, preload_path_len)
- || !strncmp((const char *)file, SETTING_FONT_DOWNLOADED_FONT_PATH, download_path_len))) {
- char *family_result = NULL;
- FcChar8 *lang = NULL;
- int id = 0;
- if (FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) {
- break;
- }
- if (FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) {
- break;
- }
- family_result = (char *)family;
-
- /* Find proper family name for current locale. */
- while (locale && family && lang) {
- if (!strncmp(locale, (char *)lang, strlen((char *)lang))) {
- family_result = (char *)family;
- break;
- }
-
- /* I will set english as default family language. */
- /* If there is no proper family language for current locale, */
- /* we have to show the english family name. */
- if (!strcmp(lang, "en")) {
- family_result = (char *)family;
- }
- id++;
- if (FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) {
- break;
- }
- if (FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) {
- break;
- }
- }
-
- if (family_result) {
- SETTING_TRACE("-------- FONT - family_result = %s", (char *)family_result);
- if (strcmp(family_result, font_name) == 0) {
- ret = 1;
- break;
- }
- }
- }
- }
- }
- FcFontSetDestroy(fs);
- fs = NULL;
- }
- FcConfigDestroy(font_config);
- font_config = NULL;
- return ret;
-}
-
-
-static char *_get_default_font()
-{
- SETTING_TRACE_BEGIN;
- xmlDocPtr doc = NULL;
- xmlNodePtr cur = NULL;
- xmlNodePtr cur2 = NULL;
- xmlNodePtr cur3 = NULL;
- xmlChar *key = NULL;
- struct _xmlAttr *properties = NULL;
- char *default_font_name = NULL;
-
- doc = xmlParseFile(SETTING_DEFAULT_FONT_CONF_FILE);
-
- cur = xmlDocGetRootElement(doc);
-
- if (cur == NULL) {
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
- }
-
- if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
- }
-
- cur = cur->xmlChildrenNode;
-
- while (cur != NULL) {
- if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
- cur2 = cur->xmlChildrenNode;
- while (cur2 != NULL) {
- if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
- properties = cur2->properties;
- /*find the "name" property*/
- while (NULL != properties) {
- if (!xmlStrcmp(properties->name, (const xmlChar *)"name")) {
- break;
- }
- properties = properties->next;
- }
-
- /*If the value of "name" property is "family", then get the child node string,
- it shall be the default font type*/
- if (NULL != properties && !xmlStrcmp(properties->children->content, (const xmlChar *)"family")) {
- cur3 = cur2->xmlChildrenNode;
- while (cur3 != NULL) {
- if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
- key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
- default_font_name = g_strdup((char *)key);
- xmlFree(key);
- key = NULL;
- xmlFreeDoc(doc);
- doc = NULL;
- return default_font_name;
- }
- cur3 = cur3->next;
- }
- }
- }
- cur2 = cur2->next;
- }
- }
- cur = cur->next;
- }
-
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
-}
-
-static bool font_config_set(char *font_name)
-{
- SETTING_TRACE_BEGIN;
- Eina_List *text_classes = NULL;
- Elm_Text_Class *etc = NULL;
- const Eina_List *l = NULL;
- Eina_List *fo_list = NULL;
- Elm_Font_Overlay *efo = NULL;
-
- int font_size = __font_size_get();
- int size = 0;
-
- text_classes = elm_config_text_classes_list_get();
-
- fo_list = (Eina_List *)elm_config_font_overlay_list_get();
-
- Eina_List *ll = NULL;
- Eina_List *l_next = NULL;
-
- Eina_Bool slp_medium_exist = EINA_FALSE;
- Eina_Bool slp_roman_exist = EINA_FALSE;
- Eina_Bool slp_bold_exist = EINA_FALSE;
- Eina_Bool slp_regular_exist = EINA_FALSE;
-
- /* Tizen */
- Eina_Bool tizen_exist = EINA_FALSE;
-
- EINA_LIST_FOREACH_SAFE(fo_list, ll, l_next, efo) {
- if (!strcmp(efo->text_class, "tizen_medium")) {
- elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
- slp_medium_exist = EINA_TRUE;
- } else if (!strcmp(efo->text_class, "tizen_roman")) {
- elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
- slp_roman_exist = EINA_TRUE;
- } else if (!strcmp(efo->text_class, "tizen_bold")) {
- elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
- slp_bold_exist = EINA_TRUE;
- } else if (!strcmp(efo->text_class, "tizen_regular")) {
- elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
- slp_regular_exist = EINA_TRUE;
- }
-
- /* Tizen */
- if (!strcmp(efo->text_class, "tizen")) {
- elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
- tizen_exist = EINA_TRUE;
- }
-
- }
-
- /* if slp_XX do not exist, need to set them, font size is -100(100%) */
- if (slp_medium_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_medium", (const char *)font_name, MIDDLE_FONT_DPI);
- }
- if (slp_roman_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_roman", (const char *)font_name, MIDDLE_FONT_DPI);
- }
- if (slp_bold_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_bold", (const char *)font_name, MIDDLE_FONT_DPI);
- }
- if (slp_regular_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_regular", (const char *)font_name, MIDDLE_FONT_DPI);
- }
-
- /* Tizen */
- if (tizen_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen", (const char *)font_name, MIDDLE_FONT_DPI);
- }
-
- elm_config_font_overlay_set("tizen", (const char *)font_name, MIDDLE_FONT_DPI);
-
- /* Tizen */
- elm_config_font_overlay_set("tizen", (const char *)font_name, MIDDLE_FONT_DPI);
-
- EINA_LIST_FOREACH(text_classes, l, etc) {
- ll = NULL;
-
- size = font_size;
- EINA_LIST_FOREACH(fo_list, ll, efo) {
- if (!strcmp(etc->name, efo->text_class)) {
- size = efo->size;
- }
- }
- elm_config_font_overlay_set(etc->name, (const char *)font_name, size);
- }
- elm_config_text_classes_list_free(text_classes);
- text_classes = NULL;
-
- /* add new function */
-#ifdef USE_EFL_ASSIST
- ea_theme_system_font_set(font_name, font_size);
- ea_theme_system_fonts_apply();
-#endif
-
- elm_config_font_overlay_apply();
- elm_config_all_flush();
- elm_config_save();
- return 1;
-}
-
-static void __font_size_set()
-{
- SETTING_TRACE_BEGIN;
- Eina_List *text_classes = NULL;
- Elm_Text_Class *etc = NULL;
- const Eina_List *l = NULL;
- int font_size = __font_size_get();
- char *font_name = _get_cur_font();
-
- if (font_size == -1) {
- return;
- }
-
- text_classes = elm_config_text_classes_list_get();
-
- EINA_LIST_FOREACH(text_classes, l, etc) {
- elm_config_font_overlay_set(etc->name, font_name, font_size);
- }
-
- elm_config_text_classes_list_free(text_classes);
-
-#ifdef USE_EFL_ASSIST
- ea_theme_system_font_set(font_name, font_size);
- ea_theme_system_fonts_apply();
-#endif
-
- elm_config_font_overlay_apply();
- elm_config_all_flush();
- elm_config_save();
-
- text_classes = NULL;
- g_free(font_name);
-}
-
-static int __font_size_get()
-{
- SETTING_TRACE_BEGIN;
- int font_size = -1;
- int err = -1;
-
- int vconf_value = -1;
- if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
- return -1;
- }
-
- switch (vconf_value) {
- case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
- font_size = SMALL_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
- font_size = MIDDLE_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
- font_size = LARGE_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
- font_size = HUGE_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
- font_size = GIANT_FONT_DPI;
- break;
- default:
- font_size = MIDDLE_FONT_DPI;
- break;
- }
- return font_size;
-}
-
/*//////////////////////////////////////////////////////////////////////////////////////// */
/*--------------------------------------- */
int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
/* parsing validation */
/* en_US.UTF-8 */
char arr[20];
- snprintf(arr, 20, vconf_value);
+ snprintf(arr, 20, "%s", vconf_value);
arr[5] = '\0';
*value = strdup(arr);
free(vconf_value);
/* parsing validation */
/* en_US.UTF-8 */
char arr[20];
- snprintf(arr, 20, vconf_value);
+ snprintf(arr, 20, "%s", vconf_value);
arr[5] = '\0';
*value = strdup(arr);
free(vconf_value);
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- bool ret_value;
+ bool ret_value = true;
if (vconf_value == VCONFKEY_TIME_FORMAT_12)
ret_value = false;
else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
SETTING_TRACE_BEGIN;
-#if 0
- char tzpath[256];
- ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
- if (len != -1) {
- tzpath[len] = '\0';
- } else {
- SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- /* "/usr/share/zoneinfo/Asia/Seoul" */
- SETTING_TRACE("tzpath : %s ", &tzpath[20]);
- *value = strdup(&tzpath[20]);
-#else
*value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
-#endif
return SYSTEM_SETTINGS_ERROR_NONE;
}
+int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ vconf_value = (char *)value;
+
+ char tz_path[1024];
+ snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", vconf_value);
+
+ int is_load = _is_file_accessible(tz_path);
+ if (is_load == 0) {
+ alarmmgr_set_timezone(tz_path);
+
+ if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+ }
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+}
+
+
+
+int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
+}
+
+int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
+{
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
+}
+
int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
{
SETTING_TRACE_BEGIN;