2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 * Created on: Nov 21, 2013
26 #include <unicode/unum.h>
31 char *setting_gettext(const char *s)
33 /* fisrt find in app pg */
39 char *p = dgettext(SETTING_PACKAGE, s);
41 if (!strcmp(s, p)) { /* not found */
42 /* find in system pkg */
43 p = dgettext(SYSTEM_PACKAGE, s);
48 char *replace(char *str, char *orig, char *repl)
50 static char buffer[124];
52 if (!(ch = strstr(str, orig))) {
55 strncpy(buffer, str, ch - str);
57 sprintf(buffer + (ch - str), "%s%s", repl, ch + strlen(orig));
62 void setting_popup_back_cb(void *data, Evas_Object *obj, void *event_info)
64 appdata *ad = (appdata *)data;
70 evas_object_del(ad->popup);
78 vconf_get_bool(VCONFKEY_WMS_WMANAGER_CONNECTED, &enable);
83 bool colorstr_to_decimal(char *color, int *R, int *G, int *B)
85 DBG("_colorstr_to_decimal");
91 value = strtol(color, &ptr, 16);
92 *R = (value >> 16) & 0xFF;
93 *G = (value >> 8) & 0xFF;
98 char *_get_strnum_from_icu(int number)
100 char *locale_tmp = vconf_get_str(VCONFKEY_REGIONFORMAT);
101 char locale[32] = {0,};
103 if (strlen(locale_tmp) < 32)
104 strcpy(locale, locale_tmp);
106 if (locale[0] != '\0') {
107 p = strstr(locale, ".UTF-8");
113 char *ret_str = NULL;
114 UErrorCode status = U_ZERO_ERROR;
116 UNumberFormat *num_fmt;
117 UChar result[20] = { 0, };
118 char res[20] = { 0, };
119 int32_t len = (int32_t)(sizeof(result) / sizeof((result)[0]));
121 num_fmt = unum_open(UNUM_DEFAULT, NULL, -1, locale, NULL, &status);
122 unum_format(num_fmt, number, result, len, NULL, &status);
124 u_austrcpy(res, result);
128 ret_str = strdup(res);
132 bool is_file_exist(char *file_path)
137 DBG("Setting - file path is wrong!!");
141 if ((fd = open(file_path, O_RDONLY)) == -1) {
142 DBG("Setting - file(%s) do not exist!!", file_path);
146 DBG("Setting - file exist!!");