4 #include <Elementary.h>
10 #include "simple-popup.h"
13 #include <appcore-efl.h>
14 #include <ui-gadget.h>
18 static Evas_Object *win = NULL;
19 static Evas_Object *main_layout = NULL;
20 static Evas_Object *cs = NULL;
21 static Evas_Object *flip = NULL;
23 /* XXX elm_flip should just do the right thing, but it does not */
24 static Eina_Bool in_compose = EINA_FALSE;
25 static Eina_Bool in_flip_anim = EINA_FALSE;
27 Evas_Object *gui_simple_popup(const char *title, const char *message)
29 return simple_popup_add(win, title, message);
32 void gui_activate(void)
35 elm_win_activate(win);
36 evas_object_show(win);
39 void gui_send(const char *number, const char *message, Eina_Bool do_auto)
41 compose_set(cs, number, message, do_auto);
44 void gui_compose_enter(void)
49 in_compose = EINA_TRUE;
52 in_flip_anim = EINA_TRUE;
53 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
54 elm_object_focus_set(cs, EINA_TRUE);
57 void gui_compose_exit(void)
61 in_compose = EINA_FALSE;
64 in_flip_anim = EINA_TRUE;
65 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
66 elm_object_focus_set(cs, EINA_FALSE);
69 static void _gui_compose_sync(void *data __UNUSED__, Evas_Object *o __UNUSED__,
70 void *event_info __UNUSED__)
72 Eina_Bool showing_compose = !elm_flip_front_visible_get(flip);
74 if (showing_compose ^ in_compose) {
75 DBG("Flip back to sync");
76 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
77 elm_object_focus_set(cs, in_compose);
79 in_flip_anim = EINA_FALSE;
82 static void _on_clicked(void *data __UNUSED__, Evas_Object *o __UNUSED__,
83 const char *emission, const char *source __UNUSED__)
85 DBG("signal: %s", emission);
87 EINA_SAFETY_ON_FALSE_RETURN(eina_str_has_prefix(emission, "clicked,"));
88 emission += strlen("clicked,");
90 ERR("TODO: %s", emission);
93 Eina_Bool gui_init(void)
95 Evas_Object *lay, *obj;
98 /* messages should never, ever quit */
99 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE);
101 win = elm_win_util_standard_add("ofono-messages", "oFono Messages");
102 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
103 elm_win_autodel_set(win, EINA_FALSE);
106 appcore_set_i18n("ofono-efl", "en-US");
107 UG_INIT_EFL(win, UG_OPT_INDICATOR_PORTRAIT_ONLY);
110 flip = elm_flip_add(win);
111 evas_object_size_hint_weight_set(flip,
112 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
113 evas_object_size_hint_align_set(flip, EVAS_HINT_FILL, EVAS_HINT_FILL);
114 elm_win_resize_object_add(win, flip);
115 evas_object_smart_callback_add(flip, "animate,done",
116 _gui_compose_sync, NULL);
117 evas_object_show(flip);
119 main_layout = lay = layout_add(win, "messages");
120 EINA_SAFETY_ON_NULL_RETURN_VAL(lay, EINA_FALSE);
121 evas_object_size_hint_weight_set(lay,
122 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
123 evas_object_size_hint_align_set(lay, EVAS_HINT_FILL, EVAS_HINT_FILL);
124 elm_object_part_content_set(flip, "front", lay);
125 evas_object_show(lay);
127 elm_object_signal_callback_add(lay, "clicked,*", "gui",
130 cs = obj = compose_add(win);
131 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
132 evas_object_size_hint_weight_set(obj,
133 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
134 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
135 elm_object_part_content_set(flip, "back", obj);
136 evas_object_show(obj);
138 /* TODO: make it match better with Tizen: icon and other properties */
139 obj = elm_layout_edje_get(lay);
140 edje_object_size_min_get(obj, &w, &h);
141 if ((w == 0) || (h == 0))
142 edje_object_size_min_restricted_calc(obj, &w, &h, w, h);
143 if ((w == 0) || (h == 0))
144 edje_object_parts_extends_calc(obj, NULL, NULL, &w, &h);
145 evas_object_resize(win, w, h);
147 /* do not show it yet, RC will check if it should be visible or not */
151 void gui_shutdown(void)