2 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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)))
56 strncpy(buffer, str, ch - str);
58 sprintf(buffer + (ch - str), "%s%s", repl, ch + strlen(orig));
63 void setting_popup_back_cb(void *data, Evas_Object *obj, void *event_info)
65 appdata *ad = (appdata *)data;
71 evas_object_del(ad->popup);
79 vconf_get_bool(VCONFKEY_WMS_WMANAGER_CONNECTED, &enable);
84 bool colorstr_to_decimal(char *color, int *R, int *G, int *B)
86 DBG("_colorstr_to_decimal");
92 value = strtol(color, &ptr, 16);
93 *R = (value>>16)&0xFF;
99 char *_get_strnum_from_icu(int number)
101 char *locale_tmp = vconf_get_str(VCONFKEY_REGIONFORMAT);
102 char locale[32] = {0,};
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)
136 if( !file_path && !strlen(file_path) )
138 DBG("Setting - file path is wrong!!");
142 if( (fd = open(file_path, O_RDONLY)) == -1)
144 DBG("Setting - file(%s) do not exist!!", file_path);
148 DBG("Setting - file exist!!");