Add Timezone set/notifiers 60/69760/3 accepted/tizen/common/20160617.121108 accepted/tizen/ivi/20160617.082112 accepted/tizen/mobile/20160617.081548 accepted/tizen/tv/20160617.081659 accepted/tizen/wearable/20160617.081757 submit/tizen/20160616.063325
authorMyoungJune Park <mj2004.park@samsung.com>
Mon, 16 May 2016 13:43:42 +0000 (22:43 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Wed, 15 Jun 2016 07:36:34 +0000 (16:36 +0900)
Change-Id: I0313a6369ac69fa83aa9a296931c3872e500ddf5
Signed-off-by: MyoungJune Park <mj2004.park@samsung.com>
CMakeLists.txt
include/system_settings_private.h
packaging/capi-system-system-settings.spec
src/system_setting_platform.c
src/system_settings.c

index 56626ff..4984697 100755 (executable)
@@ -14,13 +14,10 @@ SET(LIBDIR "${CMAKE_LIBDIR}")
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info")
+SET(requires "dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info alarm-service")
 SET(pc_requires "capi-base-common")
 
 
-
-
-
 IF(TIZEN_WEARABLE)
     ADD_DEFINITIONS(-DTIZEN_WEARABLE)
 ENDIF(TIZEN_WEARABLE)
index 3d11344..80734e7 100644 (file)
@@ -815,6 +815,39 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin
  * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
  */
 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value);
+
+/**
+ * @internal
+ * @since_tizen 3.0
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
+ * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
+ * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value);
+
+/**
+ * @internal
+ * @since_tizen 3.0
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
+ * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
+ * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @since_tizen 3.0
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
+ * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
+ * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key);
+
+
+
 /**
  * @internal
  * @since_tizen 2.3
index c7f5fd8..66efd50 100755 (executable)
@@ -15,6 +15,7 @@ BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(pkgmgr)
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(alarm-service)
 
 Requires(post): /sbin/ldconfig  
 Requires(postun): /sbin/ldconfig
index 87d7710..3a0652e 100644 (file)
@@ -1273,24 +1273,43 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin
 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];
+       sprintf( tz_path, "/usr/share/zoneinfo/%s", vconf_value);
+
+       int is_load = _is_file_accessible(tz_path);
+       if (is_load == 0) {
+               int ret = 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;
index dfc432e..a93187e 100644 (file)
@@ -189,9 +189,9 @@ system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE,
                SYSTEM_SETTING_DATA_TYPE_STRING,
                system_setting_get_locale_timezone,
-               NULL,
-               NULL,
-               NULL,
+               system_setting_set_locale_timezone,
+               system_setting_set_changed_callback_locale_timezone,
+               system_setting_unset_changed_callback_locale_timezone,
                NULL,
                NULL            /* user data */
        },