cooldown : add remove_other_cooldown_popup 55/134255/3
authorlokilee73 <changjoo.lee@samsung.com>
Thu, 15 Jun 2017 11:51:48 +0000 (20:51 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Fri, 16 Jun 2017 01:55:31 +0000 (10:55 +0900)
Change-Id: Ibcf77d8fa521ff3f2b84814802459f36644021fe
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/cooldown/cooldown-mobile.c

index 48cafe2..d75bf1a 100755 (executable)
 
 #include "popup-common.h"
 
+static const struct popup_ops cooldown_poweroff_ops;
+static const struct popup_ops cooldown_ops;
+static const struct popup_ops cooled_down_ops;
+static const struct popup_ops cooldown_remove_ops;
+
+static int remove_cooldown_popups(bundle *b, const struct popup_ops *ops)
+{
+       unload_simple_popup(&cooldown_poweroff_ops);
+       unload_simple_popup(&cooldown_ops);
+       unload_simple_popup(&cooled_down_ops);
+       terminate_if_no_popup();
+
+       return 0;
+}
+
+static int remove_other_cooldown_popups(bundle *b, const struct popup_ops *ops)
+{
+       if (!ops) {
+               _E("Invalid removal request for cooldown");
+               return 0;
+       }
+
+       if (ops != &cooldown_poweroff_ops)
+               unload_simple_popup(&cooldown_poweroff_ops);
+
+       if (ops != &cooldown_ops)
+               unload_simple_popup(&cooldown_ops);
+
+       if (ops != &cooled_down_ops)
+               unload_simple_popup(&cooled_down_ops);
+
+       return 0;
+}
+
 static const struct popup_ops cooldown_poweroff_ops = {
        .name           = "cooldown_poweroff",
        .pattern        = FEEDBACK_PATTERN_LOWBATT,
@@ -26,6 +60,7 @@ static const struct popup_ops cooldown_poweroff_ops = {
        .title          = "IDS_ST_HEADER_POWER_OFF_ABB",
        .content        = "IDS_QP_POP_YOUR_DEVICE_IS_OVERHEATING_IT_WILL_NOW_POWER_OFF_TO_COOL_DOWN",
        .left_text      = "IDS_QP_BUTTON_DO_NOT_POWER_OFF_ABB",
+       .pre            = remove_other_cooldown_popups,
 };
 
 static const struct popup_ops cooldown_ops = {
@@ -35,6 +70,7 @@ static const struct popup_ops cooldown_ops = {
        .title          = "IDS_IDLE_HEADER_PHONE_COOLING_DOWN_ABB",
        .content        = "IDS_IDLE_POP_YOUR_PHONE_IS_OVERHEATING_STEPS_WILL_BE_TAKEN_TO_COOL_IT_DOWN_N_NYOU_CAN_STILL_USE_YOUR_PHONE_MSG",
        .left_text      = "IDS_COM_SK_OK",
+       .pre            = remove_other_cooldown_popups,
 };
 
 static const struct popup_ops cooled_down_ops = {
@@ -44,6 +80,12 @@ static const struct popup_ops cooled_down_ops = {
        .title          = "IDS_IDLE_HEADER_PHONE_COOLED_DOWN",
        .content        = "IDS_IDLE_POP_YOUR_PHONE_IS_NOW_READY_TO_USE",
        .left_text      = "IDS_COM_SK_OK",
+       .pre            = remove_other_cooldown_popups,
+};
+
+static const struct popup_ops cooldown_remove_ops = {
+       .name           = "remove_cooldown_popups",
+       .show           = remove_cooldown_popups,
 };
 
 /* Constructor to register cooldown button */
@@ -52,4 +94,5 @@ static __attribute__ ((constructor)) void cooldown_register_popup(void)
        register_popup(&cooldown_poweroff_ops);
        register_popup(&cooldown_ops);
        register_popup(&cooled_down_ops);
+       register_popup(&cooldown_remove_ops);
 }