Fixed below things 76/75476/5
authorchangjoo.lee <changjoo.lee@samsung.com>
Mon, 20 Jun 2016 05:38:46 +0000 (14:38 +0900)
committerchangjoo.lee <changjoo.lee@samsung.com>
Wed, 22 Jun 2016 11:04:49 +0000 (20:04 +0900)
1. Insert back key operation in every popup
2. Remove space in core.c
3. Remove "remove_popup"
4. Change popup_terminate to window_terminate
5. Remove pm_state_chaged() funtion because it is not used

Change-Id: I6ca9aff162ade1baec12ec10199049b368ce3ad0
Signed-off-by: changjoo.lee <changjoo.lee@samsung.com>
src/battery/battery-mobile.c
src/common/core.c
src/common/popup-common-internal.h
src/common/popup-common.c
src/common/popup-common.h
src/common/popup-ui-normal.c
src/common/popup-ui.c
src/cooldown/cooldown-wearable.c
src/overheat/overheat.c
src/powerkey/powerkey.c

index 6c72ccd..6159fd5 100755 (executable)
@@ -131,7 +131,7 @@ static void poweroff_clicked(const struct popup_ops *ops)
 
        win = get_window();
        if (!win)
-               popup_terminate();
+               window_terminate();
 
        rect = evas_object_rectangle_add(evas_object_evas_get(win));
        evas_object_geometry_get(win, NULL, NULL, &w, &h);
@@ -180,7 +180,7 @@ static int remove_battery_popups(bundle *b, const struct popup_ops *ops)
        unload_simple_popup(&charge_error_high_ops);
        unload_simple_popup(&battery_disconnected_ops);
        terminate_if_no_popup();
-       
+
        return 0;
 }
 
index d3fd248..47b3fb1 100644 (file)
@@ -32,6 +32,7 @@ GList *get_popup_list(void)
 void register_popup(const struct popup_ops *ops)
 {
        struct object_ops *obj;
+
        if (!ops) {
                _E("Invalid parameter");
                return;
@@ -72,7 +73,7 @@ void terminate_if_no_popup(void)
                        return;
                }
        }
-       popup_terminate();
+       window_terminate();
 }
 
 static int load_popup_by_type(bundle *b)
@@ -95,7 +96,7 @@ static int load_popup_by_type(bundle *b)
                obj = (struct object_ops *)(l->data);
                if (!obj || !(obj->ops) || !(obj->ops->name) || !(obj->ops->show))
                        continue;
-               if (strncmp (type, obj->ops->name, strlen(type) + 1))
+               if (strncmp(type, obj->ops->name, strlen(type) + 1))
                        continue;
 
                if (obj->ops->skip && obj->ops->skip(b, obj->ops)) {
@@ -233,7 +234,7 @@ static int app_reset(bundle *b, void *data)
        return 0;
 
 out:
-       popup_terminate();
+       window_terminate();
        return ret;
 }
 
