From: lokilee73 Date: Fri, 9 Dec 2016 11:03:18 +0000 (+0900) Subject: overheat popup : add 30 seconds timer X-Git-Tag: submit/tizen_3.0/20161212.050116~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c05e6aeb977d6446fbc35d0041200afd6b0918d;p=platform%2Fcore%2Fsystem%2Fsystem-popup.git overheat popup : add 30 seconds timer Change-Id: I9d835de870f7779788ded04b822220b29b98745c Signed-off-by: lokilee73 --- diff --git a/src/overheat/overheat.c b/src/overheat/overheat.c index 142a057..fb6ec0a 100755 --- a/src/overheat/overheat.c +++ b/src/overheat/overheat.c @@ -29,6 +29,10 @@ #define POWER_METHOD "reboot" #define POWER_OPERATION_OFF "poweroff" +#define OVERTEMP_TIMEOUT 30 + +static int overtemp_timer = OVERTEMP_TIMEOUT; + static const struct popup_ops overheat_ops; static const struct popup_ops overheat_poweroff_warning_ops; static void register_handlers(const struct popup_ops *ops); @@ -52,7 +56,7 @@ char* gl_text_get(int index) if (index == 2) { text = _(items[2]); - snprintf(buffer, sizeof(buffer), text, 30); + snprintf(buffer, sizeof(buffer), text, overtemp_timer); return strdup(buffer); } else return strdup(_(items[index])); @@ -103,6 +107,19 @@ progressbar_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info ecore_timer_del(timer); } +static Eina_Bool update_overtemp_time(Evas_Object *label) +{ + overtemp_timer--; + + if (overtemp_timer < 0) { + overtemp_timer = OVERTEMP_TIMEOUT; + return ECORE_CALLBACK_CANCEL; + } else { + elm_object_text_set(label, gl_text_get(2)); + return ECORE_CALLBACK_RENEW; + } +} + static void unregister_handlers(const struct popup_ops *ops) { return; @@ -110,7 +127,7 @@ static void unregister_handlers(const struct popup_ops *ops) static void register_handlers(const struct popup_ops *ops) { - return; + return; } static void overheat_poweroff(const struct popup_ops *ops) @@ -270,6 +287,13 @@ int overheat_popup(bundle *b, const struct popup_ops *ops) elm_object_style_set(label2, "popup/default"); elm_label_line_wrap_set(label2, ELM_WRAP_MIXED); elm_object_text_set(label2, gl_text_get(2)); + + /* set timer */ + if (!ecore_timer_add(1, update_overtemp_time, label2)) { + _E("Fail to set timer"); + return -EINVAL; + } + evas_object_size_hint_weight_set(label2, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(label2, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(label2);