From: lokilee73 Date: Mon, 19 Jun 2017 09:06:38 +0000 (+0900) Subject: overheat popup : add remove_overheat_popups X-Git-Tag: accepted/tizen/4.0/unified/20170816.012354^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5e591881ad49bf6b1fd45b38162ab1e06f117fd;p=platform%2Fcore%2Fsystem%2Fsystem-popup.git overheat popup : add remove_overheat_popups Change-Id: Ic82ab786cb4a62c098d66268dc03ca7174522de2 Signed-off-by: lokilee73 --- diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 5c492fb..089d46b 100755 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -88,7 +88,7 @@ static DBusMessage *powerkey_popup(E_DBus_Object *obj, DBusMessage *msg) static DBusMessage *overheat_popup(E_DBus_Object *obj, DBusMessage *msg) { set_timer_to_terminate(); - return launch_overheat_popup(obj, msg, OVERHEAT_SYSPOPUP); + return launch_popup(obj, msg, OVERHEAT_SYSPOPUP); } /* Crash popup */ diff --git a/src/launcher/launcher.h b/src/launcher/launcher.h index 81c69eb..b76eeaf 100755 --- a/src/launcher/launcher.h +++ b/src/launcher/launcher.h @@ -119,6 +119,5 @@ struct edbus_object { /* launch popup */ DBusMessage *launch_popup(E_DBus_Object *obj, DBusMessage *msg, char *name); DBusMessage *launch_powerkey_popup(E_DBus_Object *obj, DBusMessage *msg, char *name); -DBusMessage *launch_overheat_popup(E_DBus_Object *obj, DBusMessage *msg, char *name); #endif /* __LAUNCHER_H__ */ diff --git a/src/launcher/popup.c b/src/launcher/popup.c index 146eddb..e396fc1 100755 --- a/src/launcher/popup.c +++ b/src/launcher/popup.c @@ -22,7 +22,6 @@ #define POPUP_CONTENT "_SYSPOPUP_CONTENT_" #define POPUP_NAME_POWERKEY "powerkey" -#define POPUP_NAME_OVERHEAT "overheat" DBusMessage *launch_popup(E_DBus_Object *obj, DBusMessage *msg, char *name) @@ -121,45 +120,3 @@ out: dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret); return reply; } - -DBusMessage *launch_overheat_popup(E_DBus_Object *obj, - DBusMessage *msg, char *name) -{ - DBusMessage *reply; - DBusMessageIter iter; - int ret; - bundle *b = NULL; - - if (!name) { - ret = -EINVAL; - goto out; - } - - _I("launch popup (%s)", name); - - b = bundle_create(); - if (!b) { - ret = -ENOMEM; - goto out; - } - - ret = bundle_add(b, POPUP_CONTENT, POPUP_NAME_OVERHEAT); - if (ret < 0) { - _E("Failed to add bundle (%s,%s) (ret:%d)", POPUP_CONTENT, POPUP_NAME_OVERHEAT, ret); - goto out; - } - - ret = syspopup_launch(name, b); - if (ret < 0) - _E("Failed to launch popup(%d)", ret); - -out: - if (b) - bundle_free(b); - - reply = dbus_message_new_method_return(msg); - dbus_message_iter_init_append(reply, &iter); - dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret); - - return reply; -} diff --git a/src/overheat/overheat.c b/src/overheat/overheat.c index c49ed67..a1b0626 100755 --- a/src/overheat/overheat.c +++ b/src/overheat/overheat.c @@ -44,6 +44,7 @@ static Evas_Object *timer_label; static const struct popup_ops overheat_ops; static const struct popup_ops overheat_poweroff_warning_ops; +static const struct popup_ops remove_overheat_popups_ops; static void register_handlers(const struct popup_ops *ops); static void unregister_handlers(const struct popup_ops *ops); static void overheat_poweroff(const struct popup_ops *ops); @@ -347,6 +348,20 @@ int overheat_popup(bundle *b, const struct popup_ops *ops) return 0; } +static int remove_all_overheat_popups(bundle *b, const struct popup_ops *ops) +{ + unload_simple_popup(&overheat_ops); + unload_simple_popup(&overheat_poweroff_warning_ops); + terminate_if_no_popup(); + + return 0; +} + +static const struct popup_ops remove_overheat_popups_ops = { + .name = "remove_overheat_popups", + .show = remove_all_overheat_popups, +}; + static const struct popup_ops overheat_ops = { .name = "overheat", //overheat first popup .pattern = FEEDBACK_PATTERN_LOWBATT, @@ -371,4 +386,5 @@ static __attribute__ ((constructor)) void overheat_register_popup(void) { register_popup(&overheat_ops); register_popup(&overheat_poweroff_warning_ops); + register_popup(&remove_overheat_popups_ops); }