index bfec2ce..0245e2f 100644 (file)
@@ -52,7 +52,7 @@ struct object_ops {
 
 /* Common */
 GList *get_popup_list(void);
-void popup_terminate(void);
+void window_terminate(void);
 void release_evas_object(Evas_Object **obj);
 int get_object_by_ops(const struct popup_ops *ops, struct object_ops **obj);
 
index f3cfdae..31f6d8b 100755 (executable)
 
 static E_DBus_Connection *edbus_conn = NULL;
 
-/* Terminate popup */
+/* Terminate window */
 static Eina_Bool exit_idler_cb(void *data)
 {
        elm_exit();
        return ECORE_CALLBACK_CANCEL;
 }
 
-void popup_terminate(void)
+void window_terminate(void)
 {
        if (ecore_idler_add(exit_idler_cb, NULL))
                return;
index 069f954..4da5c49 100644 (file)
@@ -94,5 +94,5 @@ void play_feedback(int type, int pattern);
 void notify_feedback(long pattern); /* using thread */
 
 void change_display_state(void); /* using thread */
-
+void event_back_key_up(void *data, Evas_Object *obj, void *event_info);
 #endif /* __POPUP_COMMON_H__ */
index e7a4c39..3459f5e 100755 (executable)
 
 #define BUF_MAX 512
 
+void event_back_key_up(void *data, Evas_Object *obj, void *event_info)
+{
+       const struct popup_ops *ops = data;
+       Evas_Object *win;
+
+       win = get_window();
+       if (win) {
+               _D("unregister event back key, ops->name=%s", ops->name);
+               eext_object_event_callback_del(obj, EEXT_CALLBACK_BACK, event_back_key_up);
+}
+
+       if (ops)
+               unload_simple_popup(ops);
+       terminate_if_no_popup();
+}
+
 int load_normal_popup(const struct popup_ops *ops)
 {
        Evas_Object *lbtn;
@@ -96,7 +112,8 @@ int load_normal_popup(const struct popup_ops *ops)
                        evas_object_smart_callback_add(rbtn, "clicked", right_clicked, ops);
                }
        }
-
+               /* Register back key */
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
        evas_object_show(popup);
 
        obj->popup = popup;
index 242d81e..0820ab0 100755 (executable)
@@ -21,6 +21,7 @@
 
 static Evas_Object *window = NULL;
 
+
 /* Common */
 void release_evas_object(Evas_Object **obj)
 {
@@ -48,7 +49,7 @@ void remove_window(void)
 
 static void win_del(void *data, Evas_Object * obj, void *event)
 {
-       popup_terminate();
+       window_terminate();
 }
 
 int create_window(const char *name)
index f526fa1..22efa3d 100755 (executable)
@@ -190,7 +190,7 @@ static void cooldown_warning(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
        cooldown_send_warning_signal(ops);
-       popup_terminate();
+       window_terminate();
 }
 
 static Eina_Bool beep_time_expired(void *data)
index 4032f56..af442c7 100755 (executable)
 
 static const struct popup_ops overheat_ops;
 static const struct popup_ops overheat_poweroff_warning_ops;
-
-static void event_back_key_up(void *data, Evas_Object *obj, void *event_info);
-static void pm_state_changed(keynode_t *key, void *data);
 static void register_handlers(const struct popup_ops *ops);
 static void unregister_handlers(const struct popup_ops *ops);
-static void remove_popup(const struct popup_ops *ops);
 static void overheat_poweroff(const struct popup_ops *ops);
 static int overheat_launch(bundle *b, const struct popup_ops *ops);
 static void overheat_poweroff_warning_terminate(const struct popup_ops *ops);
@@ -58,7 +54,7 @@ _popup_turnoff_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
        const struct popup_ops *ops = data;
 
        overheat_poweroff(ops);
- }
+}
 
 static void
 _popup_cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
@@ -97,61 +93,14 @@ progressbar_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info
        ecore_timer_del(timer);
 }
 
