4 #include <Elementary.h>
9 #include "callscreen.h"
11 static Evas_Object *win = NULL;
12 static Evas_Object *kp = NULL;
13 static Evas_Object *cs = NULL;
14 static Evas_Object *flip = NULL;
15 static char def_theme[PATH_MAX] = "";
17 /* XXX elm_flip should just do the right thing, but it does not */
18 static Eina_Bool in_call = EINA_FALSE;
19 static Eina_Bool in_flip_anim = EINA_FALSE;
21 Evas_Object *gui_layout_add(Evas_Object *parent, const char *style)
23 Evas_Object *layout = elm_layout_add(parent);
24 if (!elm_layout_theme_set(layout, "layout", "dialer", style)) {
25 CRITICAL("No theme for 'elm/layout/dialer/%s' at %s",
27 evas_object_del(layout);
33 static void _popup_close(void *data, Evas_Object *bt __UNUSED__, void *event __UNUSED__)
35 Evas_Object *popup = data;
36 evas_object_del(popup);
39 void gui_simple_popup(const char *title, const char *message)
41 Evas_Object *p = elm_popup_add(win);
44 evas_object_size_hint_weight_set(p, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
45 elm_object_text_set(p, message);
46 elm_object_part_text_set(p, "title,text", title);
48 bt = elm_button_add(p);
49 elm_object_text_set(bt, "Close");
50 elm_object_part_content_set(p, "button1", bt);
51 evas_object_smart_callback_add(bt, "clicked", _popup_close, p);
55 void gui_activate(void)
58 elm_win_activate(win);
59 evas_object_show(win);
62 void gui_number_set(const char *number, Eina_Bool auto_dial)
64 /* TODO: show keypad */
65 keypad_number_set(kp, number, auto_dial);
68 void gui_call_enter(void)
75 in_flip_anim = EINA_TRUE;
76 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
77 elm_object_focus_set(cs, EINA_TRUE);
80 void gui_call_exit(void)
87 in_flip_anim = EINA_TRUE;
88 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
89 elm_object_focus_set(kp, EINA_TRUE);
92 static void _gui_call_sync(void *data __UNUSED__, Evas_Object *o __UNUSED__,
93 void *event_info __UNUSED__)
95 Eina_Bool showing_call = !elm_flip_front_visible_get(flip);
97 if (showing_call ^ in_call) {
98 DBG("Flip back to sync");
99 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
101 elm_object_focus_set(cs, EINA_TRUE);
103 elm_object_focus_set(kp, EINA_TRUE);
105 in_flip_anim = EINA_FALSE;
108 Eina_Bool gui_init(void)
110 Evas_Object *lay, *obj;
112 /* dialer should never, ever quit */
113 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE);
115 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
116 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
117 elm_app_info_set(gui_init, "ofono-efl", "themes/default.edj");
119 snprintf(def_theme, sizeof(def_theme), "%s/themes/default.edj",
120 elm_app_data_dir_get());
122 elm_theme_extension_add(NULL, def_theme);
123 elm_theme_overlay_add(NULL, def_theme);
125 win = elm_win_util_standard_add("ofono-dialer", "oFono Dialer");
126 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
127 elm_win_autodel_set(win, EINA_FALSE);
129 flip = elm_flip_add(win);
130 evas_object_size_hint_weight_set(flip,
131 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
132 evas_object_size_hint_align_set(flip, EVAS_HINT_FILL, EVAS_HINT_FILL);
133 elm_win_resize_object_add(win, flip);
134 evas_object_smart_callback_add(flip, "animate,done",
135 _gui_call_sync, NULL);
136 evas_object_show(flip);
138 lay = gui_layout_add(win, "main");
139 EINA_SAFETY_ON_NULL_RETURN_VAL(lay, EINA_FALSE);
140 evas_object_size_hint_weight_set(lay,
141 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
142 evas_object_size_hint_align_set(lay, EVAS_HINT_FILL, EVAS_HINT_FILL);
143 elm_object_part_content_set(flip, "front", lay);
144 evas_object_show(lay);
146 kp = obj = keypad_add(win);
147 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
148 elm_object_part_content_set(lay, "elm.swallow.keypad", obj);
150 cs = obj = callscreen_add(win);
151 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
152 evas_object_size_hint_weight_set(obj,
153 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
154 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
155 elm_object_part_content_set(flip, "back", obj);
156 evas_object_show(obj);
158 /* TODO: make it match better with Tizen: icon and other properties */
159 evas_object_resize(win, 720, 1280);
161 /* do not show it yet, RC will check if it should be visible or not */
165 void gui_shutdown(void)