common : add ops->terminate in unload_simple_popup before removing popup 23/107223/4
authorlokilee73 <changjoo.lee@samsung.com>
Tue, 27 Dec 2016 07:32:44 +0000 (16:32 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Wed, 28 Dec 2016 01:59:38 +0000 (10:59 +0900)
Change-Id: I49361ad5484e284d7c2e07d7a896a0ce2d4f9331
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/common/popup-ui.c
src/cooldown/cooldown-wearable.c
src/powerkey/powerkey-mobile.c
src/usb/usb-device.c
src/usb/usb-mobile.c

index 0820ab0..5525797 100755 (executable)
@@ -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));
 }
 
index 24ee6e0..98018d0 100755 (executable)
@@ -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 */
index 0feb0a6..a5e2b3f 100755 (executable)
@@ -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);
index 6745407..3f88c9c 100755 (executable)
@@ -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);
index f4e18b7..c982b77 100755 (executable)
@@ -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,