4 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include "popup-common.h"
22 static const struct popup_ops cooldown_poweroff_ops;
23 static const struct popup_ops cooldown_ops;
24 static const struct popup_ops cooled_down_ops;
25 static const struct popup_ops cooldown_remove_ops;
27 static int remove_cooldown_popups(bundle *b, const struct popup_ops *ops)
29 unload_simple_popup(&cooldown_poweroff_ops);
30 unload_simple_popup(&cooldown_ops);
31 unload_simple_popup(&cooled_down_ops);
32 terminate_if_no_popup();
37 static int remove_other_cooldown_popups(bundle *b, const struct popup_ops *ops)
40 _E("Invalid removal request for cooldown");
44 if (ops != &cooldown_poweroff_ops)
45 unload_simple_popup(&cooldown_poweroff_ops);
47 if (ops != &cooldown_ops)
48 unload_simple_popup(&cooldown_ops);
50 if (ops != &cooled_down_ops)
51 unload_simple_popup(&cooled_down_ops);
56 static const struct popup_ops cooldown_poweroff_ops = {
57 .name = "cooldown_poweroff",
58 .pattern = FEEDBACK_PATTERN_LOWBATT,
59 .show = load_simple_popup,
60 .title = "IDS_ST_HEADER_POWER_OFF_ABB",
61 .content = "IDS_QP_POP_YOUR_DEVICE_IS_OVERHEATING_IT_WILL_NOW_POWER_OFF_TO_COOL_DOWN",
62 .left_text = "IDS_QP_BUTTON_DO_NOT_POWER_OFF_ABB",
63 .pre = remove_other_cooldown_popups,
66 static const struct popup_ops cooldown_ops = {
68 .pattern = FEEDBACK_PATTERN_LOWBATT,
69 .show = load_simple_popup,
70 .title = "IDS_IDLE_HEADER_PHONE_COOLING_DOWN_ABB",
71 .content = "IDS_IDLE_POP_YOUR_PHONE_IS_OVERHEATING_STEPS_WILL_BE_TAKEN_TO_COOL_IT_DOWN_N_NYOU_CAN_STILL_USE_YOUR_PHONE_MSG",
72 .left_text = "IDS_COM_SK_OK",
73 .pre = remove_other_cooldown_popups,
76 static const struct popup_ops cooled_down_ops = {
77 .name = "cooled_down",
78 .pattern = FEEDBACK_PATTERN_LOWBATT,
79 .show = load_simple_popup,
80 .title = "IDS_IDLE_HEADER_PHONE_COOLED_DOWN",
81 .content = "IDS_IDLE_POP_YOUR_PHONE_IS_NOW_READY_TO_USE",
82 .left_text = "IDS_COM_SK_OK",
83 .pre = remove_other_cooldown_popups,
86 static const struct popup_ops cooldown_remove_ops = {
87 .name = "remove_cooldown_popups",
88 .show = remove_cooldown_popups,
91 /* Constructor to register cooldown button */
92 static __attribute__ ((constructor)) void cooldown_register_popup(void)
94 register_popup(&cooldown_poweroff_ops);
95 register_popup(&cooldown_ops);
96 register_popup(&cooled_down_ops);
97 register_popup(&cooldown_remove_ops);