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://www.tizenopensource.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.
20 #include <appcore-efl.h>
21 #include <Elementary.h>
24 #include <glib-object.h>
26 #include "worldclock.h"
27 #include "worldclock_data.h"
28 #include "worldclock_dlog.h"
29 #include "worldclock_gmt.h"
30 #include "worldclock_util.h"
31 #include "worldclock_fwk_icu.h"
32 #include "worldclock_add_view.h"
33 #include "worldclock_edit_view.h"
34 #include "worldclock_main_view.h"
35 #include "worldclock_detail_view.h"
36 #include "worldclock_ug_add_view.h"
38 #define USING_WORLDCLOCK_UG 1
40 /**********************************************************************
41 ******************define, struct ,typedef, union, enum, global val *************************************
42 ***********************************************************************/
43 //#define SECOND_UPDATE
51 Evas_Object *eo_parent; //parent
52 Evas_Object *eo_navibar; //navi_bar
53 Elm_Object_Item *ei_naviframe;
54 Evas_Object *eo_controlbar; //controlbar
55 Evas_Object *eo_btn_lft, *eo_btn_rht; //button
56 Elm_Object_Item *eci_btn_lft, *eci_btn_rht, *eci_btn_mid ;
57 Evas_Object *eo_btn_back; //button back
58 Evas_Object *eo_layout; //layout
59 Evas_Object *eo_content; //content
60 Evas_Object *ctxpopup;
62 Evas_Object *eo_genlist; //genlist
63 /*int total_number; //total number */
66 mouse_pos_t mouse_pos;
67 Wcl_Return_Cb return_cb;
68 Elm_Object_Item *egi_edit; //For store the main selected item;
69 Eina_Bool bIsReorderView;
72 /**********************************************************************
73 ******************Local function declear, extern function declear*************************************
74 ***********************************************************************/
75 static void __mainview_quit_cb(void *data, Evas_Object * obj, void *event_info);
76 static void __mainview_buttons_state_update(view_data * view);
77 static void __mainview_return_cb(Eina_Bool isReload);
78 static void __mainview_addview_return_cb(void *data, Eina_Bool isReload);
79 static void __mainview_show_addview_cb(void *data, Evas_Object * obj,
81 static void __mainview_back_button_cb(void *data, Evas_Object * obj,
83 static void __mainview_editview_return_cb(void *data, Eina_Bool isReload);
84 static void __mainview_show_editview_cb(void *data, Evas_Object * obj,
86 static void __mainview_detailview_return_cb(void *data, Eina_Bool isReload);
87 static void __mainview_show_detailview_cb(void *data, Evas_Object * obj,
89 static int __mainview_genlist_update_clock(void *data);
90 static char *__mainview_genlist_label_get(void *data, Evas_Object * obj,
92 static Evas_Object *__mainview_genlist_icon_get(void *data, Evas_Object * obj,
94 static void __mainview_genlist_item_sel(void *data, Evas_Object * obj,
96 static Evas_Object *__mainview_genlist_add(Evas_Object * parent, void *data);
97 static Eina_Bool __mainview_timer_cb(void *data);
98 static int __mainview_genlist_create(view_data * view);
99 static int __mainview_genlist_update(view_data * view);
101 /**********************************************************************
102 ******************Global val , static global val*************************************
103 ***********************************************************************/
105 static view_data *g_view_data = NULL;
106 static Elm_Genlist_Item_Class g_ts = {
107 .item_style = "worldclock_mainview_list",
108 .func.text_get = __mainview_genlist_label_get,
109 .func.content_get = __mainview_genlist_icon_get,
110 .func.state_get = NULL,
114 /**********************************************************************
115 ******************Local function ref*************************************
116 ***********************************************************************/
122 * @param[in] event_info
125 static void __mainview_quit_cb(void *data, Evas_Object * obj, void *event_info)
127 ret_if(!g_view_data);
128 view_data *view = g_view_data;
129 struct appdata *ad = view->ad;
132 // reset pointer to callback function
133 if (view->return_cb) {
134 view->return_cb(data, EINA_FALSE);
135 view->return_cb = NULL;
137 // remove default list used to store all appended cities
139 worldclock_util_glist_remove_all(ad->eina_list, EINA_TRUE);
140 ad->eina_list = NULL;
142 ECORE_TIMER_DELIF(view->timer);
143 EVAS_OBJECT_DELIF(view->eo_layout);
148 * Update the status about edit button according to the number of items in genlist
149 * If the number is zero, disable edit button
150 * If the number is at least one, enable edit button
154 static void __mainview_buttons_state_update(view_data * view)
156 ret_if(!view || !view->eo_genlist);
157 // get the count number of genlist
159 int count = elm_genlist_items_count(view->eo_genlist);
161 count >= WORLDCLOCK_MAX_CITY_COUNT ? EINA_FALSE : EINA_TRUE;
162 elm_object_item_disabled_set(view->eci_btn_rht, !bVisible);
163 bVisible = count >= 1 ? EINA_TRUE : EINA_FALSE;
164 elm_object_item_disabled_set(view->eci_btn_mid, !bVisible);
169 * Callback function used for relaunch mainview when exit from the next view
171 * @param[in] data Data used in this function
175 static void __mainview_return_cb(Eina_Bool isReload)
177 ret_if(!g_view_data);
178 view_data *view = g_view_data;
179 struct appdata *ad = view->ad;
183 __mainview_genlist_create(view);
185 __mainview_genlist_update(view);
187 // set controlbar visible
188 if (ad->controlbar_cb) {
189 ad->controlbar_cb(EINA_TRUE);
191 // update the status of edit button
192 if (!view->bIsReorderView) {
193 __mainview_buttons_state_update(view);
195 // capture idle image
196 if (ad->idle_capture_cb) {
197 ad->idle_capture_cb();
202 * Callback function used for append new city from add view
204 * @param[in] data Data used in this function
208 static void __mainview_addview_return_cb(void *data, Eina_Bool isReload)
210 ret_if(!g_view_data);
211 view_data *view = g_view_data;
212 struct appdata *ad = view->ad;
215 ad->page = WCL_PAGE_MAIN;
217 return __mainview_return_cb(isReload);
220 // Get data of new city
221 Wcl_CitySet *cs = (Wcl_CitySet *) data;
222 // prepend selected city into city list
223 ret = worldclock_insert_city_to_list(&(ad->eina_list), cs, 0);
224 // if append not success, free data return NULL
230 // write this record to database
231 worldclock_data_update_db_record(cs);
232 // append such record to genlist
233 elm_genlist_item_prepend(view->eo_genlist, &g_ts, cs,
234 NULL, ELM_GENLIST_ITEM_NONE,
235 __mainview_genlist_item_sel, cs);
237 // do others which need to process when exit from next view
238 __mainview_return_cb(isReload);
242 * Show add view in main view
244 * @param[in] data Data used in this function
245 * @param[in] obj Evas_Object which emit this event
246 * @param[in] event_info Information about this event
250 static void __mainview_show_addview_cb(void *data, Evas_Object * obj,
254 view_data *view = (view_data *) data;
255 struct appdata *ad = view->ad;
259 #if USING_WORLDCLOCK_UG
260 ret = worldclock_ug_addview_add(view->eo_parent, ad, __mainview_addview_return_cb);
262 ret = worldclock_addview_add(view->eo_parent, ad, __mainview_addview_return_cb);
264 if (ad->controlbar_cb) {
266 ad->controlbar_cb(EINA_FALSE);
270 ret_if(SUCCESS != ret);
272 ECORE_TIMER_DELIF(view->timer);
277 static void __mainview_back_button_cb(void *data, Evas_Object * obj,
281 Evas_Object *win = (Evas_Object *) data;
286 * Callback function used for append new city from add view
288 * @param[in] data Data used in this function
292 static void __mainview_editview_return_cb(void *data, Eina_Bool isReload)
294 ret_if(!g_view_data);
295 view_data *view = g_view_data;
296 struct appdata *ad = view->ad;
299 Elm_Object_Item *gli = NULL;
300 Elm_Object_Item *gli_next = NULL;
301 Wcl_CitySet *cs = NULL;
302 // get the first item in genlist
303 gli = elm_genlist_first_item_get(g_view_data->eo_genlist);
306 cs = (Wcl_CitySet *) elm_object_item_data_get(gli);
308 worldclock_data_get_city_status_from_db(cs);
310 // get the next genlist item
311 gli_next = elm_genlist_item_next_get(gli);
313 // if item unselected, remove it
315 // remove genlist item
316 elm_object_item_del(gli);
317 // remove eina list item
318 ad->eina_list = eina_list_remove(ad->eina_list, cs);
320 // go to next genlist item
323 worldclock_data_update_db_record(cs);
324 // do others which need to process when exit from next view
325 ad->page = WCL_PAGE_MAIN;
326 __mainview_return_cb(isReload);
329 static void __mainview_show_delview_cb(void *data, Evas_Object * obj,
333 view_data *view = (view_data *) data;
334 struct appdata *ad = view->ad;
335 if (view->ctxpopup != NULL) {
336 evas_object_del(view->ctxpopup);
337 view->ctxpopup = NULL;
340 if (ad->controlbar_cb) {
342 ad->controlbar_cb(EINA_FALSE);
346 worldclock_editview_add(view->eo_parent, ad,
347 __mainview_editview_return_cb);
348 ret_if(SUCCESS != ret);
350 ECORE_TIMER_DELIF(view->timer);
353 static void __mainview_dismiss_cb(void *data, Evas_Object * obj,
357 evas_object_del(obj);
363 * Callback function used for append new city from add view
365 * @param[in] data Data used in this function
369 static void __mainview_detailview_return_cb(void *data, Eina_Bool isReload)
371 ret_if(!g_view_data);
372 view_data *view = g_view_data;
373 if (data && view->egi_edit) {
374 // Get data of new city
375 Wcl_CitySet *cs = (Wcl_CitySet *) data;
378 Wcl_CitySet *cs2update =
379 (Wcl_CitySet *) elm_object_item_data_get(view->egi_edit);
380 // copy new data to it
381 worldclock_data_cityset_copy(cs2update, cs);
384 elm_genlist_item_update(view->egi_edit);
385 worldclock_data_update_db_record(cs2update);
386 view->egi_edit = NULL;
388 __mainview_return_cb(isReload);
392 * Show edit view in main view
394 * @param[in] data Data used in this function
395 * @param[in] obj Evas_Object who emit this event
396 * @param[in] event_info Information about such event
400 static void __mainview_show_detailview_cb(void *data, Evas_Object * obj,
403 ret_if(!data || !g_view_data);
404 view_data *view = g_view_data;
405 struct appdata *ad = view->ad;
409 if (ad->controlbar_cb) {
411 ad->controlbar_cb(EINA_FALSE);
414 Wcl_CitySet *cs = (Wcl_CitySet *) calloc(1, sizeof(Wcl_CitySet));
415 worldclock_data_cityset_copy(cs, (Wcl_CitySet *) data);
417 worldclock_detailview_add(view->eo_parent, ad,
418 __mainview_detailview_return_cb, cs);
419 ret_if(SUCCESS != ret);
421 ECORE_TIMER_DELIF(view->timer);
425 * update clock timer callback
428 * Update status of clock
433 static int __mainview_genlist_update_clock(void *data)
435 retv_if(!g_view_data, FAILED);
436 view_data *view = g_view_data;
437 struct appdata *ad = view->ad;
438 retv_if(!ad, FAILED);
439 Elm_Object_Item *gli = NULL;
440 Wcl_CitySet *cs = NULL;
442 retv_if(!view->eo_genlist, FAILED);
443 // get the first item in genlist
444 gli = elm_genlist_first_item_get(view->eo_genlist);
447 ad->home_cs = worldclock_data_get_local_city();
450 cs = (Wcl_CitySet *) elm_object_item_data_get(gli);
451 retv_if(!cs, FAILED);
454 elm_genlist_item_update(gli);
455 gli = elm_genlist_item_next_get(gli);
460 //////////////////////////// genlist related /////////////////////////////////////////////////
462 * Get label of given part in genlist item
464 * @param[in] data Data used in this function
465 * @param[in] obj Evas_Object who emit this event
466 * @param[in] part Name of the part in genlist item
468 * @return NULL if meet error
469 * Pointer to string in label
471 static char *__mainview_genlist_label_get(void *data, Evas_Object * obj,
474 retv_if(!data || !part || !g_view_data, NULL);
475 Wcl_CitySet *cs = (Wcl_CitySet *) data;
477 char buf[BUF_SIZE] = { 0 };
478 time_t ntime = worldclock_genlist_time_get(cs, g_view_data->ad);
479 if (IS_STR_EQUAL(part, "elm.text.time")) {
480 snprintf(buf, BUF_SIZE,
481 worldclock_icu_get_time_str(ntime, cs->tz_path));
482 } else if (IS_STR_EQUAL(part, "elm.text.date")) {
483 snprintf(buf, BUF_SIZE,
484 worldclock_icu_get_date_str(ntime, cs->tz_path));
485 } else if (IS_STR_EQUAL(part, "elm.text.city")) {
486 snprintf(buf, BUF_SIZE, _(cs->city));
487 /*BEG: limit max length 12 added by x536.gong in Wed Nov 30 23:09:34 PST 2011 */
488 int length = strlen(_(cs->city));
490 snprintf(&buf[12], BUF_SIZE - 12, "...");
492 /*END: limit max length 12 added by x536.gong in Wed Nov 30 23:09:34 PST 2011 */
499 * Get icon of given part in genlist item
501 * @param[in] data Data used in this function
502 * @param[in] obj Evas_Object who emit this event
503 * @param[in] part Name of the part in genlist item
505 * @return NULL if meet error
506 * Pointer to new icon
508 static Evas_Object *__mainview_genlist_icon_get(void *data, Evas_Object * obj,
511 retv_if(!data || !part || !g_view_data, NULL);
512 Wcl_CitySet *cs = (Wcl_CitySet *) data;
514 char buf[BUF_SIZE] = { 0, };
515 time_t ntime = worldclock_genlist_time_get(cs, g_view_data->ad);
517 worldclock_time_s *pWorldclock_time;
518 pWorldclock_time = worldclock_icu_get_time_int(ntime, cs->tz_path);
519 retv_if(!pWorldclock_time, NULL);
521 Eina_Bool bDay = EINA_FALSE;
522 if ((pWorldclock_time->hour < WCL_NIGHT_TIME)
523 && (pWorldclock_time->hour >= WCL_DAY_TIME)) {
526 Evas_Object *ly = NULL;
527 if (IS_STR_EQUAL(part, "elm.swallow.dst")) {
528 Evas_Object *ly = NULL;
530 // add layout for dst
531 ly = elm_layout_add(obj);
532 retv_if(ly == NULL, NULL);
534 elm_layout_file_set(ly, WCL_EDJ_NAME, "icon/dst");
535 evas_object_size_hint_weight_set(ly, 1.0, 0.0);
536 evas_object_size_hint_align_set(ly, 0.0, 0.5);
538 evas_object_show(ly);
542 } else if (IS_STR_EQUAL(part, "elm.swallow.bg")) {
545 bDay) ? WCL_IMAGE_PATH "/P03_worldclock_bg_day.png" :
546 WCL_IMAGE_PATH "/P03_worldclock_bg_night.png";
547 snprintf(buf, BUF_SIZE, image_path);
548 ly = elm_icon_add(obj);
549 Eina_Bool icon_set_ret_value = 0;
550 icon_set_ret_value = elm_icon_file_set(ly, buf, NULL);
551 evas_object_show(ly);
554 } else if (IS_STR_EQUAL(part, "elm.swallow.hour")) {
555 char *image_path_pre =
557 bDay) ? WCL_IMAGE_PATH
558 "/Day/hour/P03_worldclock_bg_day_hour_" : WCL_IMAGE_PATH
559 "/Night/hour/P03_worldclock_bg_night_hour_";
560 int hour = pWorldclock_time->hour % 12;
561 int min = pWorldclock_time->min;
562 snprintf(buf, BUF_SIZE, "%s%02d.png", image_path_pre,
563 hour * 5 + min / 12);
564 ly = elm_icon_add(obj);
565 elm_icon_file_set(ly, buf, NULL);
566 evas_object_show(ly);
569 } else if (IS_STR_EQUAL(part, "elm.swallow.min")) {
570 char *image_path_pre =
572 bDay) ? WCL_IMAGE_PATH
573 "/Day/minute/P03_worldclock_bg_day_minute_" : WCL_IMAGE_PATH
574 "/Night/minute/P03_worldclock_bg_night_minute_";
575 int min = pWorldclock_time->min;
576 snprintf(buf, BUF_SIZE, "%s%02d.png", image_path_pre, min);
577 ly = elm_icon_add(obj);
578 elm_icon_file_set(ly, buf, NULL);
579 evas_object_show(ly);
582 } else if (IS_STR_EQUAL(part, "elm.swallow.sec")) {
583 #ifndef SECOND_UPDATE
586 char *image_path_pre =
588 bDay) ? WCL_IMAGE_PATH
589 "/Day/second/P03_worldclock_bg_day_second_" : WCL_IMAGE_PATH
590 "/Night/second/P03_worldclock_bg_night_second_";
591 int sec = pWorldclock_time->sec;
592 snprintf(buf, BUF_SIZE, "%s%02d.png", image_path_pre, sec);
593 ly = elm_icon_add(obj);
594 elm_icon_file_set(ly, buf, NULL);
595 evas_object_show(ly);
599 } else if (IS_STR_EQUAL(part, "elm.swallow.center")) {
601 WCL_IMAGE_PATH "/P03_worldclock_bg_center_point.png";
602 snprintf(buf, BUF_SIZE, image_path);
603 ly = elm_icon_add(obj);
604 elm_icon_file_set(ly, buf, NULL);
605 evas_object_show(ly);
614 * Callback function which used for genlist selection event processing
616 * @param[in] data data which used in this function
617 * @param[in] obj the object which emit the selection event
618 * @param[in] event_info information about selection event
622 static void __mainview_genlist_item_sel(void *data, Evas_Object * obj,
625 retm_if(NULL_CHECK(data), "data error");
626 Elm_Object_Item *gli = (Elm_Object_Item *) (event_info);
627 elm_genlist_item_selected_set(gli, 0);
628 Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *) event_info;
629 ret_if(ev && (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD));
631 g_view_data->egi_edit = gli;
632 __mainview_show_detailview_cb(data, NULL, NULL);
636 * Create genlist to display all selected cities
638 * @param[in] parent Parent of new genlist
639 * @param[in] data Data used in this function
641 * @return NULL if meet error
642 * Pointer to new genlist
644 static Evas_Object *__mainview_genlist_add(Evas_Object * parent, void *data)
646 retv_if(!data, NULL);
647 struct appdata *ad = (struct appdata *)data;
648 Evas_Object *genlist = NULL;
651 genlist = elm_genlist_add(parent);
652 evas_object_resize(genlist, ad->root_w,
653 ad->root_h - INDICATOR_H * ad->root_h / YRES);
654 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND,
656 evas_object_size_hint_align_set(genlist, -1.0, -1.0);
659 edje_object_part_swallow(_EDJ(parent), "main/genlist", genlist);
661 evas_object_show(genlist);
666 /////////////////////////////////// genlist related finish /////////////////////////////////////////
669 * Callback function used for update clock status
671 * @param[in] data Data used in this function
673 * @return EINA_FALSE if invoke failed
674 * EINA_TRUE if successfully
676 static Eina_Bool __mainview_timer_cb(void *data)
679 retv_if(!data, EINA_FALSE);
680 struct appdata *ad = (struct appdata *)data;
681 // every minute, set a new timer
682 ECORE_TIMER_DELIF(g_view_data->timer);
683 // update content of clock in genlist item
684 __mainview_genlist_update_clock(ad);
685 #ifndef SECOND_UPDATE
686 struct tm local_time;
691 localtime_r(&ctime, &local_time);
694 ecore_timer_add(60 - local_time.tm_sec, __mainview_timer_cb, ad);
696 g_view_data->timer = ecore_timer_add(1, __mainview_timer_cb, ad);
705 * @param[in] data data used in this function
706 * @param[in] isReload Flag to define whether reload genlist data
710 static int __mainview_genlist_create(view_data * view)
712 retv_if(!view || !view->eo_genlist || !view->ad, FAILED);
713 struct appdata *ad = view->ad;
714 Eina_List *el = NULL;
715 Wcl_CitySet *cs = NULL;
719 worldclock_util_glist_remove_all(ad->eina_list, EINA_TRUE);
720 ad->eina_list = worldclock_data_get_all_added_city();
723 elm_genlist_clear(view->eo_genlist);
728 elm_genlist_clear(view->eo_genlist);
731 for (el = ad->eina_list; el; el = el->next) {
736 elm_genlist_item_append(view->eo_genlist, &g_ts, cs,
737 NULL, ELM_GENLIST_ITEM_NONE,
738 __mainview_genlist_item_sel, cs);
741 ECORE_TIMER_DELIF(view->timer);
742 // update time status
743 #ifndef SECOND_UPDATE
744 struct tm local_time;
746 double interval_time = 0.0;
750 localtime_r(&ctime, &local_time);
751 // update on the next miniute
752 interval_time = 60 - local_time.tm_sec;
753 // add timer to plan update
754 view->timer = ecore_timer_add(interval_time, __mainview_timer_cb, ad);
756 view->timer = ecore_timer_add(1, __mainview_timer_cb, ad);
766 * @param[in] data data used in this function
767 * @param[in] isReload Flag to define whether reload genlist data
771 static int __mainview_genlist_update(view_data * view)
773 retv_if(!view || !view->eo_genlist || !view->ad, FAILED);
774 struct appdata *ad = view->ad;
775 Eina_List *el = NULL;
776 Wcl_CitySet *cs = NULL;
777 if (NULL == ad->eina_list) {
778 // get all selected cities
779 ad->eina_list = worldclock_data_get_all_added_city();
781 // if eina_list exist, resort it
783 eina_list_sort(ad->eina_list, eina_list_count(ad->eina_list)
784 , worldclock_sequence_compare_cb);
786 retv_if(!ad->eina_list, FAILED);
787 for (el = ad->eina_list; el; el = el->next) {
792 ECORE_TIMER_DELIF(view->timer);
793 // update time status
794 #ifndef SECOND_UPDATE
795 struct tm local_time;
797 double interval_time = 0.0;
801 localtime_r(&ctime, &local_time);
802 // if not reload genlist, update immediately
804 // add timer to plan update
805 view->timer = ecore_timer_add(interval_time, __mainview_timer_cb, ad);
807 view->timer = ecore_timer_add(1, __mainview_timer_cb, ad);
812 /**********************************************************************
813 ******************Global function ref*************************************
814 ***********************************************************************/
818 * @param[in] data data used in this function
822 void worldclock_mainview_update(void *data)
824 // update content of clock in genlist item
825 __mainview_genlist_update_clock(data);
831 * @param[in] parent Parent view to main view
832 * @param[in] data Data used in this function
833 * @param[in] func Callback function register by previous view, which will be invoked when exit main view
835 * @return FAILED if meet error
836 * SUCCESS if create successfully
838 int worldclock_mainview_add(Evas_Object * parent, void *data,
841 retv_if(!data, FAILED);
842 struct appdata *ad = (struct appdata *)data;
845 view_data *view = CALLOC(1, view_data);
846 retv_if(!view, FAILED);
848 memset(view, 0, sizeof(view_data));
851 view->eo_parent = parent;
852 view->eo_navibar = ad->navi_bar;
854 view->return_cb = func;
855 view->bIsReorderView = EINA_FALSE;
856 ad->page = WCL_PAGE_MAIN;
858 const char *group_name = NULL;
859 // select call_flag & group name by caller
860 switch (ad->caller) {
861 case WCL_CALLER_IS_APP_IT_SELF:
862 group_name = GRP_MAIN;
864 case WCL_CALLER_IS_SHARED_LIBRARY:
865 group_name = GRP_MAIN2;
870 // add samsung window layout
871 view->eo_layout = widget_create_layout(view->eo_parent);
873 view->eo_content = load_edj(view->eo_layout, WCL_EDJ_NAME, group_name);
874 elm_object_part_content_set(view->eo_layout, "elm.swallow.content",
877 view->eo_genlist = __mainview_genlist_add(view->eo_content, ad);
879 __mainview_genlist_create(view);
882 /* create controlbar */
883 g_view_data->eo_controlbar = widget_create_controlbar(g_view_data->eo_navibar, NULL);
885 Elm_Object_Item *eci;
887 g_view_data->eci_btn_lft =
888 elm_toolbar_item_append( g_view_data->eo_controlbar, WCL_IMAGE_ADD, NULL,
889 __mainview_show_addview_cb,
892 eci = elm_toolbar_item_append(g_view_data->eo_controlbar, NULL,
894 elm_object_item_disabled_set(eci, EINA_TRUE);
896 g_view_data->eci_btn_mid =
897 elm_toolbar_item_append(g_view_data->eo_controlbar, NULL,
898 S_("IDS_COM_SK_EDIT"),
899 __mainview_show_delview_cb, g_view_data );
901 eci = elm_toolbar_item_append(g_view_data->eo_controlbar, NULL,
903 elm_object_item_disabled_set(eci, EINA_TRUE);
905 g_view_data->eo_btn_back =
906 widget_create_button(g_view_data->eo_controlbar,
907 "naviframe/end_btn/default", NULL, NULL,
908 __mainview_back_button_cb, ad->win);
910 // push mainview to navigationbar
911 g_view_data->ei_naviframe =
912 widget_naviframe_push(g_view_data->eo_navibar,
913 S_("IDS_COM_BODY_WORLD_CLOCK"),
914 g_view_data->eo_btn_back, NULL, g_view_data->eo_layout,
915 "tabbar", g_view_data->eo_controlbar);
916 // update state on main view
917 __mainview_buttons_state_update(g_view_data);
918 ad->controlbar_cb(EINA_TRUE);
924 * Free data used in main view
926 * @param[in] data Data used in this function
930 void worldclock_mainview_free(void *data)
934 #if USING_WORLDCLOCK_UG
935 worldclock_ug_addview_free(data);
937 worldclock_addview_free(data);
940 worldclock_editview_free(data);
941 __mainview_quit_cb(data, NULL, NULL);