Initialize Tizen 2.3
[apps/home/mobileprint.git] / mobileprint / app / pts_setting_view.c
1 /*
2 *  Mobileprint
3 *
4 * Copyright 2012  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://floralicense.org/license/
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #define _GNU_SOURCE
21 #include <stdio.h>
22 #include <string.h>
23 #include <efl_assist.h>
24 #include "pt_api.h"
25 #include "mobileprint.h"
26 #include "pts_common.h"
27 #include "pts_main_view.h"
28 #include "pts_setting_view.h"
29
30 static Elm_Genlist_Item_Class itc_normal_options;
31 static Elm_Genlist_Item_Class itc_tree_options;
32 static Elm_Genlist_Item_Class itc_printer;
33 static Elm_Genlist_Item_Class itc_separator;
34
35 static Elm_Genlist_Item_Class itc_paper_size;
36 static Elm_Genlist_Item_Class itc_paper_quality;
37 static Elm_Genlist_Item_Class itc_paper_type;
38 static Elm_Genlist_Item_Class itc_grayscale;
39 static Elm_Genlist_Item_Class itc_page_range;
40 static Elm_Genlist_Item_Class itc_duplex;
41
42 static Evas_Coord touch_x;
43 static Evas_Coord touch_y;
44 static Evas_Object *copies_popup = NULL;
45
46 static void __pts_setting_view_leave_view(pts_appdata_t *ad)
47 {
48         PTS_IF_DEL_OBJ(ad->setting_info.radio_group_paper_size);
49         PTS_IF_DEL_OBJ(ad->setting_info.radio_group_paper_quality);
50         PTS_IF_DEL_OBJ(ad->setting_info.radio_group_paper_type);
51         PTS_IF_DEL_OBJ(ad->setting_info.radio_group_page_range);
52         PTS_IF_DEL_OBJ(ad->setting_info.radio_group_grayscale);
53         PTS_IF_DEL_OBJ(ad->setting_info.radio_group_duplex);
54         elm_naviframe_item_pop_to(ad->main_info.navi_it);
55 }
56
57 /*
58 *  the response callback when click back button
59 */
60 static Eina_Bool __pts_setting_view_btn_back_cb(void *data, Elm_Object_Item *it)
61 {
62         PTS_TRACE_BEGIN;
63
64         pts_appdata_t *ad = (pts_appdata_t *)data;
65
66         PTS_RETV_IF(ad == NULL, EINA_TRUE, "ad is NULL");
67
68         __pts_setting_view_leave_view(ad);
69
70         if (ad->list_info.active_printer == NULL) {
71                 PTS_DEBUG("No active printer. So just exit mobileprint");
72                 pt_deinit();
73                 elm_exit();
74                 PTS_TRACE_END;
75                 return EINA_TRUE;
76         }
77
78         pts_main_view_update_printer_label(ad);
79         pts_main_view_rotate_image(ad, app_get_device_orientation());
80         PTS_TRACE_END;
81         return EINA_TRUE;
82 }
83
84 static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info)
85 {
86         PTS_IF_DEL_OBJ(copies_popup);
87 }
88
89 static void _copies_picker_cb(void *data, Evas_Object *obj, void *event_info)
90 {
91         PTS_TRACE_BEGIN;
92         int copies = 1;
93         pts_appdata_t *ad  = (pts_appdata_t *)data;
94         Elm_Object_Item *item = event_info;
95
96         const char *label = elm_object_item_text_get(item);
97
98         PTS_RET_IF(label == NULL, "label is NULL");
99
100         copies = atoi(label);
101         if (copies == ad->list_info.active_printer->copies) {
102                 PTS_DEBUG("Not changed\n");
103                 PTS_TRACE_END;
104                 return;
105         } else {
106                 PTS_DEBUG("text(%s) is clicked!\n", label);
107                 ad->list_info.active_printer->copies = copies;
108                 elm_genlist_item_selected_set(ad->setting_info.item_paper_copies, EINA_FALSE);
109                 elm_genlist_item_update(ad->setting_info.item_paper_copies);
110
111                 PTS_IF_DEL_OBJ(copies_popup);
112         }
113         PTS_TRACE_END;
114 }
115
116 static void _move_copies_popup(Evas_Object *copies_popup, Evas_Object *win)
117 {
118         Evas_Coord w, h;
119         Evas_Coord x, y;
120
121         evas_object_geometry_get(win, &x, &y, &w, &h);
122         evas_object_move(copies_popup, x+(w*0.06), touch_y);
123 }
124
125 static void __on_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
126 {
127         PTS_DEBUG("copies popup show\n");
128 }
129
130 static void __on_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
131 {
132         PTS_DEBUG("copies popup hide\n");
133 }
134
135 /**
136  * Copies picker create
137  */
138 static void _create_copies_popup_timepicker(void *data, Evas_Object *obj, void *event_info)
139 {
140         PTS_TRACE_BEGIN;
141
142         int idx;
143         Evas_Object *diskselector;
144         Evas_Coord w;
145         char buffer[4];
146         char current_selection[4];
147
148         pts_appdata_t *ad  = (pts_appdata_t *)data;
149         elm_genlist_item_selected_set(ad->setting_info.item_paper_copies, EINA_TRUE);
150
151         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
152         if (event_info) {
153                 elm_genlist_item_selected_set(event_info, EINA_FALSE);
154         }
155
156         PTS_IF_DEL_OBJ(copies_popup);
157
158         evas_object_geometry_get(ad->main_info.root_win, NULL, NULL, &w, NULL);
159         copies_popup = elm_ctxpopup_add(ad->main_info.navi);
160         //elm_object_style_set(copies_popup, "timepicker");
161         elm_object_style_set(copies_popup, "datetime/default");
162         evas_object_size_hint_min_set(copies_popup, w, -1);
163         evas_object_size_hint_weight_set(copies_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
164         evas_object_smart_callback_add(copies_popup, "dismissed", _dismissed_cb, copies_popup);
165         evas_object_event_callback_add(copies_popup, EVAS_CALLBACK_SHOW, __on_show, ad);
166         evas_object_event_callback_add(copies_popup, EVAS_CALLBACK_HIDE, __on_hide, ad);
167
168         diskselector = elm_diskselector_add(ad->main_info.navi);
169         elm_diskselector_display_item_num_set(diskselector, 8);
170         //elm_object_style_set(diskselector, "timepicker");
171         elm_object_style_set(diskselector, "datetime/default");
172
173         snprintf(current_selection, 4, "%d", ad->list_info.active_printer->copies);
174
175         for (idx = 1; idx < COPIES_MAX+1; idx++) {
176                 snprintf(buffer, 4, "%d", idx);
177
178                 if (strcmp(current_selection, buffer) == 0) {
179                         item = elm_diskselector_item_append(diskselector, buffer, NULL, _copies_picker_cb, ad);
180                 } else {
181                         elm_diskselector_item_append(diskselector, buffer, NULL, _copies_picker_cb, ad);
182                 }
183         }
184
185         if (item != NULL) {
186                 elm_diskselector_item_selected_set(item, EINA_TRUE);
187         }
188
189         elm_diskselector_round_enabled_set(diskselector, EINA_TRUE);
190         evas_object_size_hint_weight_set(diskselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
191         evas_object_size_hint_align_set(diskselector, EVAS_HINT_FILL, EVAS_HINT_FILL);
192
193         evas_object_show(diskselector);
194         elm_object_content_set(copies_popup, diskselector);
195
196         elm_ctxpopup_direction_priority_set(copies_popup, ELM_CTXPOPUP_DIRECTION_DOWN,
197                                                                                 ELM_CTXPOPUP_DIRECTION_UP,
198                                                                                 ELM_CTXPOPUP_DIRECTION_LEFT,
199                                                                                 ELM_CTXPOPUP_DIRECTION_RIGHT);
200
201         _move_copies_popup(copies_popup, ad->main_info.root_win);
202         evas_object_show(copies_popup);
203
204         PTS_TRACE_END;
205 }
206
207 /**
208 *  Callback for expandable genlist selection
209 */
210 static void __pts_setting_view_gl_sel(void *data, Evas_Object *obj, void *event_info)
211 {
212         PTS_TRACE_BEGIN;
213
214         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
215         Eina_Bool expand_state = EINA_FALSE;
216         if (event_info) {
217                 elm_genlist_item_selected_set(event_info, EINA_FALSE);
218         }
219
220         expand_state = elm_genlist_item_expanded_get(item);
221         elm_genlist_item_expanded_set(item, !expand_state);
222         PTS_DEBUG("expanded : %d", expand_state);
223
224         PTS_TRACE_END;
225 }
226
227 void pts_setting_view_printer_select_done_cb(void *userdata)
228 {
229         PTS_TRACE_BEGIN;
230         struct appdata *ad = pts_get_appdata();
231
232         Elm_Object_Item *item = (Elm_Object_Item *)userdata;
233         elm_genlist_item_update(item);
234
235         if (ad->list_info.active_printer) {
236                 pts_create_setting_view(ad);
237         }
238
239         PTS_TRACE_END;
240         return;
241 }
242
243 /**
244 *  Callback for expandable genlist selection
245 */
246 static void __pts_setting_view_printer_sel(void *data, Evas_Object *obj, void *event_info)
247 {
248         PTS_TRACE_BEGIN;
249
250         pts_appdata_t *ad = (pts_appdata_t *)data;
251         if (event_info) {
252                 elm_genlist_item_selected_set(event_info, EINA_FALSE);
253         }
254
255         if (ad->search_info.popup != NULL
256                 || ad->list_info.no_found_popup != NULL
257                 || ad->list_info.printer_list_popup != NULL) {
258                 PTS_WARN("event was called duplicated, it is ignored");
259                 return;
260         }
261
262         // Launch Print searching module
263         ad->search_info.print_search_mode = PTS_SEARCH_IN_SETTING;
264         ad->search_info.selection_done_cb = pts_setting_view_printer_select_done_cb;
265         ad->search_info.print_search_popup_parent = ad->main_info.navi;
266         ad->search_info.printer_search_user_data = (void *)event_info;
267         pts_search_printer(ad);
268
269         PTS_TRACE_END;
270 }
271
272 /**
273 *  Callback for expandable genlist contract
274 */
275 static void __pts_setting_view_gl_con(void *data, Evas_Object *obj, void *event_info)
276 {
277         Elm_Object_Item *item = event_info;
278         elm_genlist_item_subitems_clear(item);
279 }
280
281 /*
282 *  get the label of the printer information
283 */
284 static char *__pts_setting_view_printer_label_get(void *data, Evas_Object *obj, const char *part)
285 {
286         PTS_TRACE_BEGIN;
287         struct appdata *ad = pts_get_appdata();
288         if (strcmp(part, "elm.text.1") == 0) {
289                 //if (printer != NULL) {
290                 //return strdup(printer->name);
291                 PTS_TRACE_END;
292                 return strdup(_("IDS_PRT_BODY_PRINTER"));
293                 //}
294         } else if (strcmp(part, "elm.text.2") == 0) {
295                 //if (printer != NULL) {
296                 if (ad->list_info.active_printer != NULL) {
297                         char *printer_label = strdup(ad->list_info.active_printer->name);
298                         pts_unstandardization(printer_label);
299                         //return strdup(printer->address);
300                         PTS_TRACE_END;
301                         return printer_label;
302                 } else {
303                         PTS_TRACE_END;
304                         return strdup(PTS_18);
305                 }
306         }
307         PTS_TRACE_END;
308         return NULL;
309 }
310
311 /*
312 *  get the label of the option setting
313 */
314 #define MAX_TMP_BUF 64
315 static char *__pts_setting_view_option_label_get(void *data, Evas_Object *obj, const char *part)
316 {
317         PTS_TRACE_BEGIN;
318         struct appdata *ad = pts_get_appdata();
319         pt_printer_mgr_t *active_printer = ad->list_info.active_printer;
320         pt_print_option_e option_type = (pt_print_option_e)data;
321
322         char buf[MAX_TMP_BUF];
323
324         if (strcmp(part, "elm.text.1") == 0) {
325                 switch (option_type) {
326                 case PT_OPTION_ID_COPIES:
327                         return strdup(_("IDS_PRT_BODY_NUMBEROFCOPIES"));
328                 case PT_OPTION_ID_PAPERSIZE:
329                         return strdup(_("IDS_PRT_BODY_PAPERSIZE"));
330                 case PT_OPTION_ID_RANGE:
331                         return strdup(_("IDS_PRT_BODY_PRINT_RANGE_ABB"));
332                 case PT_OPTION_ID_GRAYSCALE:
333                         return strdup(_("IDS_PRT_BODY_COLOUR"));
334                 case PT_OPTION_ID_QUALITY:
335                         return strdup(_("IDS_PRT_BODY_PRINTSETTINGS_PRINT_QUALITY"));
336                 case PT_OPTION_ID_PAPER:
337                         return strdup(_("IDS_IMGE_BUTTON_PAPER_M_STICKER"));
338                 case PT_OPTION_ID_DUPLEX:
339                         return strdup(IDS_PRINT_SETTINGS_DUPLEX);
340                 default:
341                         return strdup(PTS_17);
342                 }
343         } else if (strcmp(part, "elm.text.2") == 0) {
344
345                 switch (option_type) {
346                 case PT_OPTION_ID_COPIES: {
347                         snprintf(buf, MAX_TMP_BUF, "%d", active_printer->copies);
348                         PTS_DEBUG("Selected copies[%d, %s]",active_printer->copies, buf);
349                 }
350                 break;
351                 case PT_OPTION_ID_PAPERSIZE: {
352                         active_printer->size = pt_get_selected(PT_OPTION_ID_PAPERSIZE);
353                         strncpy(buf, pt_get_print_option_papersize(active_printer->size), MAX_TMP_BUF-1);
354                         PTS_DEBUG("Selected paper size[%d, %s]", active_printer->size, buf);
355                 }
356                 break;
357                 case PT_OPTION_ID_RANGE: {
358                         pt_range_e p_range = active_printer->range;
359                         if (PT_RANGE_ALL == p_range) {
360                                 strcpy(buf, _("IDS_DIC_BODY_ALL"));
361                         } else {
362                                 strcpy(buf, _("IDS_BR_BODY_CURRENT_PAGE"));
363                         }
364                         PTS_DEBUG("Selected range[%d, %s]", p_range, buf);
365                 }
366                 break;
367                 case PT_OPTION_ID_GRAYSCALE: {
368                         int p_grayscale = pt_get_selected(PT_OPTION_ID_GRAYSCALE);
369
370                         if (PT_GRAYSCALE_COLOUR == p_grayscale) {
371                                 strcpy(buf, _("IDS_PRT_BODY_COLOUR"));
372                         } else if (PT_GRAYSCALE_GRAYSCALE == p_grayscale) {
373                                 strcpy(buf, _("IDS_IMGE_HEADER_GREY"));
374                         } /* else if (PT_GRAYSCALE_BLACKNWHITE == *p_value) {
375 strcpy(buf, _("IDS_BR_OPT_BLACKNWHITE"));
376 } */
377
378                         PTS_DEBUG("Selected color [%d, %s]", p_grayscale, buf);
379                 }
380                 break;
381                 case PT_OPTION_ID_QUALITY: {
382                         int p_quality = pt_get_selected(PT_OPTION_ID_QUALITY);
383                         if (PT_QUALITY_DRAFT == p_quality) {
384                                 strcpy(buf, _("IDS_PRT_OPT_PRINTSETTINGS_DRAFT"));
385                         } else if (PT_QUALITY_STANDARD == p_quality) {
386                                 strcpy(buf, _("IDS_PRT_OPT_PRINTSETTINGS_STANDARD"));
387                         } else if (PT_QUALITY_HIGH == p_quality) {
388                                 strcpy(buf, _("IDS_COM_BODY_HIGH"));
389                         }
390                         PTS_DEBUG("Selected quality [%d, %s]", p_quality, buf);
391                 }
392                 break;
393                 case PT_OPTION_ID_PAPER: {
394                         int p_type = pt_get_selected(PT_OPTION_ID_PAPER);
395                         if (PT_PAPER_NORMAL == p_type) {
396                                 strcpy(buf, _("IDS_ST_BODY_NORMAL"));
397                         } else if (PT_PAPER_GLOSSY == p_type) {
398                                 strcpy(buf, _("IDS_ST_BODY_GLOSSY"));
399                         } else if (PT_PAPER_PHOTO == p_type) {
400                                 strcpy(buf, _("IDS_PRT_BODY_PHOTOGRAPHIC_ABB"));
401                         }
402                         PTS_DEBUG("Selected paper type [%d, %s]", p_type, buf);
403                 }
404                 break;
405                 case PT_OPTION_ID_DUPLEX: {
406                         int p_dup = pt_get_selected(PT_OPTION_ID_DUPLEX);
407                         if (PT_DUPLEX_OFF == p_dup) {
408                                 strcpy(buf, IDS_PRINT_SETTINGS_DUPLEX_OFF);
409                         } else if (PT_DUPLEX_NO_TUMBLE == p_dup || PT_DUPLEX_TUMBLE == p_dup) {
410                                 strcpy(buf, IDS_PRINT_SETTINGS_DUPLEX_ON);
411                         }
412                         PTS_DEBUG("Selected duplex mode [%d, %s]", p_dup, buf);
413                 }
414                 break;
415                 default: {
416                         return strdup(PTS_17);
417                 }
418                 }
419
420                 return strdup(buf);
421         }
422         PTS_TRACE_END;
423         return NULL;
424 }
425
426
427
428 static Evas_Object *
429 __pts_setting_view_gl_content_get(void *data, Evas_Object *obj, const char *part)
430 {
431         PTS_TRACE_BEGIN;
432         pts_appdata_t *ad = pts_get_appdata();
433         Evas_Object *radio_button = NULL;
434         Item_data *core = (Item_data *)data;
435         int selected = 0;
436
437         if (!strcmp(part, "elm.icon")) {
438                 switch (core->option) {
439                 case PT_OPTION_ID_PAPERSIZE:
440                         selected = pt_get_selected(PT_OPTION_ID_PAPERSIZE);
441                         break;
442                 case    PT_OPTION_ID_RANGE:
443                         selected = ad->list_info.active_printer->range;
444                         break;
445                 case    PT_OPTION_ID_QUALITY:
446                         selected = pt_get_selected(PT_OPTION_ID_QUALITY);
447                         break;
448                 case    PT_OPTION_ID_PAPER:
449                         selected = pt_get_selected(PT_OPTION_ID_PAPER);
450                         break;
451                 case    PT_OPTION_ID_GRAYSCALE:
452                         selected = pt_get_selected(PT_OPTION_ID_GRAYSCALE);
453                         break;
454                 case PT_OPTION_ID_DUPLEX:
455                         selected = pt_get_selected(PT_OPTION_ID_DUPLEX);
456                         break;
457                         /* case    PT_OPTION_ID_COPIES: */
458                 default:
459                         break;
460                 }
461
462                 PTS_DEBUG("Create Radio button[%d] (%d,%d) , r_group= [0x%x] selected: %d",
463                         core->radio_index, core->option, core->sub_item, core->radio_group, selected);
464
465                 radio_button  = elm_radio_add(obj);
466                 core->radio_btn = radio_button;
467                 evas_object_propagate_events_set(radio_button, EINA_TRUE);
468                 elm_radio_state_value_set(radio_button, core->radio_index);
469                 elm_radio_group_add(radio_button, core->radio_group);
470                 elm_radio_value_set(core->radio_group, selected);
471                 evas_object_show(radio_button);
472                 evas_object_size_hint_weight_set(radio_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
473                 evas_object_size_hint_align_set(radio_button, EVAS_HINT_FILL, EVAS_HINT_FILL);
474
475                 PTS_TRACE_END;
476                 return radio_button ;
477         }
478
479         PTS_TRACE_END;
480         return NULL;
481 }
482
483
484 static void
485 __pts_setting_view_gl_state_item_delete(void *data, Evas_Object *obj)
486 {
487         PTS_TRACE_BEGIN;
488         PTS_RET_IF(data == NULL, "data is NULL");
489         Item_data *core = (Item_data *)data;
490         pts_appdata_t *ad = pts_get_appdata();
491         PTS_RET_IF(ad == NULL, "ad is NULL");
492
493         switch (core->option) {
494         case    PT_OPTION_ID_QUALITY:
495                 ad->setting_info.quality[core->sub_item] = NULL;
496                 break;
497         case    PT_OPTION_ID_PAPER:
498                 ad->setting_info.paper_type[core->sub_item] = NULL;
499                 break;
500         case    PT_OPTION_ID_GRAYSCALE:
501                 ad->setting_info.color[core->sub_item] = NULL;
502                 break;
503         case PT_OPTION_ID_PAPERSIZE:
504                 ad->setting_info.paper_size[core->sub_item] = NULL;
505                 break;
506         case PT_OPTION_ID_DUPLEX:
507                 ad->setting_info.duplex[core->sub_item] = NULL;
508                 break;
509         default:
510                 break;
511         }
512         PTS_DEBUG("Free core memory");
513         PTS_IF_FREE_MEM(core);
514
515         return;
516 }
517
518 /*
519 * get the papersize value of the key
520 */
521 static char *__pts_setting_view_papersize_key_label_get(void *data, Evas_Object *obj, const char *part)
522 {
523         PTS_TRACE_BEGIN;
524         Item_data *core = (Item_data *)data;
525         pt_paper_size_e p_size = (pt_paper_size_e)core->sub_item;
526
527         if (p_size < (pt_paper_size_e)0 || p_size >=  pt_get_print_option_papersize_num()) {
528                 PTS_DEBUG("wrong paper size: %d", p_size);
529                 return NULL;
530         }
531         PTS_TRACE_END;
532         return strdup(pt_get_print_option_papersize(p_size));
533 }
534
535 /*
536 * get the grayscale value of the key
537 */
538 static char *__pts_setting_view_grayscale_key_label_get(void *data, Evas_Object *obj, const char *part)
539 {
540         PTS_TRACE_BEGIN;
541         Item_data *core = (Item_data *)data;
542         pt_grayscale_e p_grayscale = (pt_grayscale_e)core->sub_item;
543         char *ret = NULL;
544
545         //PTS_RETV_IF(p_grayscale < 0 ||p_grayscale >= PT_GRAYSCALE_ANY, NULL, "wrong gray scale: %d", p_grayscale);
546
547         if (strcmp(part, "elm.text") == 0) {
548                 switch (p_grayscale) {
549                 case PT_GRAYSCALE_COLOUR:
550                         ret = strdup(_("IDS_PRT_BODY_COLOUR"));
551                         break;
552                 case PT_GRAYSCALE_GRAYSCALE:
553                         ret = strdup(_("IDS_IMGE_HEADER_GREY"));
554                         break;
555                 default:
556                         ret =  NULL;
557                 }
558         }
559         PTS_TRACE_END;
560         return ret;
561 }
562
563 /*
564 * get the quality value of the key
565 */
566 static char *__pts_setting_view_quality_key_label_get(void *data, Evas_Object *obj, const char *part)
567 {
568         PTS_TRACE_BEGIN;
569         Item_data *core = (Item_data *)data;
570         pt_quality_e p_quality = (pt_quality_e)core->sub_item;
571         char *ret = NULL;
572
573         //PTS_RETV_IF(p_quality < 0 || p_quality >= PT_QUALITY_ANY, NULL, "wrong paper quality: %d", p_quality);
574
575         if (strcmp(part, "elm.text") == 0) {
576                 switch (p_quality) {
577                 case 0:
578                         ret = strdup(_("IDS_PRT_OPT_PRINTSETTINGS_DRAFT"));
579                         break;
580                 case 1:
581                         ret = strdup(_("IDS_PRT_OPT_PRINTSETTINGS_STANDARD"));
582                         break;
583                 case 2:
584                         ret = strdup(_("IDS_COM_BODY_HIGH"));
585                         break;
586                 default:
587                         ret = NULL;
588                 }
589         }
590         PTS_TRACE_END;
591         return ret;
592 }
593
594 /**
595 * get the paper type value of the key
596 */
597 static char *__pts_setting_view_paper_key_label_get(void *data, Evas_Object *obj, const char *part)
598 {
599         PTS_TRACE_BEGIN;
600         Item_data *core = (Item_data *)data;
601         pt_papertype_e p_type = (pt_papertype_e) core->sub_item;
602         char *ret = NULL;
603
604         //PTS_RETV_IF(p_type < 0 || p_type >= PT_PAPER_ANY, NULL, "wrong paper type: %d", p_type);
605
606         if (strcmp(part, "elm.text") == 0) {
607                 switch (p_type) {
608                 case 0:
609                         ret = strdup(_("IDS_ST_BODY_NORMAL"));
610                         break;
611                 case 1:
612                         ret = strdup(_("IDS_ST_BODY_GLOSSY"));
613                         break;
614                 case 2:
615                         ret = strdup(_("IDS_PRT_BODY_PHOTOGRAPHIC_ABB"));
616                         break;
617                 default:
618                         ret = NULL;
619                 }
620         }
621         PTS_TRACE_END;
622         return ret;
623 }
624
625 /*
626 * get the range label of the key
627 */
628 static char *__pts_setting_view_range_key_label_get(void *data, Evas_Object *obj, const char *part)
629 {
630         PTS_TRACE_BEGIN;
631         Item_data *core = (Item_data *)data;
632         pt_range_e p_range = (pt_range_e)core->sub_item;
633         char *ret = NULL;
634
635         //PTS_RETV_IF(p_range < PT_RANGE_ALL || p_range > PT_RANGE_CURRENT, NULL, "wrong paper range: %d", p_range);
636
637         switch (p_range) {
638         case PT_RANGE_ALL:
639                 ret = strdup(_("IDS_DIC_BODY_ALL"));
640                 break;
641         case PT_RANGE_CURRENT:
642                 ret = strdup(_("IDS_BR_BODY_CURRENT_PAGE"));
643                 break;
644         default:
645                 ret = NULL;
646         }
647
648         PTS_TRACE_END;
649         return ret;
650 }
651
652 /*
653 * get the duplex value of the key
654 */
655 static char *__pts_setting_view_duplex_key_label_get(void *data, Evas_Object *obj, const char *part)
656 {
657         PTS_TRACE_BEGIN;
658         Item_data *core = (Item_data *)data;
659         pt_duplex_e p_duplex = (pt_duplex_e)core->sub_item;
660         char *ret = NULL;
661
662         if (strcmp(part, "elm.text") == 0) {
663                 switch (p_duplex) {
664                 case PT_DUPLEX_OFF:
665                         ret = strdup(IDS_PRINT_SETTINGS_DUPLEX_OFF);
666                         break;
667                 case PT_DUPLEX_NO_TUMBLE:
668                 case PT_DUPLEX_TUMBLE:
669                         ret = strdup(IDS_PRINT_SETTINGS_DUPLEX_ON);
670                         break;
671                 default:
672                         ret =  NULL;
673                 }
674         }
675         PTS_TRACE_END;
676         return ret;
677 }
678
679 static void __pts_setting_view_enable_disable(pts_appdata_t *ad)
680 {
681         int i;
682         for (i=0; i<PT_QUALITY_ANY; i++) {
683                 if (ad->setting_info.quality[i]) {
684                         if (pt_is_enabled(PT_OPTION_ID_QUALITY, i)) {
685                                 elm_object_item_disabled_set(ad->setting_info.quality[i], EINA_FALSE);
686                         } else {
687                                 elm_object_item_disabled_set(ad->setting_info.quality[i], EINA_TRUE);
688                         }
689                 }
690         }
691         for (i=0; i<PT_PAPER_ANY; i++) {
692                 if (ad->setting_info.paper_type[i]) {
693                         if (pt_is_enabled(PT_OPTION_ID_PAPER, i)) {
694                                 elm_object_item_disabled_set(ad->setting_info.paper_type[i], EINA_FALSE);
695                         } else {
696                                 elm_object_item_disabled_set(ad->setting_info.paper_type[i], EINA_TRUE);
697                         }
698                 }
699         }
700         for (i=0; i<PT_GRAYSCALE_ANY; i++) {
701                 if (ad->setting_info.color[i]) {
702                         if (pt_is_enabled(PT_OPTION_ID_GRAYSCALE, i)) {
703                                 elm_object_item_disabled_set(ad->setting_info.color[i], EINA_FALSE);
704                         } else {
705                                 elm_object_item_disabled_set(ad->setting_info.color[i], EINA_TRUE);
706                         }
707                 }
708         }
709         for (i=0; i<PT_DUPLEX_ANY-1; i++) {
710                 if (ad->setting_info.duplex[i]) {
711                         if (pt_is_enabled(PT_OPTION_ID_DUPLEX, i)) {
712                                 elm_object_item_disabled_set(ad->setting_info.duplex[i], EINA_FALSE);
713                         } else {
714                                 elm_object_item_disabled_set(ad->setting_info.duplex[i], EINA_TRUE);
715                         }
716                 }
717         }
718         for (i=0; i<pt_get_print_option_papersize_num(); i++) {
719                 if (ad->setting_info.paper_size[i]) {
720                         if (pt_is_enabled(PT_OPTION_ID_PAPERSIZE, i)) {
721                                 elm_object_item_disabled_set(ad->setting_info.paper_size[i], EINA_FALSE);
722                         } else {
723                                 elm_object_item_disabled_set(ad->setting_info.paper_size[i], EINA_TRUE);
724                         }
725                 }
726         }
727 }
728
729 /**
730 * Select the option from list
731 */
732 static void __pts_setting_view_key_value_sel(void *user_data, Evas_Object *obj, void *event_info)
733 {
734         PTS_TRACE_BEGIN;
735
736         Item_data *core = (Item_data *) user_data;
737         struct appdata *ad = pts_get_appdata();
738         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
739         Elm_Object_Item *parent_item = NULL;
740
741         elm_genlist_item_selected_set(item, EINA_FALSE);
742
743         if (NULL != core && NULL != core->item) {
744
745                 switch (core->option) {
746                 case PT_OPTION_ID_PAPERSIZE:
747                         ad->list_info.active_printer->size = core->sub_item;
748                         parent_item  = ad->setting_info.item_paper_size;
749                         pt_set_choice(PT_OPTION_ID_PAPERSIZE, core->sub_item);
750                         PTS_DEBUG("Paper size select: %d", ad->list_info.active_printer->size);
751                         break;
752                 case PT_OPTION_ID_COPIES:
753                         ad->list_info.active_printer->copies = core->sub_item;
754                         parent_item  = ad->setting_info.item_paper_copies;
755                         PTS_DEBUG("Print copy select: %d", ad->list_info.active_printer->copies);
756                         break;
757                 case PT_OPTION_ID_RANGE:
758                         ad->list_info.active_printer->range = core->sub_item;
759                         parent_item  = ad->setting_info.item_page_range;
760                         PTS_DEBUG("Print range select: %d", ad->list_info.active_printer->range);
761                         break;
762                 case PT_OPTION_ID_QUALITY:
763                         pt_set_choice(PT_OPTION_ID_QUALITY, core->sub_item);
764                         parent_item  = ad->setting_info.item_paper_quality;
765                         PTS_DEBUG("Print quality select: %d", pt_get_selected(PT_OPTION_ID_QUALITY));
766                         break;
767                 case PT_OPTION_ID_PAPER:
768                         pt_set_choice(PT_OPTION_ID_PAPER, core->sub_item);
769                         parent_item  = ad->setting_info.item_paper_type;
770                         PTS_DEBUG("Paper type select: %d", pt_get_selected(PT_OPTION_ID_PAPER));
771                         break;
772                 case PT_OPTION_ID_GRAYSCALE:
773                         pt_set_choice(PT_OPTION_ID_GRAYSCALE, core->sub_item);
774                         parent_item  = ad->setting_info.item_grayscale;
775                         PTS_DEBUG("Print color select: %d", pt_get_selected(PT_OPTION_ID_GRAYSCALE));
776                         break;
777                 case PT_OPTION_ID_DUPLEX:
778                         pt_set_choice(PT_OPTION_ID_DUPLEX, core->sub_item);
779                         parent_item = ad->setting_info.item_duplex;
780                         PTS_DEBUG("Duplex select: %d", pt_get_selected(PT_OPTION_ID_DUPLEX));
781                         break;
782                 default:
783                         PTS_DEBUG("Unknown option: %d", core->option);
784                         parent_item = NULL;
785                         break;
786                 }
787
788                 elm_radio_value_set(core->radio_group, core->radio_index);
789                 __pts_setting_view_enable_disable(ad);
790                 if(parent_item) {
791                         elm_genlist_item_update(parent_item);
792                 }
793                 PTS_DEBUG("Update radio group: r_group=[0x%x  <-- %d]", core->radio_group, core->radio_index);
794
795         } else {
796                 PTS_DEBUG("data or data->item are NULL");
797         }
798
799         PTS_TRACE_END;
800 }
801
802 static Item_data *__pts_setting_view_add_genlist_item(
803         Evas_Object *genlist,
804         Elm_Object_Item *parent,
805         pt_print_option_e option,
806         int sub_item,
807         int *radio_btn_index,
808         Evas_Object *radio_group,
809         pts_appdata_t *ad)
810 {
811         PTS_TRACE_BEGIN;
812         PTS_RETV_IF(genlist == NULL, NULL, "genlist is NULL");
813
814         Elm_Genlist_Item_Class *itc = NULL;
815
816         if (PT_OPTION_ID_PAPERSIZE == option) {
817                 itc_paper_size.item_style = "dialogue/1text.1icon/expandable2";
818                 itc_paper_size.func.text_get = __pts_setting_view_papersize_key_label_get;
819                 itc_paper_size.func.content_get = __pts_setting_view_gl_content_get;
820                 itc_paper_size.func.state_get = NULL; //__pts_setting_view_gl_state_get;
821                 itc_paper_size.func.del = __pts_setting_view_gl_state_item_delete;
822                 itc = &itc_paper_size;
823         } else if (PT_OPTION_ID_GRAYSCALE == option) {
824                 itc_grayscale.item_style = "dialogue/1text.1icon/expandable2";
825                 itc_grayscale.func.text_get = __pts_setting_view_grayscale_key_label_get;
826                 itc_grayscale.func.content_get = __pts_setting_view_gl_content_get;
827                 itc_grayscale.func.state_get = NULL; //__pts_setting_view_gl_state_get;
828                 itc_grayscale.func.del = __pts_setting_view_gl_state_item_delete;
829                 itc = &itc_grayscale;
830         } else if (PT_OPTION_ID_QUALITY == option) {
831                 itc_paper_quality.item_style = "dialogue/1text.1icon/expandable2";
832                 itc_paper_quality.func.text_get = __pts_setting_view_quality_key_label_get;
833                 itc_paper_quality.func.content_get = __pts_setting_view_gl_content_get;
834                 itc_paper_quality.func.state_get = NULL; //__pts_setting_view_gl_state_get;
835                 itc_paper_quality.func.del = __pts_setting_view_gl_state_item_delete;
836                 itc = &itc_paper_quality;
837         } else if (PT_OPTION_ID_PAPER == option) {
838                 itc_paper_type.item_style = "dialogue/1text.1icon/expandable2";
839                 itc_paper_type.func.text_get = __pts_setting_view_paper_key_label_get;
840                 itc_paper_type.func.content_get = __pts_setting_view_gl_content_get;
841                 itc_paper_type.func.state_get = NULL; //__pts_setting_view_gl_state_get;
842                 itc_paper_type.func.del = __pts_setting_view_gl_state_item_delete;
843                 itc = &itc_paper_type;
844         } else if (PT_OPTION_ID_RANGE == option) {
845                 itc_page_range.item_style = "dialogue/1text.1icon/expandable2";
846                 itc_page_range.func.text_get = __pts_setting_view_range_key_label_get;
847                 itc_page_range.func.content_get = __pts_setting_view_gl_content_get;
848                 itc_page_range.func.state_get = NULL; //__pts_setting_view_gl_state_get;
849                 itc_page_range.func.del = __pts_setting_view_gl_state_item_delete;
850                 itc = &itc_page_range;
851         } else if (PT_OPTION_ID_DUPLEX == option) {
852                 itc_duplex.item_style = "dialogue/1text.1icon/expandable2";
853                 itc_duplex.func.text_get = __pts_setting_view_duplex_key_label_get;
854                 itc_duplex.func.content_get = __pts_setting_view_gl_content_get;
855                 itc_duplex.func.state_get = NULL;
856                 itc_duplex.func.del = __pts_setting_view_gl_state_item_delete;
857                 itc = &itc_duplex;
858         } else {
859                 PTS_DEBUG("Unknown option: %d", option);
860                 PTS_TRACE_END;
861                 return NULL;
862         }
863
864         evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND,     EVAS_HINT_EXPAND);
865         evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
866
867         Item_data *core = calloc(1, sizeof(Item_data));
868         core->option = option;
869         core->sub_item = sub_item;
870         core->radio_index = *radio_btn_index;
871         core->radio_group = radio_group;
872
873         core->item = elm_genlist_item_append(
874                                          genlist,
875                                          itc,
876                                          (void *)core,
877                                          parent,
878                                          ELM_GENLIST_ITEM_NONE,
879                                          __pts_setting_view_key_value_sel,
880                                          core);
881
882         if (!pt_is_enabled(option, sub_item)) {
883                 elm_object_item_disabled_set(core->item, EINA_TRUE);
884         }
885
886         ++(*radio_btn_index);
887
888         PTS_TRACE_END;
889         return core;
890 }
891
892
893 static Evas_Object *__pts_create_radio_group(Evas_Object *genlist)
894 {
895         Evas_Object *radio = elm_radio_add(genlist);
896         elm_radio_state_value_set(radio, 0);
897         elm_radio_value_set(radio, 0);
898
899         return radio;
900 }
901
902 /**
903 *  Callback for expandable genlist expand
904 */
905 static void __pts_setting_view_gl_exp(void *data, Evas_Object *obj, void *event_info)
906 {
907         PTS_TRACE_BEGIN;
908         PTS_RET_IF(NULL == event_info, "item object is NULL");
909
910         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
911         Evas_Object *genlist = elm_object_item_widget_get(item);
912         pts_appdata_t *ad = (pts_appdata_t *)data;
913         int radio_index = 0;
914         int i = 0;
915
916         elm_genlist_item_selected_set(item, EINA_FALSE);
917
918         if (ad->setting_info.radio_group_paper_size == NULL) {
919                 ad->setting_info.radio_group_paper_size = __pts_create_radio_group(genlist);
920         }
921         if (ad->setting_info.radio_group_paper_quality == NULL) {
922                 ad->setting_info.radio_group_paper_quality = __pts_create_radio_group(genlist);
923         }
924         if (ad->setting_info.radio_group_paper_type == NULL) {
925                 ad->setting_info.radio_group_paper_type = __pts_create_radio_group(genlist);
926         }
927         if (ad->setting_info.radio_group_page_range == NULL) {
928                 ad->setting_info.radio_group_page_range = __pts_create_radio_group(genlist);
929         }
930         if (ad->setting_info.radio_group_grayscale == NULL) {
931                 ad->setting_info.radio_group_grayscale = __pts_create_radio_group(genlist);
932         }
933         if (ad->setting_info.radio_group_duplex == NULL) {
934                 ad->setting_info.radio_group_duplex = __pts_create_radio_group(genlist);
935         }
936
937         if (item == ad->setting_info.item_paper_size) {
938                 radio_index = 0;
939                 Item_data *i_d;
940                 for (i = 0; i < pt_get_print_option_papersize_num(); i++) {
941                         i_d = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPERSIZE, i, &radio_index, ad->setting_info.radio_group_paper_size, ad);
942                         if (i_d != NULL) {
943                                 ad->setting_info.paper_size[i] = i_d->item;
944                         }
945                 }
946         } else if (item == ad->setting_info.item_paper_quality) {
947                 radio_index = 0;
948                 ad->setting_info.quality[PT_QUALITY_DRAFT] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_DRAFT, &radio_index, ad->setting_info.radio_group_paper_quality, ad)->item;
949                 ad->setting_info.quality[PT_QUALITY_STANDARD] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_STANDARD, &radio_index, ad->setting_info.radio_group_paper_quality, ad)->item;
950                 ad->setting_info.quality[PT_QUALITY_HIGH] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_HIGH, &radio_index, ad->setting_info.radio_group_paper_quality, ad)->item;
951         } else if (item == ad->setting_info.item_paper_type) {
952                 radio_index = 0;
953                 ad->setting_info.paper_type[PT_PAPER_NORMAL] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_NORMAL, &radio_index, ad->setting_info.radio_group_paper_type, ad)->item;
954                 ad->setting_info.paper_type[PT_PAPER_GLOSSY] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_GLOSSY, &radio_index, ad->setting_info.radio_group_paper_type, ad)->item;
955                 ad->setting_info.paper_type[PT_PAPER_PHOTO] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_PHOTO, &radio_index, ad->setting_info.radio_group_paper_type, ad)->item;
956         } else if (item == ad->setting_info.item_page_range) {
957                 radio_index = 0;
958                 __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_RANGE, PT_RANGE_ALL, &radio_index, ad->setting_info.radio_group_page_range, ad);
959                 __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_RANGE, PT_RANGE_CURRENT, &radio_index, ad->setting_info.radio_group_page_range, ad);
960         } else if (item == ad->setting_info.item_grayscale) {
961                 radio_index = 0;
962                 ad->setting_info.color[PT_GRAYSCALE_GRAYSCALE] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_GRAYSCALE, PT_GRAYSCALE_GRAYSCALE, &radio_index, ad->setting_info.radio_group_grayscale, ad)->item;
963                 ad->setting_info.color[PT_GRAYSCALE_COLOUR] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_GRAYSCALE, PT_GRAYSCALE_COLOUR, &radio_index, ad->setting_info.radio_group_grayscale, ad)->item;
964         } else if (item == ad->setting_info.item_duplex) {
965                 radio_index = 0;
966                 ad->setting_info.duplex[PT_DUPLEX_OFF] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_DUPLEX, PT_DUPLEX_OFF, &radio_index, ad->setting_info.radio_group_duplex, ad)->item;
967                 ad->setting_info.duplex[PT_DUPLEX_NO_TUMBLE] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_DUPLEX, PT_DUPLEX_NO_TUMBLE, &radio_index, ad->setting_info.radio_group_duplex, ad)->item;
968         } else {
969                 PTS_DEBUG("Unknown item");
970         }
971
972         PTS_TRACE_END;
973 }
974
975 /*
976  * Accessability info for items from list
977  */
978 static void __pts_setting_view_gl_realized(void *data, Evas_Object *obj, void *event_info)
979 {
980         PTS_TRACE_BEGIN;
981         PTS_RET_IF(NULL == event_info, "item object is NULL");
982         PTS_RET_IF(NULL == data, "ad is NULL");
983
984         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
985         pts_appdata_t *ad = (pts_appdata_t *)data;
986         void *item_data = elm_object_item_data_get(item);
987         //PTS_RET_IF(NULL == item_data, "item data is NULL"); //FIXME: related to Jira issue #
988
989         pt_print_option_e option = (pt_print_option_e)item_data;
990         PTS_RET_IF(option >= PT_OPTION_ID_MAX, "UNKNOWN OPTION REALIZED - %d", option);
991
992         PTS_DEBUG("realized print option: [%d]\n", option);
993
994         if (PT_OPTION_ID_PAPERSIZE == option
995                         || PT_OPTION_ID_RANGE == option
996                         || PT_OPTION_ID_QUALITY == option
997                         || PT_OPTION_ID_PAPER == option
998                         || PT_OPTION_ID_GRAYSCALE == option
999                         || PT_OPTION_ID_DUPLEX == option) {
1000
1001                 Evas_Object *ao = elm_object_item_access_object_get(item);
1002                 PTS_RET_IF(NULL == ao, "Access object is NULL");
1003                 elm_access_info_set(ao, ELM_ACCESS_TYPE, IDS_SCRREAD_EXPANDABLE_LIST_TYPE);
1004                 elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_EXPANDABLE_LIST_CONTEXT);
1005                 PTS_DEBUG("Item #%d access context info: [%s]", option, IDS_SCRREAD_EXPANDABLE_LIST_CONTEXT);
1006         } else if (PT_OPTION_ID_COPIES == option) {
1007                 Evas_Object *ao = elm_object_item_access_object_get(item);
1008                 PTS_RET_IF(NULL == ao, "Access object is NULL");
1009                 elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_SETTINS_ITEM_CONTEXT);
1010                 PTS_DEBUG("Item #%d access context info: [%s]", option, IDS_SCRREAD_SETTINS_ITEM_CONTEXT);
1011         } else if (PT_OPTION_ID_PRINTER == option) {
1012                 Evas_Object *ao = elm_object_item_access_object_get(item);
1013                 PTS_RET_IF(NULL == ao, "Access object is NULL");
1014                 elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_PRINTER_ITEM_CONTEXT);
1015                 PTS_DEBUG("Item #printer access context info: [%s]", IDS_SCRREAD_PRINTER_ITEM_CONTEXT);
1016         }
1017
1018         PTS_TRACE_END;
1019 }
1020
1021 /*
1022 * create the content of setting view
1023 */
1024 static Evas_Object *__pts_setting_view_create_content(Evas_Object *parent, pts_appdata_t *ad)
1025 {
1026         PTS_TRACE_BEGIN;
1027         PTS_RETV_IF(ad == NULL, NULL, "ad is NULL");
1028         PTS_RETV_IF(parent == NULL, NULL, "parent is NULL");
1029
1030         Evas_Object *genlist = NULL;
1031         Elm_Object_Item *separator_item;
1032
1033         //itc_separator.item_style =  "dialogue/separator/21/with_line";
1034         itc_separator.item_style =  "dialogue/separator";
1035         itc_separator.func.text_get = NULL;
1036         itc_separator.func.content_get = NULL;
1037         itc_separator.func.state_get = NULL;
1038         itc_separator.func.del = NULL;
1039
1040         itc_printer.item_style = "dialogue/2text";
1041         itc_printer.func.text_get = __pts_setting_view_printer_label_get;
1042         itc_printer.func.content_get = NULL;
1043         itc_printer.func.state_get = NULL;
1044         itc_printer.func.del = NULL;
1045
1046         //itc_tree_options.item_style = "dialogue/2text/expandable";
1047         itc_tree_options.item_style = "dialogue/2text.3/expandable";
1048         itc_tree_options.func.text_get = __pts_setting_view_option_label_get;
1049         itc_tree_options.func.content_get = NULL;
1050         itc_tree_options.func.state_get = NULL;
1051         itc_tree_options.func.del = NULL;
1052
1053         itc_normal_options.item_style = "dialogue/2text";
1054         itc_normal_options.func.text_get = __pts_setting_view_option_label_get;
1055         itc_normal_options.func.content_get = NULL;
1056         itc_normal_options.func.state_get = NULL;
1057         itc_normal_options.func.del = NULL;
1058
1059         genlist = elm_genlist_add(parent);
1060
1061         elm_object_style_set(genlist, "dialogue");
1062         elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1063
1064         separator_item= elm_genlist_item_append(
1065                                                 genlist,
1066                                                 &itc_separator,
1067                                                 NULL,
1068                                                 NULL,
1069                                                 ELM_GENLIST_ITEM_NONE,
1070                                                 NULL, NULL);
1071
1072         elm_genlist_item_select_mode_set(separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1073
1074         ad->setting_info.printer_item = elm_genlist_item_append(
1075                                                         genlist,
1076                                                         &itc_printer,
1077                                                         (void *)PT_OPTION_ID_PRINTER,
1078                                                         NULL,
1079                                                         ELM_GENLIST_ITEM_NONE,
1080                                                         __pts_setting_view_printer_sel, ad);
1081
1082         ad->setting_info.header_separator_item = elm_genlist_item_append(
1083                                                                          genlist,
1084                                                                          &itc_separator,
1085                                                                          NULL,
1086                                                                          NULL,
1087                                                                          ELM_GENLIST_ITEM_NONE,
1088                                                                          NULL, NULL);
1089         elm_genlist_item_select_mode_set(ad->setting_info.header_separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1090
1091         ad->setting_info.item_paper_size = elm_genlist_item_append(
1092                                                            genlist,
1093                                                            &itc_tree_options,
1094                                                            (void *)PT_OPTION_ID_PAPERSIZE,
1095                                                            NULL,
1096                                                            ELM_GENLIST_ITEM_TREE,
1097                                                            __pts_setting_view_gl_sel,
1098                                                            ad);
1099
1100         ad->setting_info.item_paper_copies = elm_genlist_item_append(
1101                                                                  genlist,
1102                                                                  &itc_normal_options,
1103                                                                  (void *)PT_OPTION_ID_COPIES,
1104                                                                  NULL,
1105                                                                  ELM_GENLIST_ITEM_NONE,
1106                                                                  _create_copies_popup_timepicker,
1107                                                                  ad);
1108
1109         ad->setting_info.item_page_range = elm_genlist_item_append(
1110                                                            genlist,
1111                                                            &itc_tree_options,
1112                                                            (void *)PT_OPTION_ID_RANGE,
1113                                                            NULL,
1114                                                            ELM_GENLIST_ITEM_TREE,
1115                                                            __pts_setting_view_gl_sel,
1116                                                            ad);
1117
1118         ad->setting_info.item_paper_quality = elm_genlist_item_append(
1119                                                                   genlist,
1120                                                                   &itc_tree_options,
1121                                                                   (void *)PT_OPTION_ID_QUALITY,
1122                                                                   NULL,
1123                                                                   ELM_GENLIST_ITEM_TREE,
1124                                                                   __pts_setting_view_gl_sel,
1125                                                                   ad);
1126
1127         ad->setting_info.item_paper_type = elm_genlist_item_append(
1128                                                            genlist,
1129                                                            &itc_tree_options,
1130                                                            (void *)PT_OPTION_ID_PAPER,
1131                                                            NULL,
1132                                                            ELM_GENLIST_ITEM_TREE,
1133                                                            __pts_setting_view_gl_sel,
1134                                                            ad);
1135
1136         ad->setting_info.item_grayscale = elm_genlist_item_append(
1137                                                           genlist,
1138                                                           &itc_tree_options,
1139                                                           (void *)PT_OPTION_ID_GRAYSCALE,
1140                                                           NULL,
1141                                                           ELM_GENLIST_ITEM_TREE,
1142                                                           __pts_setting_view_gl_sel,
1143                                                           ad);
1144
1145         ad->setting_info.item_duplex = elm_genlist_item_append(
1146                                                           genlist,
1147                                                           &itc_tree_options,
1148                                                           (void *)PT_OPTION_ID_DUPLEX,
1149                                                           NULL,
1150                                                           ELM_GENLIST_ITEM_TREE,
1151                                                           __pts_setting_view_gl_sel,
1152                                                           ad);
1153
1154         // Footer space
1155         ad->setting_info.footer_separator_item = elm_genlist_item_append(
1156                                                                          genlist,
1157                                                                          &itc_separator,
1158                                                                          NULL,
1159                                                                          NULL,
1160                                                                          ELM_GENLIST_ITEM_NONE,
1161                                                                          NULL, NULL);
1162         elm_genlist_item_select_mode_set(ad->setting_info.footer_separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1163
1164         evas_object_smart_callback_add(genlist, "expanded", __pts_setting_view_gl_exp, ad);
1165         evas_object_smart_callback_add(genlist, "contracted", __pts_setting_view_gl_con, ad);
1166
1167         /* Accessability information callback */
1168         evas_object_smart_callback_add(genlist, "realized", __pts_setting_view_gl_realized, ad);
1169
1170         /* Add touch coordinates handler */
1171         //Ecore_Event_Handler *event;
1172         //event = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _mousedown_cb, NULL);
1173         //evas_object_smart_callback_add(genlist, "clicked", _back_cb, event);
1174
1175         PTS_TRACE_END;
1176         return genlist;
1177 }
1178
1179 /**
1180  *      This function let the app create setting view
1181  *      @return  void
1182  *      @param[in] sd the pointer to the printer setting structure
1183  */
1184 void pts_create_setting_view(pts_appdata_t *ad)
1185 {
1186         PTS_TRACE_BEGIN;
1187         PTS_RET_IF(ad == NULL, "ad is NULL");
1188
1189         Evas_Object *back_btn = NULL;
1190         //Evas_Object *layout = NULL;
1191         Evas_Object *genlist = NULL;
1192         Elm_Object_Item *navi_item = NULL;
1193
1194         //layout = pts_utils_create_layout(ugd->navi);
1195         //evas_object_show(layout);
1196
1197         genlist = __pts_setting_view_create_content(ad->main_info.navi, ad);
1198         //elm_object_content_set(layout, genlist);
1199         evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1200         evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1201
1202         back_btn = elm_button_add(ad->main_info.navi);
1203         elm_object_style_set(back_btn, "naviframe/end_btn/default");
1204
1205         navi_item = elm_naviframe_item_push(ad->main_info.navi, _("IDS_SMPOS_HEADER_PRINTER_SETTINGS"), back_btn, NULL, genlist, NULL);
1206         elm_naviframe_item_pop_cb_set(navi_item, __pts_setting_view_btn_back_cb, ad);
1207
1208         PTS_TRACE_END;
1209 }