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 bool cal_create(void *data)
436 c_retvm_if(!data, false, "data is null");
438 struct appdata *ad = data;
440 Evas_Object *window = cal_util_add_window(CALENDAR, &ad->win_w, &ad->win_h);
441 c_retv_if(!window, false);
443 evas_object_smart_callback_add(window, "profile,changed", __cal_main_win_profile_changed_callback, ad);
445 Evas_Object *bg = cal_util_add_bg(window, EINA_TRUE);
446 c_retv_if(!bg, false);
448 Evas_Object *conformant = elm_conformant_add(window);
449 c_retv_if(!conformant, false);
451 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
452 elm_win_resize_object_add(window, conformant);
453 evas_object_show(conformant);
455 Evas_Object *layout = __cal_main_add_base_layout(conformant);
456 c_retv_if(!layout, false);
458 evas_object_show(window);
462 ad->conform = conformant;
465 int ret = __cal_main_initialize(ad);
466 c_retvm_if(ret, false, "__cal_main_initialize is failed(%d)", ret);
468 ret = __cal_main_add_naviframe(ad);
469 c_retvm_if(ret, false, "__cal_main_add_naviframe is failed(%d)", ret);
476 static void cal_terminate(void *data)
480 c_retm_if(!data, "data is null");
482 struct appdata *ad = data;
486 __cal_main_finish(ad);
489 evas_object_del(ad->win);
494 static void __cal_main_raise_main_view(struct appdata *ad)
498 c_retm_if(!ad, "ad is null");
500 Elm_Object_Item* bottom = elm_naviframe_bottom_item_get(ad->naviframe);
503 Elm_Object_Item* top = elm_naviframe_top_item_get(ad->naviframe);
507 elm_naviframe_item_pop_to(bottom);
509 ad->current_view = ad->request_view;
514 static Eina_Bool __cal_main_live_calendar_destroy_callback(void *data)
516 struct appdata *ad = data;
519 elm_win_lower(ad->win);
522 if (ad->current_view == CV_DAY) {
523 Evas_Object *content = elm_object_part_content_get(ad->main, "cont");
524 cal_day_change_content_display_status(content);
530 static Eina_Bool __cal_main_ug_destroy_callback(void *data)
532 c_retv_if(!data, EINA_FALSE);
534 struct appdata *ad = data;
539 elm_win_lower(ad->win);
544 static inline void __cal_main_add_naviframe_content(struct appdata *ad)
548 switch (ad->request_view) {
556 __cal_main_raise_main_view(ad);
559 cal_main_create_view(ad);
561 cal_main_change_view(ad->main, ad->request_view);
562 if (ad->request_view == CV_TODO) {
563 ad->item_type = ITEM_TYPE_TODO;
565 ad->item_type = ITEM_TYPE_EVENT;
571 calendar_record_h record = NULL;
573 record = _calendar_get_record_with_index(ad->cid);
576 cal_detail_create_view(ad, record, __cal_main_ug_destroy_callback, ad);
578 calendar_error_e error = CALENDAR_ERROR_NONE;
580 error = calendar_record_destroy(record, NULL);
581 c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_destroy() is failed(%x)", error);
587 calendar_record_h record = NULL;
588 calendar_error_e error = CALENDAR_ERROR_NONE;
590 if (ad->item_type == ITEM_TYPE_TODO) {
591 error = calendar_record_create(_calendar_todo._uri, &record);
593 error = calendar_record_create(_calendar_event._uri, &record);
595 c_retm_if(error != CALENDAR_ERROR_NONE, "calendar_record_create() is failed(%x)", error);
597 cal_edit_create_view(ad, record, __cal_main_live_calendar_destroy_callback, ad);
599 if (ad->current_view == CV_DAY) {
600 Evas_Object *content = elm_object_part_content_get(ad->main, "cont");
601 cal_day_change_content_display_status(content);
605 elm_win_lower(ad->win);
617 static void cal_resume(void *data)
621 c_retm_if(!data, "data is null");
623 struct appdata* ad = data;
627 ad->is_pause = EINA_FALSE;
629 if (ad->is_update_view)
630 __cal_main_changed_callback(ad);
635 static void __cal_main_select_view(service_h service, struct appdata* ad)
642 char *operation = NULL;
648 ad->request_view = CV_MONTH;
650 int r = service_get_operation(service, &operation);
651 c_warn_if(SERVICE_ERROR_NONE != r, "service_get_opertaion is failed(%d).", r);
653 if (!CAL_STRCMP(operation, SERVICE_OPERATION_DEFAULT)) {
655 service_get_extra_data(service, CAL_APPSVC_PARAM_REMINDER_ID, &index);
657 if (!CAL_STRLEN(index))
658 service_get_extra_data(service, CAL_APPSVC_PARAM_LOCATION_REMINDER, &index);
660 if (CAL_STRLEN(index) && (r = atoi(index))) {
662 cal_noti_handler_show_for_location_reminder(r, ad);
664 ad->request_view = CV_NOTI;
667 r = service_get_extra_data(service, CAL_APPSVC_PARAM_CALLER, &caller);
668 c_warn_if(SERVICE_ERROR_NONE != r, "service_get_extra_data is failed(%d).", r);
670 r = service_get_extra_data(service, CAL_APPSVC_PARAM_TYPE, &type);
671 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
673 if (!CAL_STRCMP(caller, "live")) {
675 r = service_get_extra_data(service, CAL_APPSVC_PARAM_COUNT, &count);
676 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
678 if (CAL_STRLEN(count) && atoi(count))
679 ad->request_view = CV_LIST;
681 ad->request_view = CV_EDIT;
686 struct tm base_time = {0};
687 r = service_get_extra_data(service, "base_time", &time);
688 long long int lli_time = strtoll(time, NULL, 10);
689 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
692 ad->base_tm = base_time;
694 r = service_get_extra_data(service, CAL_APPCONTROL_ITEM_TYPE, &type);
695 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
697 if (!CAL_STRCMP(type, "todo")) {
698 ad->item_type = ITEM_TYPE_TODO;
700 ad->item_type = ITEM_TYPE_EVENT;
705 if (!CAL_STRCMP(type, "week")) {
706 ad->request_view = CV_WEEK;
711 struct tm base_time = {0};
712 r = service_get_extra_data(service, "base_time", &time);
713 long long int lli_time = strtoll(time, NULL, 10);
714 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
717 ad->base_tm = base_time;
718 } else if (!CAL_STRCMP(type, "day")) {
719 ad->request_view = CV_DAY;
724 struct tm base_time = {0};
725 r = service_get_extra_data(service, "base_time", &time);
726 long long int lli_time = strtoll(time, NULL, 10);
727 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
730 ad->base_tm = base_time;
731 } else if (!CAL_STRCMP(type, "month")) {
732 ad->request_view = CV_MONTH;
737 struct tm base_time = {0};
738 r = service_get_extra_data(service, "base_time", &time);
739 long long int lli_time = strtoll(time, NULL, 10);
740 cal_util_convert_lli_to_tm(NULL, lli_time, &base_time);
743 ad->base_tm = base_time;
744 } else if (!CAL_STRCMP(type, "task")) {
745 ad->request_view = CV_TODO;
750 }else if (!CAL_STRCMP(operation, SERVICE_OPERATION_VIEW)) {
751 r = service_get_extra_data(service, CAL_APPSVC_PARAM_TYPE, &type);
752 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
754 if (!CAL_STRCMP(type, "event")) {
755 ad->item_type = ITEM_TYPE_EVENT;
756 } else if (!CAL_STRCMP(type, "todo")) {
757 ad->item_type = ITEM_TYPE_TODO;
760 r = service_get_extra_data(service, CAL_APPSVC_PARAM_INDEX, &index);
761 c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
763 if (CAL_STRLEN(index) && (r = atoi(index))) {
766 ad->request_view = CV_DETAIL;
779 static void cal_pause(void *data)
785 struct appdata* ad = data;
786 c_ret_if(!ad->naviframe);
791 ad->is_aul = EINA_FALSE; //unset flag
793 if (ad->content && elm_naviframe_top_item_get(ad->naviframe) != elm_naviframe_bottom_item_get(ad->naviframe))
794 elm_naviframe_item_pop_to(ad->content); //pop to calendar app's content
796 elm_exit(); //if there is no calendar app's contents, exit.
798 ad->request_view = CV_UNKNOWN;
801 ad->is_pause = EINA_TRUE;
806 static void cal_service(service_h service, void *user_data)
811 c_ret_if(!user_data);
813 struct appdata *ad = user_data;
815 __cal_main_select_view(service, ad);
817 if (ad->request_view == CV_NOTI) {
825 int ret = ug_destroy(ad->ug);
826 c_warn_if(ret, "ug_destroy() is failed.");
831 __cal_main_add_naviframe_content(ad);
834 elm_win_activate(ad->win);
836 evas_object_show(ad->win);
841 static void cal_device_orientation(app_device_orientation_e orientation, void *user_data)
843 c_retm_if(!user_data, "user_data is null.");
845 struct appdata *ad = user_data;
847 Eina_Bool is_landscape_mode = EINA_FALSE;
851 ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
853 switch (orientation){
854 case APP_DEVICE_ORIENTATION_0:
856 ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
858 case APP_DEVICE_ORIENTATION_90:
860 is_landscape_mode = EINA_TRUE;
861 ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
863 case APP_DEVICE_ORIENTATION_180:
865 ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
867 case APP_DEVICE_ORIENTATION_270:
869 is_landscape_mode = EINA_TRUE;
870 ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
876 if (ad->orientation == orientation)
879 ad->orientation = orientation;
881 ad->is_landscape_mode = is_landscape_mode;
883 if (ad->is_landscape_mode) {
891 elm_win_rotation_with_resize_set(ad->win, rotate_val);
893 cal_main_rotation(ad);
897 static void __cal_language_changed(void *user_data)
901 ug_send_event(UG_EVENT_LANG_CHANGE);
903 cal_lang_manager_apply();
906 static inline void __cal_check_first_day_of_week(int *first_day_of_week)
908 c_ret_if(!first_day_of_week);
910 int ret = vconf_get_int(CAL_VCONFKEY_FIRST_DAY_OF_WEEK, first_day_of_week);
911 c_warn_if(ret != 0, "vconf_get_int(CAL_VCONFKEY_FIRST_DAY_OF_WEEK) is failed.");
913 if (ret != 0 || *first_day_of_week == -1)
914 *first_day_of_week = cal_util_get_default_first_day_of_week();
917 static void __cal_region_format_changed(void *user_data)
921 struct appdata *ad = user_data;
924 __cal_check_first_day_of_week(&ad->wday_start);
926 ug_send_event(UG_EVENT_REGION_CHANGE);
928 cal_lang_manager_apply();
931 int main(int argc, char *argv[])
935 app_event_callback_s event_callback;
937 event_callback.create = cal_create;
938 event_callback.terminate = cal_terminate;
939 event_callback.pause = cal_pause;
940 event_callback.resume = cal_resume;
941 event_callback.service = cal_service;
942 event_callback.low_memory = NULL;
943 event_callback.low_battery = NULL;
944 event_callback.device_orientation = cal_device_orientation;
945 event_callback.language_changed = __cal_language_changed;
946 event_callback.region_format_changed = __cal_region_format_changed;
948 memset(&ad, 0x0, sizeof(struct appdata));
950 return app_efl_main(&argc, &argv, &event_callback, &ad);