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);
unload_simple_popup(&charge_error_high_ops);
unload_simple_popup(&battery_disconnected_ops);
terminate_if_no_popup();
-
+
return 0;
}
void register_popup(const struct popup_ops *ops)
{
struct object_ops *obj;
+
if (!ops) {
_E("Invalid parameter");
return;
return;
}
}
- popup_terminate();
+ window_terminate();
}
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)) {
return 0;
out:
- popup_terminate();
+ window_terminate();
return ret;
}
/* 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);
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;
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__ */
#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;
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;
static Evas_Object *window = NULL;
+
/* Common */
void release_evas_object(Evas_Object **obj)
{
static void win_del(void *data, Evas_Object * obj, void *event)
{
- popup_terminate();
+ window_terminate();
}
int create_window(const char *name)
unload_simple_popup(ops);
cooldown_send_warning_signal(ops);
- popup_terminate();
+ window_terminate();
}
static Eina_Bool beep_time_expired(void *data)
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);
const struct popup_ops *ops = data;
overheat_poweroff(ops);
- }
+}
static void
_popup_cancel_btn_clicked_cb(void *data, 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)
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);
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);
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);
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);
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);
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;
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)
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)
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)
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);