6 $ setting_confutil // create a cfg file in default
7 $ setting_confutil export // export current status to a xml file
8 $ setting_confutil timezone_init // timezone init
12 #include <setting-cfg.h>
13 #include <setting-debug.h>
15 #include <Elementary.h>
16 #include <setting-common-general-func.h>
17 #include <setting-common-data-slp-setting.h>
19 #include <system_settings.h>
22 #include <libxml/parser.h>
23 #include <libxml/tree.h>
25 static char* get_timezone();
27 static void get_gmt_offset(char *str_buf, int size)
29 // timezone string +/-<n> ex. +9, -1
30 time_t t = time(0); // get unix time. sec.
33 data = localtime(&t); // save time as structure.
34 setting_retm_if(!data, "data is NULL");
35 data->tm_isdst = 0; // summer time, not applied.
36 time_t a = mktime(data);
39 data->tm_isdst = 0; // summer time, not applied.
40 time_t b = mktime(data);
42 int gmtoffset_hour = (a-b)/3600; // result : hour.
43 int gmtoffset_min = ((a-b)%3600)/60; // result : min.
44 if(gmtoffset_min != 0) {
48 snprintf(str_buf, size, "%+d:%02u", gmtoffset_hour, gmtoffset_min);
49 SETTING_TRACE("szTimezone is of a valid format: GMT: %s", str_buf);
55 char* tzpath = get_timezone();
56 //printf(">>> time zone : %s \n", tzpath+20);
57 int ret = vconf_set_str(VCONFKEY_SETAPPL_TIMEZONE_INT, tzpath+20);
59 SETTING_TRACE("fail to set vconf");
61 char str_buf[256] = {0, };
62 get_gmt_offset(str_buf, 256);
63 printf(">>> time zone GMT string : %s \n", str_buf);
66 void get_current_font()
69 int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &value);
71 SETTING_TRACE("fail to set SYSTEM_SETTINGS_KEY_FONT_TYPE");
73 printf(">>> get current font type : %s \n", value);
76 int status_fp(int total, int current, void* data)
78 SETTING_TRACE(">> total : %d ---- current : %d ", total, current);
84 sh-4.1# /usr/apps/org.tizen.setting/bin/setting_conf_util timezone_check
86 >>> time zone : /usr/share/zoneinfo/Asia/Seoul
88 int main(int argc, char* argv[])
92 // exporting - current status
93 if ( (argc == 2) && (0 == strcmp(argv[1], "import"))) {
94 // void setting_import(status_handler fp, void* data)
96 setting_import(status_fp, NULL);
98 } else if ( (argc == 2) && (0 == strcmp(argv[1], "export"))) {
99 setting_export(status_fp, NULL);
100 } else if ( (argc == 2) && (0 == strcmp(argv[1], "timezone_init"))) {
102 } else if ( (argc == 2) && (0 == strcmp(argv[1], "get_current_font"))) {
107 ret = setting_cfg_create();
113 static char* get_timezone()
117 enum { BUFFERSIZE = 1024 };
118 char buf[BUFFERSIZE];
119 ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf)-1);
125 /* handle error condition */
127 return g_strdup(buf);