From 4d28b43bbf27482fd4e4bd7d98b75475f0c885fc Mon Sep 17 00:00:00 2001 From: Kairong Yin Date: Tue, 6 Nov 2012 15:40:23 +0800 Subject: [PATCH] replaced heynoti call with vconf listen Change-Id: I06553a2015963b4372ccf721f16b3a2e2f3302f5 --- setting-time/include/setting-time-main.h | 5 ++- setting-time/src/setting-time-engine.c | 2 +- setting-time/src/setting-time-main.c | 62 +++++++++----------------------- 3 files changed, 20 insertions(+), 49 deletions(-) diff --git a/setting-time/include/setting-time-main.h b/setting-time/include/setting-time-main.h index 2807ec2..9dc665f 100755 --- a/setting-time/include/setting-time-main.h +++ b/setting-time/include/setting-time-main.h @@ -4,7 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. * * Contact: MyoungJune Park - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,7 +32,6 @@ /* TODO once time changes, heynoti message is sent. need to see this is proper design */ -#define TIME_CHANGED_HEYNOTY_CALLBACK 1 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/" #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale" @@ -66,5 +65,5 @@ static void setting_time_main_controlbar_lbtn_label_set( Evas_Object *controlbar, char *label); static int __setting_set_city_tzone(const char* pTZPath); - + #endif /* __SETTING_TIME_MAIN_H__ */ diff --git a/setting-time/src/setting-time-engine.c b/setting-time/src/setting-time-engine.c index 6a1c0fb..1cdfdd2 100755 --- a/setting-time/src/setting-time-engine.c +++ b/setting-time/src/setting-time-engine.c @@ -4,7 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. * * Contact: MyoungJune Park - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/setting-time/src/setting-time-main.c b/setting-time/src/setting-time-main.c index 35e1578..ce56cd7 100755 --- a/setting-time/src/setting-time-main.c +++ b/setting-time/src/setting-time-main.c @@ -29,6 +29,9 @@ #include #include +#include +#include + #include #include #include @@ -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 +/- ex. +9, -1 time_t t = time(0); // get unix time. sec. -- 2.7.4