557b48c2bd490cadaa96e5cd0542dbf3fe95f0db
[apps/home/ug-wifi-efl.git] / sources / wifi-syspopup / viewer-popups / view-alerts.c
1 /*
2 *  Wi-Fi syspopup
3 *
4 * Copyright 2012  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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
21
22 #include "common.h"
23 #include "common_utils.h"
24 #include "wifi-syspopup.h"
25 #include "view-alerts.h"
26 #include "i18nmanager.h"
27
28 extern wifi_object* syspopup_app_state;
29
30 int view_alerts_powering_on_show(void)
31 {
32         __COMMON_FUNC_ENTER__;
33         if(WIFI_SYSPOPUP_SUPPORT_QUICKPANEL == syspopup_app_state->wifi_syspopup_support){
34                 __COMMON_FUNC_EXIT__;
35                 return TRUE;
36         }
37         if(NULL != syspopup_app_state->alertpopup) {
38                 evas_object_del(syspopup_app_state->alertpopup);
39                 syspopup_app_state->alertpopup = NULL;
40         }
41
42         Evas_Object *conformant = NULL;
43         conformant = elm_conformant_add(syspopup_app_state->win_main);
44         elm_win_conformant_set(syspopup_app_state->win_main, EINA_TRUE);
45         elm_win_resize_object_add(syspopup_app_state->win_main, conformant);
46         evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
47         evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
48         evas_object_show(conformant);
49
50         Evas_Object *content = elm_layout_add(conformant);
51         elm_object_content_set(conformant, content);
52         syspopup_app_state->alertpopup = elm_popup_add(content);
53
54         Evas_Object *box = elm_box_add(syspopup_app_state->alertpopup);
55         evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
56         evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
57         evas_object_show(box);
58
59         Evas_Object *progressbar = elm_progressbar_add(box);
60         elm_object_style_set(progressbar, "list_process");
61         evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62         evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
63         elm_progressbar_pulse(progressbar, EINA_TRUE);
64         evas_object_show(progressbar);
65         elm_box_pack_end(box, progressbar);
66
67         Evas_Object *label = elm_label_add(box);
68         elm_object_style_set(label, "popup/default");
69         evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
70         evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
71         elm_object_text_set(label, sc(PACKAGE, I18N_TYPE_Activating));
72         evas_object_show(label);
73         elm_box_pack_end(box, label);
74
75         elm_object_content_set(syspopup_app_state->alertpopup, box);
76         evas_object_size_hint_weight_set(syspopup_app_state->alertpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
77         evas_object_show(syspopup_app_state->alertpopup);
78
79         __COMMON_FUNC_EXIT__;
80
81         return TRUE;
82 }
83
84 void view_alerts_popup_show(const char *err_msg)
85 {
86         __COMMON_FUNC_ENTER__;
87
88         if (WIFI_SYSPOPUP_SUPPORT_QUICKPANEL == syspopup_app_state->wifi_syspopup_support) {
89                 __COMMON_FUNC_EXIT__;
90                 return;
91         }
92
93         if (NULL != syspopup_app_state->alertpopup) {
94                 evas_object_del(syspopup_app_state->alertpopup);
95                 syspopup_app_state->alertpopup = NULL;
96         }
97
98         syspopup_app_state->alertpopup = common_utils_show_info_timeout_popup(syspopup_app_state->win_main, err_msg, 2.0f);
99
100         __COMMON_FUNC_EXIT__;
101
102         return;
103 }
104
105 void view_alerts_popup_ok_show(const char *err_msg)
106 {
107         __COMMON_FUNC_ENTER__;
108
109         if (WIFI_SYSPOPUP_SUPPORT_QUICKPANEL == syspopup_app_state->wifi_syspopup_support) {
110                 __COMMON_FUNC_EXIT__;
111                 return;
112         }
113
114         if (NULL != syspopup_app_state->alertpopup) {
115                 evas_object_del(syspopup_app_state->alertpopup);
116                 syspopup_app_state->alertpopup = NULL;
117         }
118
119         syspopup_app_state->alertpopup = common_utils_show_info_ok_popup(syspopup_app_state->win_main, PACKAGE, err_msg);
120
121         __COMMON_FUNC_EXIT__;
122
123         return;
124 }