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);
79 void gui_call_exit(void)
86 in_flip_anim = EINA_TRUE;
87 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
90 static void _gui_call_sync(void *data __UNUSED__, Evas_Object *o __UNUSED__,
91 void *event_info __UNUSED__)
93 Eina_Bool showing_call = !elm_flip_front_visible_get(flip);
95 if (showing_call ^ in_call) {
96 DBG("Flip back to sync");
97 elm_flip_go(flip, ELM_FLIP_ROTATE_Y_CENTER_AXIS);
99 in_flip_anim = EINA_FALSE;
102 Eina_Bool gui_init(void)
104 Evas_Object *lay, *obj;
106 /* dialer should never, ever quit */
107 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE);
109 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
110 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
111 elm_app_info_set(gui_init, "ofono-efl", "themes/default.edj");
113 snprintf(def_theme, sizeof(def_theme), "%s/themes/default.edj",
114 elm_app_data_dir_get());
116 elm_theme_extension_add(NULL, def_theme);
117 elm_theme_overlay_add(NULL, def_theme);
119 win = elm_win_util_standard_add("ofono-dialer", "oFono Dialer");
120 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
121 elm_win_autodel_set(win, EINA_FALSE);
123 flip = elm_flip_add(win);
124 evas_object_size_hint_weight_set(flip,
125 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
126 evas_object_size_hint_align_set(flip, EVAS_HINT_FILL, EVAS_HINT_FILL);
127 elm_win_resize_object_add(win, flip);
128 evas_object_smart_callback_add(flip, "animate,done",
129 _gui_call_sync, NULL);
130 evas_object_show(flip);
132 lay = gui_layout_add(win, "main");
133 EINA_SAFETY_ON_NULL_RETURN_VAL(lay, EINA_FALSE);
134 evas_object_size_hint_weight_set(lay,
135 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
136 evas_object_size_hint_align_set(lay, EVAS_HINT_FILL, EVAS_HINT_FILL);
137 elm_object_part_content_set(flip, "front", lay);
138 evas_object_show(lay);
140 kp = obj = keypad_add(win);
141 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
142 elm_object_part_content_set(lay, "elm.swallow.keypad", obj);
144 cs = obj = callscreen_add(win);
145 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
146 evas_object_size_hint_weight_set(obj,
147 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
148 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
149 elm_object_part_content_set(flip, "back", obj);
150 evas_object_show(obj);
152 /* TODO: make it match better with Tizen: icon and other properties */
153 evas_object_resize(win, 480, 800);
155 /* do not show it yet, RC will check if it should be visible or not */
159 void gui_shutdown(void)