replaced heynoti call with vconf listen
[apps/core/preloaded/settings.git] / setting-time / src / setting-time-main.c
index 35e1578..ce56cd7 100755 (executable)
@@ -29,6 +29,9 @@
 #include <string.h>
 #include <sqlite3.h>
 
+#include <vconf.h>
+#include <vconf-keys.h>
+
 #include <unicode/udat.h>
 #include <unicode/ustring.h>
 #include <unicode/uloc.h>
@@ -73,9 +76,9 @@ bool __update_timezone_idler(SettingTimeUG *ad)
        ad->update_timezone_idler = NULL;
        return 0;
 }
-#if TIME_CHANGED_HEYNOTY_CALLBACK
-void time_changed_callback(void *data)
-{
+
+void time_changed_callback(keynode_t *key, void *data) {
+
        SETTING_TRACE_DEBUG("time and timezone have been changed: TIME_CHANGED_HEYNOTY_CALLBACK");
        SettingTimeUG *ad = (SettingTimeUG *)data;
 
@@ -125,7 +128,6 @@ void time_changed_callback(void *data)
        }
        ad->refresh_time_idler = ecore_idler_add(setting_update_datefield, ad);
 }
-#endif
 
 void setting_time_update_time_date_format_string(SettingTimeUG *ad)
 {
@@ -493,6 +495,7 @@ static int setting_time_main_create(void *cb)
 
        ad->caller = caller;
        if (ad->caller) {
+               /* for setup wizard */
                char *lbtn_str = (char *)g_strdup(l_btn);
                bool same_flag = FALSE;
                if (0 == safeStrCmp(l_btn, _("IDS_COM_BODY_BACK"))) {
@@ -776,32 +779,7 @@ static int setting_time_main_create(void *cb)
        }
 
        setting_view_time_main.is_create = 1;
-
-#if TIME_CHANGED_HEYNOTY_CALLBACK
-       /* ---------------------------------------------------------------- */
-       /*  heynoti registration */
-       /* ---------------------------------------------------------------- */
-       ad->noti_fd = heynoti_init();
-
-       if (ad->noti_fd == -1) {
-               SETTING_TRACE("heynoti_init FAIL");
-               return SETTING_RETURN_FAIL;
-       } else {
-               SETTING_TRACE("heynoti_init OK");
-       }
-
-       if (-1 == heynoti_subscribe(ad->noti_fd, SETTING_TIME_CHANGED, time_changed_callback, (void *)ad)) {
-               SETTING_TRACE("heynoti_subscribe FAIL");
-       } else {
-               SETTING_TRACE("heynoti_subscribe OK");
-       }
-
-       if (-1 == heynoti_attach_handler(ad->noti_fd)) {
-               SETTING_TRACE("heynoti_attach_handler FAIL");
-       } else {
-               SETTING_TRACE("heynoti_attach_handler OK");
-       }
-#endif
+       vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_callback, (void *)ad);
 
        /*  register vconf key to get event callback for converting 12/24H */
        ret = vconf_notify_key_changed(VCONFKEY_REGIONFORMAT_TIME1224,
@@ -829,16 +807,6 @@ static int setting_time_main_destroy(void *cb)
 
        SettingTimeUG *ad = (SettingTimeUG *) cb;
 
-#if TIME_CHANGED_HEYNOTY_CALLBACK
-       /* Closing heynoti */
-       if (ad->noti_fd != -1)//first need to check the fd validation
-       {
-               heynoti_unsubscribe(ad->noti_fd, SETTING_TIME_CHANGED, time_changed_callback);
-               //heynoti_detach_handler() will be done in heynoti_close().
-               heynoti_close(ad->noti_fd);
-               ad->noti_fd = -1;
-       }
-#endif
        if (ad->update_timer) {
                ecore_timer_del(ad->update_timer);
                ad->update_timer = NULL;
@@ -859,6 +827,10 @@ static int setting_time_main_destroy(void *cb)
                ecore_idler_del(ad->refresh_time_idler);
                ad->refresh_time_idler = NULL;
        }
+
+       vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED,
+                                time_changed_callback);
+
        vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT_TIME1224,
                                 setting_time_main_int_vconf_change_cb);
        vconf_ignore_key_changed(VCONFKEY_SETAPPL_DATE_FORMAT_INT,
@@ -999,7 +971,9 @@ setting_time_main_launch_worldclock_result_ug_cb(ui_gadget_h ug,
 
        // update the display for timezone
        setting_update_timezone(ad);
-       heynoti_publish(SETTING_TIME_CHANGED);
+       //heynoti_publish(SETTING_TIME_CHANGED);
+       static int t_event_val = -1;
+       vconf_set_int (VCONFKEY_SYSTEM_TIME_CHANGED, t_event_val);
        SETTING_TRACE_END;
 }
 
@@ -1266,7 +1240,8 @@ static void __time_auto_update(void *data)
        }
 
        // c.heynoti_publish
-       heynoti_publish(SETTING_TIME_CHANGED);
+       static int t_event_val = -1;
+       vconf_set_int (VCONFKEY_SYSTEM_TIME_CHANGED, t_event_val);
 }
 
 static void
@@ -1324,8 +1299,6 @@ setting_time_main_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
                }
        }
 }
-
-
 static void setting_time_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
                                           void *event_info)
 {
@@ -1532,7 +1505,6 @@ static void setting_time_main_controlbar_lbtn_label_set(
  */
 static void get_gmt_offset(char *str_buf, int size)
 {
-       SETTING_TRACE(" before GMT processing : %s", str_buf);
        // timezone string +/-<n> ex. +9, -1
        time_t t = time(0);     // get unix time. sec.