overheat: fix re-launching issue and power off issue after 30 sec 73/99573/1
authortaeyoung <ty317.kim@samsung.com>
Wed, 23 Nov 2016 09:12:26 +0000 (18:12 +0900)
committertaeyoung <ty317.kim@samsung.com>
Wed, 23 Nov 2016 09:12:26 +0000 (18:12 +0900)
- re-launching issue
  = Previously, the overheat popup was re-launched if deviced requests
    to launch the popup again. It looked weird for User.
  = Now, the overheat popup checks the existence of the popup and
    skips re-launching itself.

- power off issue
  = Previously, the overheat popup just hided the popup after 30 seconds.
  = Now, the overheat popup turns off the target after 30 seconds.

Change-Id: Ic078e767effa0f90df1ffd5853e44f00005d54ee
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/overheat/overheat.c

index f1d46a5..80f8352 100755 (executable)
@@ -79,14 +79,14 @@ _popup_cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 static Eina_Bool
 progressbar_timer_cb(void *data)
 {
-       Evas_Object *popup = data;
-       Evas_Object *progressbar = evas_object_data_get(popup, "progressbar");
+       struct object_ops *obj = data;
+       Evas_Object *progressbar = evas_object_data_get(obj->popup, "progressbar");
        double value = 0.0;
 
        value = elm_progressbar_value_get(progressbar);
        if (value == 1.0) {
-               evas_object_data_del(popup, "timer");
-               evas_object_del(popup);
+               evas_object_data_del(obj->popup, "timer");
+               overheat_poweroff(obj->ops);
                return ECORE_CALLBACK_CANCEL;
        }
        value = value + 0.01;
@@ -173,6 +173,22 @@ static void overheat_poweroff_warning_terminate(const struct popup_ops *ops)
        unregister_handlers(ops);
 }
 
+static bool overheat_skip(bundle *b, const struct popup_ops *ops)
+{
+       struct object_ops *obj;
+       int ret;
+
+       ret = get_object_by_ops(&overheat_ops, &obj);
+       if (ret == 0 && obj->popup)
+               return true;
+
+       ret = get_object_by_ops(&overheat_poweroff_warning_ops, &obj);
+       if (ret == 0 && obj->popup)
+               return true;
+
+       return false;
+}
+
 int overheat_popup(bundle *b, const struct popup_ops *ops)
 {
        Evas_Object *popup;
@@ -266,7 +282,7 @@ int overheat_popup(bundle *b, const struct popup_ops *ops)
        evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        elm_progressbar_pulse(progressbar, EINA_TRUE);
        elm_object_part_content_set(layout, "processing", progressbar);
-       timer = ecore_timer_add(0.3, progressbar_timer_cb, popup);
+       timer = ecore_timer_add(0.3, progressbar_timer_cb, obj);
 
        evas_object_data_set(popup, "progressbar", progressbar);
        evas_object_data_set(popup, "timer", timer);
@@ -282,6 +298,7 @@ int overheat_popup(bundle *b, const struct popup_ops *ops)
 static const struct popup_ops overheat_ops = {
        .name           = "overheat", //overheat first popup
        .show           = overheat_popup,
+       .skip           = overheat_skip,
        .pre            = overheat_launch,
        .terminate  = overheat_terminate,
 };