3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #include <ui-gadget.h>
27 #include "edit-view.h"
28 #include "detail-view.h"
29 #include "noti-handler.h"
30 #include "lang-manager.h"
32 static void __cal_main_setup_data(struct appdata *ad);
33 static Eina_Bool __cal_main_update_today(void *data);
35 static void __cal_main_changed_callback(void *data)
41 struct appdata *ad = data;
43 __cal_main_setup_data(ad);
46 ad->is_update_view = EINA_TRUE;
50 cal_main_update_view(ad);
55 static void __cal_main_set_today_tm(struct appdata *ad)
59 time_t now = time(NULL);
60 localtime_r(&now, &tm);
62 tm.tm_min = 0; // min, sec reset for mktime()
68 time_t t = mktime(&tm);
70 if (t == (time_t)-1) {
71 ERR("mktime() is failed");
76 t = t + (24 * 60 * 60) - time(NULL);
77 ad->today_tmr = ecore_timer_add((double)t, __cal_main_update_today, ad);
80 static Eina_Bool __cal_main_update_today(void *data)
82 c_retv_if(!data, ECORE_CALLBACK_CANCEL);
84 struct appdata *ad = data;
86 __cal_main_set_today_tm(ad);
89 edje_object_signal_emit(ad->today_edj, "update_today", "prog");
91 return ECORE_CALLBACK_CANCEL;
94 static void __cal_main_setup_data(struct appdata *ad)
98 __cal_main_set_today_tm(ad);
100 if (ad->base_tm.tm_year == 0)
101 ad->base_tm = ad->today_tm;
105 int r = vconf_get_int(CAL_VCONFKEY_FIRST_DAY_OF_WEEK, &val);
106 if (r < 0 || val < 0)
107 ad->wday_start = cal_util_get_default_first_day_of_week();
109 ad->wday_start = val;
111 r = vconf_get_int(VCONFKEY_REGIONFORMAT_TIME1224, &val);
114 else if( val == 1 || val == 2)
117 ERR("vconf_get_int(VCONFKEY_REGIONFORMAT_TIME1224, &val); error");
119 vconf_get_int(CAL_VCONFKEY_COMPLETE_TODO_ON_OFF, (int *)&ad->is_display_complete_todo);
121 ad->is_update_view = EINA_TRUE;
123 ad->acct_id = _CALENDAR_ALL_ACCOUNT_ID;
128 static void __cal_main_timezone_vconf_changed_callback(keynode_t *node, void *user_data)
133 c_ret_if(!user_data);
135 Eina_Bool is_lock_timezone = vconf_keynode_get_int(node);
139 if (is_lock_timezone)
140 text = vconf_get_str(CAL_VCONFKEY_LOCK_TIMEZONE_PATH);
142 text = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
144 if (CAL_STRLEN(text)) {
146 cal_util_set_timezone(text);
150 cal_main_update_view(user_data);
153 ERR("vconf_get_str is failed.");
158 static void __cal_main_week_of_day_format_vconf_changed_callback(keynode_t *node, void *user_data)
162 c_retm_if(!node, "node is null");
163 c_retm_if(!user_data, "user_data is null");
165 struct appdata* ad = user_data;
166 int r = vconf_keynode_get_int(node);
168 ad->wday_start = cal_util_get_default_first_day_of_week();
172 cal_main_update_view(ad);
177 static void __cal_main_view_of_month_format_vconf_changed_callback(keynode_t *node, void *user_data)
181 c_retm_if(!node, "node is null");
182 c_retm_if(!user_data, "user_data is null");
184 struct appdata* ad = user_data;
185 int r = vconf_keynode_get_int(node);
186 c_retm_if(r < 0, "vconf_keynode_get_int is failed");
188 ad->daily_events_mode = r;
190 cal_main_update_view(ad);
195 static void __cal_main_view_of_display_compelete_todo_vconf_changed_callback(keynode_t *node, void *user_data)
199 c_retm_if(!node, "node is null");
200 c_retm_if(!user_data, "user_data is null");
202 struct appdata* ad = user_data;
204 if (CV_YEAR == ad->current_view)
207 int r = vconf_keynode_get_int(node);
208 c_retm_if(r < 0, "vconf_keynode_get_int is failed");
210 ad->is_display_complete_todo = r;
212 cal_main_update_view(ad);
217 static void __cal_main_view_of_display_week_number_vconf_changed_callback(keynode_t *node, void *user_data)
221 c_retm_if(!node, "node is null");
222 c_retm_if(!user_data, "user_data is null");
224 struct appdata* ad = user_data;
226 if (CV_MONTH != ad->current_view && !ad->daily_events_mode)
229 int r = vconf_keynode_get_int(node);
230 c_retm_if(r < 0, "vconf_keynode_get_int is failed");
232 ad->is_display_weeknumber = r;
234 cal_main_update_view(ad);
239 static void __cal_main_time_format_vconf_changed_callback(keynode_t *node, void *user_data)
243 c_retm_if(!node, "node is null");
244 c_retm_if(!user_data, "user_data is null");
246 struct appdata* ad = user_data;
248 int r = vconf_keynode_get_int(node);
249 c_retm_if(r < 0, "vconf_keynode_get_int is failed");
253 cal_main_update_view(ad);
258 static void __cal_main_time_changed_callback(keynode_t *node, void *user_data)
262 c_ret_if(!user_data);
264 struct appdata* ad = user_data;
266 __cal_main_set_today_tm(ad);
268 cal_main_update_view(ad);
271 static int __cal_main_initialize(struct appdata *ad)
275 c_retvm_if(!ad, -1, "ad is null");
277 __cal_main_setup_data(ad);
279 calendar_error_e err = calendar_connect();
280 c_warn_if(err != CALENDAR_ERROR_NONE, "calendar_connect is failed(%d)", err);
282 _calendar_init_hash();
284 cal_util_connect_pattern_generator();
286 cal_util_initialize_timezone();
288 elm_theme_extension_add(NULL, "/usr/apps/"CALENDAR_PACKAGE"/res/edje/theme.edj");
289 elm_theme_extension_add(NULL, "/usr/apps/"CALENDAR_PACKAGE"/res/edje/theme2.edj");
290 elm_theme_extension_add(NULL, "/usr/apps/"CALENDAR_PACKAGE"/res/edje/theme3.edj");
292 int r = vconf_notify_key_changed(CAL_VCONFKEY_FOCUS_VIEW,__cal_main_view_of_month_format_vconf_changed_callback, ad);
293 c_warn_if (r, "vconf_notify_key_changed failed");
295 r = vconf_notify_key_changed(CAL_VCONFKEY_WEEK_NMUBER_ON_OFF, __cal_main_view_of_display_week_number_vconf_changed_callback, ad);
296 c_warn_if (r, "vconf_notify_key_changed failed");
298 r = vconf_notify_key_changed(CAL_VCONFKEY_COMPLETE_TODO_ON_OFF, __cal_main_view_of_display_compelete_todo_vconf_changed_callback, ad);
299 c_warn_if (r, "vconf_notify_key_changed failed");
301 r = vconf_notify_key_changed(CAL_VCONFKEY_FIRST_DAY_OF_WEEK , __cal_main_week_of_day_format_vconf_changed_callback, ad);
302 c_warn_if (r, "vconf_notify_key_changed failed");
304 r = vconf_notify_key_changed(VCONFKEY_REGIONFORMAT_TIME1224 , __cal_main_time_format_vconf_changed_callback, ad);
305 c_warn_if (r, "vconf_notify_key_changed failed");
307 r = vconf_notify_key_changed(VCONFKEY_SETAPPL_TIMEZONE_INT , __cal_main_timezone_vconf_changed_callback, ad);
308 c_warn_if (r, "vconf_notify_key_changed failed");
310 r = vconf_notify_key_changed(CAL_VCONFKEY_LOCK_TIMEZONE_ON_OFF, __cal_main_timezone_vconf_changed_callback, ad);
311 c_warn_if (r, "vconf_notify_key_changed failed");
313 r = vconf_notify_key_changed(CAL_VCONFKEY_LOCK_TIMEZONE_PATH, __cal_main_timezone_vconf_changed_callback, ad);
314 c_warn_if (r, "vconf_notify_key_changed failed");
316 r = vconf_notify_key_changed(VCONFKEY_SYSTEM_TIMECHANGE, __cal_main_time_changed_callback, ad);
317 c_warn_if (r, "vconf_notify_key_changed failed");
319 r = contacts_connect2();
320 c_warn_if(r != CONTACTS_ERROR_NONE, "contacts_connect2() is failed(%x)", r);
322 UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
329 static void __cal_main_finish(struct appdata *ad)
332 cal_lang_manager_remove_all_callback();
336 cal_util_disconnect_pattern_generator();
338 int r = contacts_disconnect2();
339 c_warn_if(r!=CONTACTS_ERROR_NONE, "contacts_disconnect2() is failed(%x)", r);
341 r = vconf_ignore_key_changed(CAL_VCONFKEY_LOCK_TIMEZONE_PATH, __cal_main_timezone_vconf_changed_callback);
342 c_warn_if(r, "vconf_ignore_key_changed(CAL_VCONFKEY_LOCK_TIMEZONE_PATH) failed");
344 r = vconf_ignore_key_changed(CAL_VCONFKEY_LOCK_TIMEZONE_ON_OFF, __cal_main_timezone_vconf_changed_callback);
345 c_warn_if(r, "vconf_ignore_key_changed(CAL_VCONFKEY_LOCK_TIMEZONE_ON_OFF) failed");
347 r = vconf_ignore_key_changed(VCONFKEY_SETAPPL_TIMEZONE_INT, __cal_main_timezone_vconf_changed_callback);
348 c_warn_if(r, "vconf_ignore_key_changed(VCONFKEY_SETAPPL_TIMEZONE_INT) failed");
350 r = vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT_TIME1224, __cal_main_time_format_vconf_changed_callback);
351 c_warn_if(r, "vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT_TIME1224) failed");
353 r = vconf_ignore_key_changed(CAL_VCONFKEY_FIRST_DAY_OF_WEEK, __cal_main_week_of_day_format_vconf_changed_callback);
354 c_warn_if(r, "vconf_ignore_key_changed(CAL_VCONFKEY_FIRST_DAY_OF_WEEK) failed");
356 r = vconf_ignore_key_changed(CAL_VCONFKEY_COMPLETE_TODO_ON_OFF, __cal_main_view_of_display_compelete_todo_vconf_changed_callback);
357 c_warn_if(r, "vconf_ignore_key_changed(CAL_VCONFKEY_COMPLETE_TODO_ON_OFF) failed");
359 r = vconf_ignore_key_changed(CAL_VCONFKEY_WEEK_NMUBER_ON_OFF, __cal_main_view_of_display_week_number_vconf_changed_callback);
360 c_warn_if(r, "vconf_ignore_key_changed(CAL_VCONFKEY_WEEK_NMUBER_ON_OFF) failed");
362 r = vconf_ignore_key_changed(CAL_VCONFKEY_FOCUS_VIEW, __cal_main_view_of_month_format_vconf_changed_callback);
363 c_warn_if(r, "vconf_ignore_key_changed(CAL_VCONFKEY_FOCUS_VIEW) failed");
365 calendar_error_e err = calendar_disconnect();
366 c_warn_if(err != CALENDAR_ERROR_NONE, "calendar_disconnect() is failed(%d)", err);
369 static int __cal_main_add_naviframe(struct appdata *ad)
371 c_retvm_if(!ad, -1, "ad is null");
375 ad->naviframe = elm_naviframe_add(ad->base);
376 c_retvm_if(!ad->naviframe, -1, "elm_naviframe_add returned null");
378 elm_object_part_content_set(ad->base, "elm.swallow.content", ad->naviframe);
385 static void __cal_main_win_profile_changed_callback(void *data, Evas_Object *obj, void *event)
390 struct appdata *ad = data;
393 Evas_Object *base = ad->base;
395 const char *profile = elm_config_profile_get();
398 if (!CAL_STRCMP(profile, "desktop"))
399 elm_layout_theme_set(base, "layout", "application", "noindicator");
401 elm_layout_theme_set(base, "layout", "application", "default");
403 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
405 elm_win_resize_object_add(obj, base);
406 elm_object_content_set(ad->conform, base);
408 evas_object_show(base);
411 static Evas_Object * __cal_main_add_base_layout(Evas_Object *conformant)
415 c_retv_if(!conformant, NULL);
417 Evas_Object *layout = elm_layout_add(conformant);
418 c_retv_if(!layout, false);
420 Eina_Bool r = elm_layout_theme_set(layout, "layout", "application", "default");
421 c_warn_if(!r, "elm_layout_theme_set is failed");
423 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
425 elm_object_content_set(conformant, layout);
432 static void __cal_device_orientation(void *data, Evas_Object *obj, void *event)
436 c_retm_if(!data, "user_data is null.");
438 struct appdata *ad = data;
439 Eina_Bool is_landscape_mode = EINA_FALSE;
441 int rotation = elm_win_rotation_get(obj);
442 c_ret_if(rotation != CAL_WINDOW_ROTATION_0
443 && rotation != CAL_WINDOW_ROTATION_90
444 && rotation != CAL_WINDOW_ROTATION_180
445 && rotation != CAL_WINDOW_ROTATION_270);
447 if (ad->rotation == (cal_window_rotation)rotation)
451 case CAL_WINDOW_ROTATION_0:
452 ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
454 case CAL_WINDOW_ROTATION_90:
455 is_landscape_mode = EINA_TRUE;
456 ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
458 case CAL_WINDOW_ROTATION_180:
459 ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
461 case CAL_WINDOW_ROTATION_270:
462 is_landscape_mode = EINA_TRUE;
463 ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
469 ad->rotation = (cal_window_rotation)rotation;
470 ad->is_landscape_mode = is_landscape_mode;
475 ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
477 if (ad->is_landscape_mode) {
485 cal_main_rotation(ad);
488 static bool cal_create(void *data)
492 c_retvm_if(!data, false, "data is null");
494 struct appdata *ad = data;
496 Evas_Object *window = cal_util_add_window(CALENDAR, &ad->win_w, &ad->win_h);
497 c_retv_if(!window, false);
499 evas_object_smart_callback_add(window, "profile,changed", __cal_main_win_profile_changed_callback, ad);
500 evas_object_smart_callback_add(window, "wm,rotation,changed", __cal_device_orientation, ad);
502 Evas_Object *bg = cal_util_add_bg(window, EINA_TRUE);
503 c_retv_if(!bg, false);
505 Evas_Object *conformant = elm_conformant_add(window);
506 c_retv_if(!conformant, false);
508 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
509 elm_win_resize_object_add(window, conformant);
510 evas_object_show(conformant);
512 Evas_Object *layout = __cal_main_add_base_layout(conformant);
513 c_retv_if(!layout, false);
517 ad->conform = conformant;
520 int ret = __cal_main_initialize(ad);
521 c_retvm_if(ret, false, "__cal_main_initialize is failed(%d)", ret);
523 ret = __cal_main_add_naviframe(ad);
524 c_retvm_if(ret, false, "__cal_main_add_naviframe is failed(%d)", ret);
531 static void cal_terminate(void *data)
535 c_retm_if(!data, "data is null");
537 struct appdata *ad = data;
541 __cal_main_finish(ad);
544 evas_object_del(ad->win);
549 static void __cal_main_raise_main_view(struct appdata *ad)
553 c_retm_if(!ad, "ad is null");
555 Elm_Object_Item* bottom = elm_naviframe_bottom_item_get(ad->naviframe);
558 Elm_Object_Item* top = elm_naviframe_top_item_get(ad->naviframe);
562 elm_naviframe_item_pop_to(bottom);
564 ad->current_view = ad->request_view;
569 static Eina_Bool __cal_main_live_calendar_destroy_callback(void *data)
571 struct appdata *ad = data;
574 elm_win_lower(ad->win);
577 if (ad->current_view == CV_DAY) {
578 Evas_Object *content = elm_object_part_content_get(ad->main, "cont");
579 cal_day_change_content_display_status(content);
585 static Eina_Bool __cal_main_ug_destroy_callback(void *data)
587 c_retv_if(!data, EINA_FALSE);
589 struct appdata *ad = data;
594 elm_win_lower(ad->win);
599 static inline void __cal_main_add_naviframe_content(struct appdata *ad)
603 switch (ad->request_view) {
611 __cal_main_raise_main_view(ad);
614 cal_main_create_view(ad);
616 cal_main_change_view(ad->main, ad->request_view);
617 if (ad->request_view == CV_TODO) {
618 ad->item_type = ITEM_TYPE_TODO;
620 ad->item_type = ITEM_TYPE_EVENT;
626 calendar_record_h record = NULL;
628 record = _calendar_get_record_with_index(ad->cid);
631 cal_detail_create_view(ad, record, __cal_main_ug_destroy_callback, ad);
633 calendar_error_e error = CALENDAR_ERROR_NONE;
635 error = calendar_record_destroy(record, NULL);
636 c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_destroy() is failed(%x)", error);
642 calendar_record_h record = NULL;
643 calendar_error_e error = CALENDAR_ERROR_NONE;
645 if (ad->item_type == ITEM_TYPE_TODO) {
646 error = calendar_record_create(_calendar_todo._uri, &record);
648 error = calendar_record_create(_calendar_event._uri, &record);
650 c_retm_if(error != CALENDAR_ERROR_NONE, "calendar_record_create() is failed(%x)", error);
652 cal_edit_create_view(ad, record, __cal_main_live_calendar_destroy_callback, ad);
654 if (ad->current_view == CV_DAY) {
655 Evas_Object *content = elm_object_part_content_get(ad->main, "cont");
656 cal_day_change_content_display_status(content);
660 elm_win_lower(ad->win);
672 static void cal_resume(void *data)
676 c_retm_if(!data, "data is null");
678 struct appdata* ad = data;
682 ad->is_pause = EINA_FALSE;
684 if (ad->is_update_view)
685 __cal_main_changed_callback(ad);
690 static void __cal_main_select_view(service_h service, struct appdata* ad)
697 char *operation = NULL;
703 ad->request_view = CV_MONTH;
705 int r = service_get_operation(service, &operation);
706 c_warn_if(SERVICE_ERROR_NONE != r, "service_get_opertaion is failed(%d).", r);
708 if (!CAL_STRCMP(operation, SERVICE_OPERATION_DEFAULT)) {
710 service_get_extra_data(service, CAL_APPSVC_PARAM_REMINDER_ID, &index);
712 if (!CAL_STRLEN(index))
713 service_get_extra_data(service, CAL_APPSVC_PARAM_LOCATION_REMINDER, &index);
715 if (CAL_STRLEN(index) && (r = atoi(index))) {
717 cal_noti_handler_show_for_location_reminder(r, ad);
719 ad->request_view = CV_NOTI;
722 r = service_get_extra_data(service, CAL_APPSVC_PARAM_CALLER, &caller);
723 c_warn_if(SERVICE_ERROR_NONE != r, "service_get_extra_data is failed(%d).", r);
725 r = service_get_extra_data(service, CAL_APPSVC_PARAM_TYPE, &type);
726 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
728 if (!CAL_STRCMP(caller, "live")) {
730 r = service_get_extra_data(service, CAL_APPSVC_PARAM_COUNT, &count);
731 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
733 if (CAL_STRLEN(count) && atoi(count))
734 ad->request_view = CV_LIST;
736 ad->request_view = CV_EDIT;
741 struct tm base_time = {0};
742 r = service_get_extra_data(service, "base_time", &time);
743 long long int lli_time = strtoll(time, NULL, 10);
744 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
747 ad->base_tm = base_time;
749 r = service_get_extra_data(service, "itemType", &type);
750 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
752 if (!CAL_STRCMP(type, "todo")) {
753 ad->item_type = ITEM_TYPE_TODO;
755 ad->item_type = ITEM_TYPE_EVENT;
760 if (!CAL_STRCMP(type, "week")) {
761 ad->request_view = CV_WEEK;
766 struct tm base_time = {0};
767 r = service_get_extra_data(service, "base_time", &time);
768 long long int lli_time = strtoll(time, NULL, 10);
769 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
772 ad->base_tm = base_time;
773 } else if (!CAL_STRCMP(type, "day")) {
774 ad->request_view = CV_DAY;
779 struct tm base_time = {0};
780 r = service_get_extra_data(service, "base_time", &time);
781 long long int lli_time = strtoll(time, NULL, 10);
782 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
785 ad->base_tm = base_time;
786 } else if (!CAL_STRCMP(type, "month")) {
787 ad->request_view = CV_MONTH;
792 struct tm base_time = {0};
793 r = service_get_extra_data(service, "base_time", &time);
794 long long int lli_time = strtoll(time, NULL, 10);
795 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
798 ad->base_tm = base_time;
799 } else if (!CAL_STRCMP(type, "task")) {
800 ad->request_view = CV_TODO;
805 }else if (!CAL_STRCMP(operation, SERVICE_OPERATION_VIEW)) {
806 r = service_get_extra_data(service, CAL_APPSVC_PARAM_TYPE, &type);
807 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
809 if (!CAL_STRCMP(type, "event")) {
810 ad->item_type = ITEM_TYPE_EVENT;
811 } else if (!CAL_STRCMP(type, "todo")) {
812 ad->item_type = ITEM_TYPE_TODO;
815 r = service_get_extra_data(service, CAL_APPSVC_PARAM_INDEX, &index);
816 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
818 if (CAL_STRLEN(index) && (r = atoi(index))) {
821 ad->request_view = CV_DETAIL;
834 static void cal_pause(void *data)
840 struct appdata* ad = data;
841 c_ret_if(!ad->naviframe);
846 ad->is_aul = EINA_FALSE; //unset flag
848 if (ad->content && elm_naviframe_top_item_get(ad->naviframe) != elm_naviframe_bottom_item_get(ad->naviframe))
849 elm_naviframe_item_pop_to(ad->content); //pop to calendar app's content
851 elm_exit(); //if there is no calendar app's contents, exit.
853 ad->request_view = CV_UNKNOWN;
856 ad->is_pause = EINA_TRUE;
861 static void cal_service(service_h service, void *user_data)
866 c_ret_if(!user_data);
868 struct appdata *ad = user_data;
870 __cal_main_select_view(service, ad);
872 if (ad->request_view == CV_NOTI) {
880 int ret = ug_destroy(ad->ug);
881 c_warn_if(ret, "ug_destroy() is failed.");
886 __cal_main_add_naviframe_content(ad);
889 elm_win_activate(ad->win);
891 evas_object_show(ad->win);
896 static void __cal_language_changed(void *user_data)
900 ug_send_event(UG_EVENT_LANG_CHANGE);
902 cal_lang_manager_apply();
905 static inline void __cal_check_first_day_of_week(int *first_day_of_week)
907 c_ret_if(!first_day_of_week);
909 int ret = vconf_get_int(CAL_VCONFKEY_FIRST_DAY_OF_WEEK, first_day_of_week);
910 c_warn_if(ret != 0, "vconf_get_int(CAL_VCONFKEY_FIRST_DAY_OF_WEEK) is failed.");
912 if (ret != 0 || *first_day_of_week == -1)
913 *first_day_of_week = cal_util_get_default_first_day_of_week();
916 static void __cal_region_format_changed(void *user_data)
920 struct appdata *ad = user_data;
923 __cal_check_first_day_of_week(&ad->wday_start);
925 ug_send_event(UG_EVENT_REGION_CHANGE);
927 cal_lang_manager_apply();
930 int main(int argc, char *argv[])
934 app_event_callback_s event_callback;
936 event_callback.create = cal_create;
937 event_callback.terminate = cal_terminate;
938 event_callback.pause = cal_pause;
939 event_callback.resume = cal_resume;
940 event_callback.service = cal_service;
941 event_callback.low_memory = NULL;
942 event_callback.low_battery = NULL;
943 event_callback.device_orientation = NULL;
944 event_callback.language_changed = __cal_language_changed;
945 event_callback.region_format_changed = __cal_region_format_changed;
947 memset(&ad, 0x0, sizeof(struct appdata));
949 return app_efl_main(&argc, &argv, &event_callback, &ad);