50801f51aeef4922f11e79f72b28b2e8b1c345e2
[apps/core/preloaded/calendar.git] / ug / settings / ug-setting-export.c
1 /*
2   *
3   *  Copyright 2012  Samsung Electronics Co., Ltd
4   *
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
8   *
9   *       http://floralicense.org/license/
10   *
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.
16   */
17
18
19 #include <fcntl.h>
20 #include <vconf.h>
21
22 #include "cld.h"
23 #include "acct-svc.h"
24 #include "ug-settings.h"
25 #include "cld-images.h"
26
27 #define CAL_SETTING_EXPORT_ACCOUNT_LABLE_STRING_LENGTH 128
28
29 typedef struct {
30         struct ug_data *ugd;
31         Evas_Object *ly;
32         Evas_Object *genlist;
33         Evas_Object *box;
34
35         Evas_Object *select_all_layout;
36         Eina_Bool is_select_all_checked;
37         Evas_Object *select_all_check;
38
39         Eina_List *account_list;
40
41         Evas_Object *export_bt;
42
43         int checked_count;
44 } cal_setting_export_data;
45
46 typedef struct {
47         Eina_Bool is_checked;
48         Elm_Object_Item *item;
49         calendar_record_h calendar_book;
50         struct _acct *at;
51         Eina_Bool is_group_item;
52 } cal_setting_export_item_data;
53
54 static char *__cal_setting_get_export_genlist_item_label(void *data, Evas_Object *obj, const char *part);
55 static Evas_Object* __cal_setting_get_export_genlist_icon(void *item_data, Evas_Object *obj, const char *part);
56 static void __cal_setting_gl_export_genlist_del(void *data, Evas_Object *obj);
57 static char* __cal_setting_get_export_genlist_group_item_label(void *data, Evas_Object *obj, const char *part);
58 static void __cal_setting_del_export_genlist_group_item(void *data, Evas_Object *obj);
59 static char *__cal_setting_ug_export_account_guide_item_label(void *data, Evas_Object *obj, const char *part);
60 static void __cal_setting_del_export_genlist_group_item(void *data, Evas_Object *obj);
61 static void __cal_setting_check_changed_callback(void *data, Evas_Object *obj, void *event_info);
62 extern void cal_setting_export_calendar_myfile_ug(struct ug_data *ugd);
63
64 static Elm_Genlist_Item_Class itc_1text_2icon_2 = {
65         .item_style = "dialogue/1text.3icon.2",
66         .func.text_get = __cal_setting_get_export_genlist_item_label,
67         .func.content_get = __cal_setting_get_export_genlist_icon,
68         .func.del = __cal_setting_gl_export_genlist_del,
69 };
70
71 static Elm_Genlist_Item_Class it_group = {
72         .item_style = "grouptitle",
73         .func.text_get = __cal_setting_get_export_genlist_group_item_label,
74         .func.del = __cal_setting_del_export_genlist_group_item,
75 };
76
77 static Elm_Genlist_Item_Class itc_export_account_guide = {
78         .item_style = "multiline/1text",
79         .func.text_get = __cal_setting_ug_export_account_guide_item_label,
80         .func.content_get = NULL,
81         .func.state_get = NULL,
82         .func.del = __cal_setting_del_export_genlist_group_item,
83 };
84
85 static struct _acct def_at = { _CALENDAR_LOCAL_ACCOUNT_ID, "Local account", CAL_IMAGES_PHONE, NULL, NULL, };
86
87 static void __cal_setting_export_update_small_info(cal_setting_export_data *data)
88 {
89         c_ret_if(!data);
90
91         cal_setting_export_data *p = data;
92
93         if (!p->checked_count) {
94                 cal_util_hide_small_information(p->ly);
95                 return;
96         }
97
98         char lable_str[128] = { '\0'};
99
100         snprintf(lable_str, sizeof(lable_str), "%s (%d)", S_("IDS_COM_POP_SELECTED"), p->checked_count);
101
102         cal_util_show_small_information(p->ly, lable_str, 0.0);
103 }
104
105 static Evas_Object* __cal_setting_get_export_genlist_icon(void *item_data, Evas_Object *obj, const char *part)
106 {
107         c_retv_if(!item_data, NULL);
108         c_retv_if(!obj, NULL);
109
110         cal_setting_export_item_data *export_item_data = item_data;
111         Evas_Object *icon = NULL;
112         char* icon_path = NULL;
113
114         calendar_record_h calendar_book = export_item_data->calendar_book;
115         c_retvm_if(!calendar_book, NULL, "calendar_book is NULL");
116
117         Eina_Bool r = EINA_FALSE;
118         int cid = 0;
119         int aid = 0;
120
121         calendar_error_e error = CALENDAR_ERROR_NONE;
122
123         error = calendar_record_get_int(calendar_book, _calendar_book.id, &cid);
124         c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_int() is failed(%x)", error);
125
126         error = calendar_record_get_int(calendar_book, _calendar_book.account_id, &aid);
127         c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_int() is failed(%x)", error);
128
129         if (!CAL_STRCMP(part, "elm.icon.1")) {
130
131                 icon = elm_check_add(obj);
132                 c_retvm_if(icon == NULL, NULL, "elm_check_add returned null");
133
134                 evas_object_data_set(icon, "item_data", export_item_data);
135
136                 elm_check_state_pointer_set(icon, &export_item_data->is_checked);
137                 evas_object_propagate_events_set(icon, EINA_FALSE);
138
139                 evas_object_smart_callback_add(icon, "changed", __cal_setting_check_changed_callback, obj);
140         }
141
142         if (!CAL_STRCMP(part, "elm.icon.2")) {
143                 icon = elm_icon_add(obj);
144
145                 c_retvm_if(!icon, NULL, "elm_icon_add fail");
146
147                 if ( aid == _CALENDAR_LOCAL_ACCOUNT_ID) {
148                         r = elm_icon_file_set(icon, CAL_IMAGES_EDJ, CAL_IMAGES_PHONE);
149                 } else {
150                         icon_path = cal_account_svc_get_account_icon_path(aid);
151                         if(icon_path) {
152                                 r = elm_icon_file_set(icon, icon_path, NULL);
153                                 free(icon_path);
154                         }
155                 }
156
157                 if (!r) {
158                         ERR("the return value of elm_icon_file_set is %d", r);
159                         evas_object_del(icon);
160                         icon = NULL;
161                 } else {
162                         evas_object_show(icon);
163                 }
164         }
165
166         return icon;
167 }
168
169 static char* __cal_setting_get_export_genlist_group_item_label(void *data, Evas_Object *obj, const char *part)
170 {
171         c_retv_if(!data, NULL);
172
173         cal_setting_export_item_data *item_data = data;
174
175         if (!CAL_STRCMP(part, "elm.text")) {
176                 struct _acct *at = item_data->at;
177
178                 if (at->id == _CALENDAR_LOCAL_ACCOUNT_ID)
179                         return strdup(C_("IDS_CLD_POP_MY_PHONE"));
180
181                 return CAL_STRDUP(at->name);
182         }
183
184         return NULL;
185 }
186
187 static char *__cal_setting_get_export_genlist_item_label(void *data, Evas_Object *obj, const char *part)
188 {
189         c_retvm_if(!data, NULL, "data is null");
190         c_retvm_if(!part, NULL, "part is null");
191
192         cal_setting_export_item_data *item_data = data;
193
194         calendar_record_h calendar_book = item_data->calendar_book;
195         c_retvm_if(!calendar_book, NULL, "calendar_book is null");
196
197         char *name = NULL;
198         int cid = 0;
199
200         calendar_error_e error = CALENDAR_ERROR_NONE;
201
202         if (!CAL_STRCMP(part,"elm.text")) {
203                 if (!calendar_book) {
204                         ERR("calendar_book is null");
205                         return strdup(C_("IDS_CLD_OPT_PHONE_CALENDAR"));
206                 }
207
208                 error = calendar_record_get_int(calendar_book, _calendar_book.id, &cid);
209                 c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_int() is failed(%x)", error);
210
211                 if (cid == DEFAULT_EVENT_CALENDAR_BOOK_ID)
212                         return strdup(C_("IDS_CLD_BODY_MY_CALENDAR"));
213                 else if (cid == DEFAULT_TODO_CALENDAR_BOOK_ID)
214                         return strdup(C_("IDS_TASK_BODY_MY_TASK"));
215                 else if (cid == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID)
216                         return strdup(C_("IDS_CLD_MBODY_CONTACTS_BIRTHDAY"));
217
218                 error = calendar_record_get_str(calendar_book, _calendar_book.name, &name);
219                 c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_str() is failed(%x)", error);
220
221                 if (CAL_STRLEN(name))
222                         return name;
223                 else
224                         CAL_FREE(name);
225
226                 return strdup(C_("IDS_CLD_BODY_NO_TITLE"));
227         }
228
229         return NULL;
230 }
231
232 static void __cal_setting_del_export_genlist_group_item(void *data, Evas_Object *obj)
233 {
234         c_retm_if(!data, "data is null.");
235
236         cal_setting_export_item_data *data_item = data;
237
238         free(data_item);
239 }
240
241 static void __cal_setting_export_update_select_all(Evas_Object *genlist)
242 {
243         c_retm_if(!genlist, "genlist is null");
244
245         cal_setting_export_data *p = CAL_UTIL_GET_PRIV_DATA(genlist);
246         c_ret_if(!p);
247
248         Elm_Object_Item *item = elm_genlist_first_item_get(genlist);
249
250         p->is_select_all_checked = EINA_TRUE;
251
252         while (item) {
253                 cal_setting_export_item_data *item_data = elm_object_item_data_get(item);
254                 c_ret_if(!item_data);
255
256                 if (item_data->is_group_item) {
257                         item = elm_genlist_item_next_get(item);
258                         continue;
259                 }
260
261                 if (!item_data->is_checked) {
262                         p->is_select_all_checked = EINA_FALSE;
263                         break;
264                 }
265
266                 item = elm_genlist_item_next_get(item);
267         }
268
269         elm_check_state_set(p->select_all_check, p->is_select_all_checked);
270 }
271
272 static void __cal_setting_check_changed_callback(void *data, Evas_Object *obj, void *event_info)
273 {
274         c_retm_if(!data, "data is null");
275         c_retm_if(!obj, "obj is null");
276
277         cal_setting_export_data *p = evas_object_data_get(data, "priv");
278         c_ret_if(!p);
279
280         cal_setting_export_item_data *item_data = evas_object_data_get(obj, "item_data");
281         c_ret_if(!item_data);
282
283         item_data->is_checked = elm_check_state_get(obj);
284
285         if (item_data->is_checked) {
286                 p->checked_count++;
287         } else {
288                 p->checked_count--;
289         }
290
291         if (0 < p->checked_count) {
292                 elm_object_disabled_set(p->export_bt, EINA_FALSE);
293         } else {
294                 elm_object_disabled_set(p->export_bt, EINA_TRUE);
295         }
296
297         __cal_setting_export_update_select_all(data);
298
299         __cal_setting_export_update_small_info(p);
300 }
301
302 static void __cal_setting_gl_export_genlist_del(void *data, Evas_Object *obj)
303 {
304         c_retm_if(!data, "data is NULL");
305         cal_setting_export_item_data *info = data;
306
307         free(info);
308 }
309
310 static char *__cal_setting_ug_export_account_guide_item_label(void *data, Evas_Object *obj, const char *part)
311 {
312         return strdup(C_("IDS_CLD_BODY_EXPORT_S_PLANNER_DATA_FROM_YOUR_PHONE"));
313 }
314
315 static void __cal_setting_export_popup_list_sel(void *data, Evas_Object *obj, void *event_info)
316 {
317         c_retm_if(!data, "data is null");
318         c_retm_if(!obj, "obj is null");
319
320         cal_setting_export_item_data *item_data = data;
321
322         cal_setting_export_data *p = CAL_UTIL_GET_PRIV_DATA(obj);
323         c_ret_if(!p);
324
325         Elm_Object_Item *item = elm_genlist_selected_item_get(obj);
326         c_retm_if(!item, "elm_genlist_selected_item_get() returned null");
327
328         elm_genlist_item_selected_set(item, EINA_FALSE);
329
330         item_data->is_checked = !item_data->is_checked;
331         if (item_data->is_checked) {
332                 p->checked_count++;
333         } else {
334                 p->checked_count--;
335         }
336         if (item_data->item)
337                 elm_genlist_item_update(item_data->item);
338
339         __cal_setting_export_update_select_all(obj);
340
341         if (p->checked_count) {
342                 elm_object_disabled_set(p->export_bt, EINA_FALSE);
343         } else {
344                 elm_object_disabled_set(p->export_bt, EINA_TRUE);
345         }
346
347         __cal_setting_export_update_small_info(p);
348
349 }
350
351 static void __cal_setting_select_all(cal_setting_export_data *data)
352 {
353         c_ret_if(!data);
354
355         cal_setting_export_data *p = data;
356         Elm_Object_Item *item;
357         cal_setting_export_item_data *item_data;
358
359         p->checked_count = 0;
360
361         item = elm_genlist_first_item_get(p->genlist);
362         while (item) {
363                 item_data = elm_object_item_data_get(item);
364                 if (item_data->is_group_item) {
365                         item = elm_genlist_item_next_get(item);
366                         continue;
367                 }
368
369                 item_data->is_checked = p->is_select_all_checked;
370                 if (item_data->is_checked) {
371                         p->checked_count++;
372                 } else {
373                         p->checked_count = 0;
374                 }
375                 item = elm_genlist_item_next_get(item);
376         }
377         elm_genlist_realized_items_update(p->genlist);
378
379         if (0 < p->checked_count) {
380                 elm_object_disabled_set(p->export_bt, EINA_FALSE);
381         } else {
382                 elm_object_disabled_set(p->export_bt, EINA_TRUE);
383         }
384
385         __cal_setting_export_update_small_info(p);
386 }
387
388 static void __cal_setting_select_all_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
389 {
390         c_ret_if(!data);
391         c_ret_if(!obj);
392
393         int x, y, w, h;
394         cal_setting_export_data *p = data;
395         Evas_Event_Mouse_Up *ev = event_info;
396
397         if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
398                 return;
399
400         evas_object_geometry_get(obj, &x, &y, &w, &h);
401         if (ev->output.y < y || y + h < ev->output.y)
402                 return;
403
404         p->is_select_all_checked = !p->is_select_all_checked;
405         elm_check_state_set(p->select_all_check, p->is_select_all_checked);
406         __cal_setting_select_all(p);
407         __cal_setting_export_update_small_info(p);
408 }
409
410 static void __cal_setting_select_all_check_cb(void *data, Evas_Object *obj, void *event_info)
411 {
412         c_ret_if(!data);
413
414         __cal_setting_select_all(data);
415 }
416
417 static void __cal_setting_export_clear_list(cal_setting_export_data *p)
418 {
419         c_ret_if(!p);
420
421         struct _acct *at = eina_list_data_get(p->account_list);
422         if (at && at->data) {
423                 _calendar_free_record_list((Eina_List **)&at->data);
424                 at->data = NULL;
425         }
426
427         Eina_List *list = eina_list_next(p->account_list);
428         if (list) {
429
430                 Eina_List *l = NULL;
431                 at = NULL;
432                 EINA_LIST_FOREACH(list, l, at) {
433                         if (at && at->data)
434                                 _calendar_free_record_list((Eina_List **)&at->data);
435                 }
436
437                 cal_account_svc_free_account_list(&list);
438                 p->account_list = list;
439         }
440
441         p->checked_count = 0;
442 }
443
444 static void __cal_setting_export_layout_delete_callback(void *data, Evas *e, Evas_Object *obj, void *ei)
445 {
446         cal_setting_export_data *p = data;
447         c_ret_if(!p);
448
449         __cal_setting_export_clear_list(p);
450
451         free(p);
452 }
453 static void __cal_setting_export_button_callback(void *data, Evas_Object *obj, void *ei)
454 {
455         CAL_FN_START;
456
457         c_ret_if(!data);
458
459         cal_setting_export_data *p = data;
460         c_ret_if(!p->ugd);
461
462         Evas_Object *genlist = p->genlist;
463         c_retm_if(!genlist, "genlist is null");
464
465         Elm_Object_Item *item = NULL;
466         cal_setting_export_item_data *export_item_data = NULL;
467         item = elm_genlist_first_item_get(genlist);
468         while (item) {
469                 export_item_data = elm_object_item_data_get(item);
470                 c_retm_if(!export_item_data, "export_item_data is null");
471
472                 if (export_item_data->is_checked) {
473                         calendar_error_e error = CALENDAR_ERROR_NONE;
474
475                         calendar_record_h calendar_book = NULL;
476
477                         error = calendar_record_clone(export_item_data->calendar_book, &calendar_book);
478                         c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_clone() is failed(%x)", error);
479
480                         p->ugd->checked_calendar_list = eina_list_append(p->ugd->checked_calendar_list, calendar_book);
481                 }
482
483                 item = elm_genlist_item_next_get(item);
484         }
485
486         if (p->ugd->checked_calendar_list)
487                 cal_setting_export_calendar_myfile_ug(p->ugd);
488
489         CAL_FN_END;
490 }
491
492 static void __cal_setting_export_cancel_callback(void *data, Evas_Object *obj, void *ei)
493 {
494         CAL_FN_START;
495
496         c_ret_if(!data);
497
498         cal_setting_export_data *p = data;
499         c_ret_if(!p->ugd);
500
501         p->is_select_all_checked = EINA_FALSE;
502         p->checked_count = 0;
503
504         elm_object_signal_emit(p->ly, "hide,selection,info", "elm");
505
506         CAL_FN_END;
507 }
508
509 static void __cal_setting_export_create_select_all(cal_setting_export_data *p)
510 {
511         c_ret_if(!p);
512
513         p->select_all_layout = elm_layout_add(p->ugd->naviframe);
514         if (!p->select_all_layout) {
515                 ERR("elm_genlist_add(popup) returned null");
516                 evas_object_del(p->box);
517                 return;
518         }
519
520         elm_layout_theme_set(p->select_all_layout, "genlist", "item", "select_all/default");
521         evas_object_size_hint_weight_set(p->select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
522         evas_object_size_hint_align_set(p->select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
523         evas_object_event_callback_add(p->select_all_layout, EVAS_CALLBACK_MOUSE_UP, __cal_setting_select_all_mouse_up_cb, p);
524
525         p->select_all_check = elm_check_add(p->select_all_layout);
526         if (!p->select_all_check) {
527                 ERR("elm_genlist_add(popup) returned null");
528                 evas_object_del(p->box);
529                 evas_object_del(p->select_all_layout);
530                 return;
531         }
532
533         elm_check_state_pointer_set(p->select_all_check, &p->is_select_all_checked);
534         evas_object_smart_callback_add(p->select_all_check, "changed", __cal_setting_select_all_check_cb, p);
535         evas_object_propagate_events_set(p->select_all_check, EINA_FALSE);
536         elm_object_part_content_set(p->select_all_layout, "elm.icon", p->select_all_check);
537
538         elm_object_part_text_set(p->select_all_layout, "elm.text", S_("IDS_COM_BODY_SELECT_ALL"));
539         elm_box_pack_start(p->box, p->select_all_layout);
540         evas_object_show(p->select_all_layout);
541 }
542
543 static inline void __cal_setting_export_set_default_account(cal_setting_export_data *p)
544 {
545         c_ret_if(!p);
546
547         p->account_list = eina_list_append(p->account_list, &def_at);
548 }
549
550 static void __cal_setting_export_get_list(cal_setting_export_data *p)
551 {
552         c_ret_if(!p);
553
554         Eina_List *l;
555         struct _acct *at;
556
557         l = cal_account_svc_get_account_list();
558         if (l)
559                 p->account_list = eina_list_merge(p->account_list, l);
560
561         EINA_LIST_FOREACH(p->account_list, l, at)
562                 at->data = _calendar_get_calendar_book_list_with_account_id(at->id);
563 }
564
565 static void __cal_setting_export_update_genlist(cal_setting_export_data *p)
566 {
567         c_ret_if(!p);
568
569         Eina_List* l, *ll;
570         struct _acct *at;
571
572         cal_setting_export_item_data *export_item_data = NULL;
573
574         __cal_setting_export_clear_list(p);
575
576         elm_genlist_clear(p->genlist);
577
578         __cal_setting_export_set_default_account(p);
579
580         __cal_setting_export_get_list(p);
581
582         EINA_LIST_FOREACH(p->account_list, l, at) {
583                 if (at) {
584                         export_item_data = calloc(1, sizeof(cal_setting_export_item_data));
585                         c_ret_if(!export_item_data);
586
587                         export_item_data->is_checked = EINA_FALSE;
588                         export_item_data->at = at;
589                         export_item_data->is_group_item = EINA_TRUE;
590                         export_item_data->item = elm_genlist_item_append(p->genlist, &it_group, export_item_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
591                         c_ret_if(!export_item_data->item);
592
593                         elm_genlist_item_select_mode_set(export_item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
594
595                         calendar_record_h calendar_book = NULL;
596
597                         EINA_LIST_FOREACH(at->data, ll, calendar_book) {
598                                 if (calendar_book) {
599                                         export_item_data = calloc(1, sizeof(cal_setting_export_item_data));
600                                         c_ret_if(!export_item_data);
601
602                                         export_item_data->is_checked = EINA_FALSE;
603                                         export_item_data->calendar_book = calendar_book;
604                                         export_item_data->is_group_item = EINA_FALSE;
605                                         export_item_data->item = elm_genlist_item_append(p->genlist, &itc_1text_2icon_2, export_item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_setting_export_popup_list_sel, export_item_data);
606                                 }
607                         }
608                 }
609         }
610
611         export_item_data = calloc(1, sizeof(cal_setting_export_item_data));
612         c_ret_if(!export_item_data);
613
614         export_item_data->is_group_item = EINA_TRUE;
615         export_item_data->item = elm_genlist_item_append(p->genlist, &itc_export_account_guide, export_item_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
616         elm_genlist_item_select_mode_set(export_item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
617 }
618
619 void cal_setting_export_create_view(struct ug_data *data)
620 {
621         c_ret_if(!data);
622
623         struct ug_data *ugd = data;
624
625         cal_setting_export_data *p = calloc(1, sizeof(cal_setting_export_data));
626         c_ret_if(!p);
627
628         p->ugd = ugd;
629
630         p->ly = cal_util_add_layout(p->ugd->naviframe, "selectioninfo");
631         if(!p->ly)              {
632                 ERR("p->ly is NULL!");
633                 free(p);
634                 return;
635         }
636
637         evas_object_event_callback_add(p->ly, EVAS_CALLBACK_DEL, __cal_setting_export_layout_delete_callback, p);
638
639         p->box = elm_box_add(p->ly);
640         if(!p->box)
641         {
642                 ERR("elm_box_add is failed!");
643                 evas_object_del(p->ly);
644                 free(p);
645                 return;
646         }
647         evas_object_size_hint_weight_set(p->box, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
648         evas_object_size_hint_align_set(p->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
649
650         __cal_setting_export_create_select_all(p);
651
652         p->genlist = elm_genlist_add(p->box);
653         if (!p->genlist) {
654                 ERR("elm_genlist_add(popup) returned null");
655                 evas_object_del(p->box);
656                 evas_object_del(p->select_all_layout);
657                 return;
658         }
659
660         elm_genlist_mode_set(p->genlist, ELM_LIST_COMPRESS);
661
662         evas_object_size_hint_weight_set(p->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
663         evas_object_size_hint_align_set(p->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
664         evas_object_data_set(p->genlist, "check", p->select_all_check);
665         evas_object_data_set(p->genlist, "priv", p);
666
667         evas_object_show(p->genlist);
668         elm_box_pack_end(p->box, p->genlist);
669         evas_object_show(p->box);
670
671         elm_object_part_content_set(p->ly, "gen.swallow.contents", p->box);
672
673         __cal_setting_export_update_genlist(p);
674
675         Elm_Object_Item* navi_item = elm_naviframe_item_push(ugd->naviframe, C_("IDS_CLD_BODY_EXPORT_EVENTS_TASKS_ABB"), NULL, NULL, p->ly, NULL);
676         c_ret_if(!navi_item);
677
678         p->export_bt = cal_util_add_toolbar_button(ugd->naviframe, "toolbar_button1", C_("IDS_RSSR_OPT_EXPORT"), __cal_setting_export_button_callback, p);
679         elm_object_disabled_set(p->export_bt, EINA_TRUE);
680
681         Evas_Object *back_button = elm_object_item_part_content_get(navi_item, "prev_btn");
682         c_ret_if(!back_button);
683
684         evas_object_smart_callback_add(back_button, "clicked",  __cal_setting_export_cancel_callback, p);
685 }