-static void event_back_key_up(void *data, Evas_Object *obj, void *event_info)
-{
-       const struct popup_ops *ops = data;
-
-       if (ops)
-               remove_popup(ops);
-       terminate_if_no_popup();
-}
-
-static void pm_state_changed(keynode_t *key, void *data)
-{
-       const struct popup_ops *ops = data;
-
-       if (!key)
-               return;
-
-       if (vconf_keynode_get_int(key) != VCONFKEY_PM_STATE_LCDOFF)
-               return;
-
-       remove_popup(ops);
-}
-
 static void unregister_handlers(const struct popup_ops *ops)
 {
-       Evas_Object *win;
-
-       vconf_ignore_key_changed(VCONFKEY_PM_STATE, pm_state_changed);
-
-       win = get_window();
-       if (win)
-               eext_object_event_callback_del(win, EEXT_CALLBACK_BACK, event_back_key_up);
-}
-
-static void remove_popup(const struct popup_ops *ops)
-{
-       static bool terminating = false;
-
-       if (terminating)
-               return;
-
-       terminating = true;
-
-       unload_simple_popup(ops);
-       popup_terminate();
+       return;
 }
 
 static void register_handlers(const struct popup_ops *ops)
 {
-       Evas_Object *win;
-
-       win = get_window();
-       if (win)
-               eext_object_event_callback_add(win, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
-       else
-           _D("Something wrong in win!");
+               return;
 }
 
 static void overheat_poweroff(const struct popup_ops *ops)
@@ -171,7 +120,7 @@ static void overheat_poweroff(const struct popup_ops *ops)
 
        win = get_window();
        if (!win)
-               popup_terminate();
+               window_terminate();
 
        rect = evas_object_rectangle_add(evas_object_evas_get(win));
        evas_object_geometry_get(win, NULL, NULL, &w, &h);
@@ -259,6 +208,9 @@ int overheat_popup(bundle *b, const struct popup_ops *ops)
        elm_object_part_content_set(popup, "button2", btn);
        evas_object_smart_callback_add(btn, "clicked", _popup_turnoff_btn_clicked_cb, ops);
 
+       /* back key */
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
+
        /* layout */
        layout = elm_layout_add(popup);
        _D("ELM_OVERHEAT_EDC = %s", ELM_OVERHEAT_EDC);
index 04cb99e..31a905f 100755 (executable)
@@ -35,9 +35,7 @@
 
 int clicked_index = 0;
 
-static void remove_popup(const struct popup_ops *ops);
 static void pm_state_changed(keynode_t *key, void *data);
-static void event_back_key_up(void *data, Evas_Object *obj, void *event_info);
 static void register_handlers(const struct popup_ops *ops);
 static void unregister_handlers(const struct popup_ops *ops);
 static int poweroff_launch(bundle *b, const struct popup_ops *ops);
@@ -79,7 +77,7 @@ static void restart_clicked(const struct popup_ops *ops)
        unload_simple_popup(ops);
 
        win = get_window();
-       if (!win) popup_terminate();
+       if (!win) window_terminate();
 
        rect = evas_object_rectangle_add(evas_object_evas_get(win));
        evas_object_geometry_get(win, NULL, NULL, &w, &h);
@@ -215,6 +213,9 @@ int powerkey_list(bundle *b, const struct popup_ops *ops)
        box = elm_box_add(popup);
        evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
+       /* back key */
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
+
        /* genlist */
        genlist = elm_genlist_add(box);
        evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -241,17 +242,6 @@ int powerkey_list(bundle *b, const struct popup_ops *ops)
        return 0;
 }
 
-static void remove_popup(const struct popup_ops *ops)
-{
-       static bool terminating = false;
-
-       if (terminating) return;
-       terminating = true;
-
-       unload_simple_popup(ops);
-       popup_terminate();
-}
-
 static void pm_state_changed(keynode_t *key, void *data)
 {
        const struct popup_ops *ops = data;
@@ -259,15 +249,7 @@ static void pm_state_changed(keynode_t *key, void *data)
        if (!key) return;
        if (vconf_keynode_get_int(key) != VCONFKEY_PM_STATE_LCDOFF) return;
 
-       remove_popup(ops);
-}
-
-static void event_back_key_up(void *data, Evas_Object *obj, void *event_info)
-{
-       const struct popup_ops *ops = data;
-
-       if (ops) remove_popup(ops);
-       terminate_if_no_popup();
+       unload_simple_popup(ops);
 }
 
 static void register_handlers(const struct popup_ops *ops)
@@ -279,9 +261,6 @@ static void register_handlers(const struct popup_ops *ops)
                pm_state_changed,
                (void *)ops) != 0)
                _E("Failed to register vconf");
-
-       win = get_window();
-       if (win) eext_object_event_callback_add(win, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
 }
 
 static void unregister_handlers(const struct popup_ops *ops)
@@ -289,9 +268,6 @@ static void unregister_handlers(const struct popup_ops *ops)
        Evas_Object *win;
 
        vconf_ignore_key_changed(VCONFKEY_PM_STATE, pm_state_changed);
-
-       win = get_window();
-       if (win) eext_object_event_callback_del(win, EEXT_CALLBACK_BACK, event_back_key_up);
 }
 
 static int powerkey_list_launch(bundle *b, const struct popup_ops *ops)
@@ -331,7 +307,7 @@ static void poweroff_clicked(const struct popup_ops *ops)
        unload_simple_popup(ops);
 
        win = get_window();
-       if (!win) popup_terminate();
+       if (!win) window_terminate();
 
        rect = evas_object_rectangle_add(evas_object_evas_get(win));
        evas_object_geometry_get(win, NULL, NULL, &w, &h);