2 * Copyright (c) 2014 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.
17 #include <Elementary.h>
19 #include <system_info.h>
23 #include "viewmgr_auto_program.h"
24 #include "ug_auto_program.h"
25 #include "view_search_page.h"
26 #include "view_result_page.h"
28 #define RESULT_MSG_SIZE 60
30 #define _GET_PRIV(o) evas_object_data_get(o, "RESDATA")
31 #define _SET_PRIV(o, data) evas_object_data_set(o, "RESDATA", data)
42 * @Evas_Smart_Cb type callback for handling the click callback event for
45 * When "OK" button is clicked, channel ug will exit.
47 * @param[in] data: the user data related to current view
48 * @param[in] obj: the corresponding object on which the button click event
51 * @param[in] ev: event information
53 static void _ok_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
59 _ERR("Invalid argument");
66 if (!ugd || !ugd->ug) {
67 _ERR("ugd->ug is NULL");
71 ug_destroy_me(ugd->ug);
75 * Initializes the base layout for scanning result view.
77 * Create the layout of scanning result view.
79 * @param[in] vmgr: the handler to the struct object for managing the view
80 * @param[in] data: the user data related to current view
81 * @return The base or NULL if creatting failed
83 static Evas_Object *_create(struct viewmgr *vmgr, void *data)
91 _ERR("Invalid argument");
97 win = viewmgr_get_win(vmgr);
101 priv = calloc(1, sizeof(*priv));
105 base = util_add_layout(win, AUTO_PRGM_EDJ_FILE, GROUP_RES);
111 elm_win_resize_object_add(win, base);
118 _SET_PRIV(base, priv);
124 * Invoked after _create() function as defined in viewmgr_push().
126 * Create the button in result view, and show the information about the
127 * number of found channels.
129 * @param[in] base: the layout of the view
131 static void _update(Evas_Object *base)
135 char msg[RESULT_MSG_SIZE];
139 _ERR("Invalid argument");
143 priv = _GET_PRIV(base);
145 _ERR("Data get failed");
149 chs = priv->ugd->find_chs;
151 snprintf(msg, sizeof(msg), "%s<br>%d %s", COMPLETE_MAIN_TITLE,
152 chs, TEXT_CH_MEMORIZED);
153 elm_object_part_text_set(priv->base, PART_RES_MAIN_TITLE, msg);
155 ok_btn = util_add_button(priv->base, BTN_STYLE,
156 PART_OK_BTN, TEXT_BUTTON_OK, EINA_TRUE);
158 _ERR("ok_btn is NULL");
162 priv->ok_btn = ok_btn;
163 elm_object_focus_set(ok_btn, EINA_TRUE);
164 evas_object_smart_callback_add(ok_btn, SIGNAL_CLICKED,
165 _ok_btn_clicked_cb, priv);
167 util_focus_next_set(ok_btn);
171 * Resume the application.
173 * @param[in] base: the layout of the view
175 static void _resume(Evas_Object *base)
177 evas_object_show(base);
181 * Pause the application.
185 * @param[in] base: the layout of the view
187 static void _pause(Evas_Object *base)
189 evas_object_hide(base);
193 * Called after the main loop of the view exits.
195 * Delete the layout and release the resourse
197 * @param[in] base: the layout of the view
199 static void _terminate(Evas_Object *base)
204 _ERR("Invalid argument");
208 priv = _GET_PRIV(base);
210 _ERR("Data get failed");
215 evas_object_del(priv->base);
221 * This struct is for registering the callbacks for the view
223 static struct view_class _vclass = {
224 .title = VIEW_RESULT,
229 .terminate = _terminate,
233 * Returns current view_class which implements the result view's life cycle
237 struct view_class *view_resultpage_get_vclass(void)