From: lokilee73 Date: Thu, 15 Jun 2017 11:51:48 +0000 (+0900) Subject: cooldown : add remove_other_cooldown_popup X-Git-Tag: accepted/tizen/4.0/unified/20170816.012354~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ea0fd2f0b651beffe61af1273da227b5191c03b;p=platform%2Fcore%2Fsystem%2Fsystem-popup.git cooldown : add remove_other_cooldown_popup Change-Id: Ibcf77d8fa521ff3f2b84814802459f36644021fe Signed-off-by: lokilee73 --- diff --git a/src/cooldown/cooldown-mobile.c b/src/cooldown/cooldown-mobile.c index 48cafe2..d75bf1a 100755 --- a/src/cooldown/cooldown-mobile.c +++ b/src/cooldown/cooldown-mobile.c @@ -19,6 +19,40 @@ #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); }