2 * Copyright (c) 2009 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <Elementary.h>
21 #include <ui-gadget-module.h>
22 #include <package_manager.h>
24 #include "notification-setting-info.h"
25 #include "common-efl.h"
27 static Evas_Object* _create_edit_exception_apps_list(ug_data *ugd)
29 Evas_Object *parent = ugd->naviframe;
32 genlist = elm_genlist_add(parent);
33 elm_genlist_mode_set(genlist, ELM_LIST_SCROLL);
34 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
36 /* Add Smart Callback */
37 evas_object_smart_callback_add(genlist, "realized", gl_realized_cb, NULL);
38 evas_object_smart_callback_add(genlist, "loaded", gl_loaded_cb, NULL);
39 evas_object_smart_callback_add(genlist, "longpressed", gl_longpressed_cb, NULL);
40 evas_object_smart_callback_add(genlist, "contracted", gl_contracted_cb, NULL);
42 append_gl_group_index(genlist, APP_STRING("IDS_ST_HEADER_EXCLUDED_APPS_ABB"));
43 append_gl_item_list(genlist, get_excepted_apps_list(), ITEM_STYLE_DEFAULT);
44 append_gl_group_index(genlist, APP_STRING("IDS_ST_HEADER_INCLUDED_APPS_ABB"));
45 append_gl_item_list(genlist, get_not_excepted_apps_list(), ITEM_STYLE_DEFAULT);
51 static void _done_button_cb(void *data, Evas_Object *obj, void *event_info)
55 ug_data* u_data = get_ug_data();
56 Eina_List *temp = NULL;
57 Eina_List *list = NULL;
59 elm_naviframe_item_pop(data);
61 EVAS_OBJECT_DELIF(u_data->done_button);
62 EVAS_OBJECT_DELIF(u_data->cancel_button);
63 EVAS_OBJECT_DELIF(u_data->list_sub);
65 if (u_data->list_main) {
66 list = get_excepted_apps_list();
68 item_info_s *item = (item_info_s*)eina_list_data_get(list);
69 if (item->do_not_disturb_except == false) {
70 set_excepted_apps(item->appid, item->do_not_disturb_except);
72 list = eina_list_next(list);
75 list = get_not_excepted_apps_list();
77 item_info_s *item = (item_info_s*)eina_list_data_get(list);
78 if (item->do_not_disturb_except == TRUE) {
79 set_excepted_apps(item->appid, item->do_not_disturb_except);
81 list = eina_list_next(list);
84 create_do_not_disturb_application_list();
85 elm_genlist_clear(u_data->list_main);
86 do_not_disturb_append_item_in_list(u_data->list_main);
92 void _cancel_button_cb(void *data, Evas_Object *obj, void *event_info)
95 elm_naviframe_item_pop(data);
96 ug_data* u_data = get_ug_data();
98 EVAS_OBJECT_DELIF(u_data->done_button);
99 EVAS_OBJECT_DELIF(u_data->cancel_button);
100 EVAS_OBJECT_DELIF(u_data->list_sub);
103 void exception_application_clicked_cb(void *data, Evas_Object *obj, void *event_info)
106 ug_data* u_data = get_ug_data();
109 Evas_Object *genlist = NULL;
110 Elm_Object_Item* navi_item = NULL;
111 Evas_Object *cancel_btn = NULL;
112 Evas_Object *done_btn = NULL;
114 create_do_not_disturb_application_list();
116 u_data->list_sub = _create_edit_exception_apps_list(u_data);
119 /* Push to naviframe */
120 navi_item = elm_naviframe_item_push(u_data->naviframe, APP_STRING("IDS_ST_HEADER_MANAGE_EXCLUDED_APPS_ABB"), NULL, NULL, u_data->list_sub, NULL);
122 /* Title Cancel Button */
123 cancel_btn = elm_button_add(u_data->naviframe);
124 elm_object_style_set(cancel_btn, "naviframe/title_left");
125 evas_object_smart_callback_add(cancel_btn, "clicked", _cancel_button_cb, u_data->naviframe);
126 elm_object_text_set(cancel_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"));
127 elm_object_item_part_content_set(navi_item, "title_left_btn", cancel_btn);
128 u_data->cancel_button = cancel_btn;
130 /* Title Done Button */
131 done_btn = elm_button_add(u_data->naviframe);
132 elm_object_style_set(done_btn, "naviframe/title_right");
133 evas_object_smart_callback_add(done_btn, "clicked", _done_button_cb, u_data->naviframe);
134 elm_object_text_set(done_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_DONE_ABB"));
135 elm_object_item_part_content_set(navi_item, "title_right_btn", done_btn);
136 u_data->done_button = done_btn;