From b05b83b0f4557b180d681ea39b59bd09648ccb04 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Tue, 27 Dec 2016 16:32:44 +0900 Subject: [PATCH] common : add ops->terminate in unload_simple_popup before removing popup Change-Id: I49361ad5484e284d7c2e07d7a896a0ce2d4f9331 Signed-off-by: lokilee73 --- src/common/popup-ui.c | 5 +++++ src/cooldown/cooldown-wearable.c | 21 ++++++++++++++++----- src/powerkey/powerkey-mobile.c | 9 ++++++--- src/usb/usb-device.c | 5 ++--- src/usb/usb-mobile.c | 1 - 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/common/popup-ui.c b/src/common/popup-ui.c index 0820ab0..5525797 100755 --- a/src/common/popup-ui.c +++ b/src/common/popup-ui.c @@ -146,6 +146,11 @@ void unload_simple_popup(const struct popup_ops *ops) if (ret < 0) return; + if (obj && obj->popup) { + if (obj->ops->terminate) + obj->ops->terminate(obj->ops); + } + release_evas_object(&(obj->popup)); } diff --git a/src/cooldown/cooldown-wearable.c b/src/cooldown/cooldown-wearable.c index 24ee6e0..98018d0 100755 --- a/src/cooldown/cooldown-wearable.c +++ b/src/cooldown/cooldown-wearable.c @@ -143,6 +143,7 @@ static int add_dbus_signal_handler(const struct popup_ops *ops) SIGNAL_COOL_DOWN_CHANGED, cooldown_changed, (void *)ops); + if (!release_handler) { _E("Failed to add signal handler"); return -ENOMEM; @@ -183,6 +184,9 @@ static void cooldown_poweroff(const struct popup_ops *ops) char data[8]; int ret; + _I("Poweroff is selected"); + unload_simple_popup(ops); + param[0] = POWER_OPERATION_OFF; snprintf(data, sizeof(data), "0"); param[1] = data; @@ -195,7 +199,10 @@ static void cooldown_poweroff(const struct popup_ops *ops) if (ret < 0) _E("Failed to request poweroff to deviced (%d)", ret); +} +static void cooldown_poweroff_terminate(const struct popup_ops *ops) +{ terminate_if_no_popup(); } @@ -203,11 +210,15 @@ static void cooldown_warning(const struct popup_ops *ops) { _I("Warning is selected"); - remove_dbus_signal_handler(); - unload_simple_popup(ops); +} + +static void cooldown_warning_terminate(const struct popup_ops *ops) +{ cooldown_send_warning_signal(ops); - window_terminate(); + + remove_dbus_signal_handler(); + terminate_if_no_popup(); } static Eina_Bool beep_time_expired(void *data) @@ -295,7 +306,7 @@ static const struct popup_ops cooldown_poweroff_ops = { .left_text = "IDS_COM_SK_OK", .left = cooldown_poweroff, .pre = cooldown_poweroff_timer, - .terminate = cooldown_poweroff, + .terminate = cooldown_poweroff_terminate, }; static const struct popup_ops cooldown_poweron_ops = { @@ -314,7 +325,7 @@ static const struct popup_ops cooldown_warning_ops = { .left_text = "IDS_COM_SK_OK", .left = cooldown_warning, .pre = cooldown_warning_timer, - .terminate = cooldown_warning, + .terminate = cooldown_warning_terminate, }; /* Constructor to register cooldown button */ diff --git a/src/powerkey/powerkey-mobile.c b/src/powerkey/powerkey-mobile.c index 0feb0a6..a5e2b3f 100755 --- a/src/powerkey/powerkey-mobile.c +++ b/src/powerkey/powerkey-mobile.c @@ -231,15 +231,18 @@ int powerkey_list(bundle *b, const struct popup_ops *ops) if (!ops) return -EINVAL; ret = get_object_by_ops(ops, &obj); - if (ret < 0) return -EINVAL; + if (ret < 0) + return -EINVAL; win = get_window(); - if (!win) return -ENOMEM; + if (!win) + return -ENOMEM; evas_object_show(win); popup = elm_popup_add(win); - if (!popup) return -ENOMEM; + if (!popup) + return -ENOMEM; elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); diff --git a/src/usb/usb-device.c b/src/usb/usb-device.c index 6745407..3f88c9c 100755 --- a/src/usb/usb-device.c +++ b/src/usb/usb-device.c @@ -107,7 +107,6 @@ static void usb_device_confirm_cancel_clicked(const struct popup_ops *ops) static void usb_device_confirm_terminate(const struct popup_ops *ops) { _I("terminate usb device confirm popup"); - unload_simple_popup(ops); send_result_dbus_signal(USB_DEVICE_CONFIRM_NOK); terminate_if_no_popup(); } @@ -115,7 +114,6 @@ static void usb_device_confirm_terminate(const struct popup_ops *ops) static void usbhost_confirm_terminate(const struct popup_ops *ops) { _I("terminate usb device confirm popup"); - unload_simple_popup(ops); terminate_if_no_popup(); } @@ -253,7 +251,8 @@ static int usbhost_show(bundle *b, const struct popup_ops *ops) elm_label_line_wrap_set(label, ELM_WRAP_MIXED); ret = usbhost_get_contents(b, content, sizeof(content)); - if (ret<0) return -EINVAL; + if (ret < 0) + return -EINVAL; elm_object_text_set(label, content); evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); diff --git a/src/usb/usb-mobile.c b/src/usb/usb-mobile.c index f4e18b7..c982b77 100755 --- a/src/usb/usb-mobile.c +++ b/src/usb/usb-mobile.c @@ -78,7 +78,6 @@ static int usb_launch(bundle *b, const struct popup_ops *ops) static void usb_terminate(const struct popup_ops *ops) { - unload_simple_popup(ops); if (state_handler == 0) { vconf_ignore_key_changed( VCONFKEY_SYSMAN_USB_STATUS, -- 2.7.4