summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2014-11-01 03:15:10 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2014-11-01 03:15:12 +0900
commit1d4e0ab861fb96d932d4335e3213888db894307b (patch)
tree34f6602a7d66f4e587cc1d3e519e8f24d32bdbd8
parent025305092b89b8e1221e6a49f241945b6fbe6266 (diff)
main: Add close button.
This button is shown when the timer is expired.
-rw-r--r--src/main.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index fc4ee97..1a21e24 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,10 +26,18 @@ retry_button_clicked_cb(void *data, Evas_Object *obj, void *ev)
26 elm_layout_signal_emit(ad->layout, "game,retry", "tile_matching"); 26 elm_layout_signal_emit(ad->layout, "game,retry", "tile_matching");
27} 27}
28 28
29static void
30close_button_clicked_cb(void *data, Evas_Object *obj, void *ev)
31{
32 elm_exit();
33}
34
29static Eina_Bool 35static Eina_Bool
30progress_timer_cb(void *data) 36progress_timer_cb(void *data)
31{ 37{
32 appdata_s *ad = (appdata_s *)data; 38 appdata_s *ad = (appdata_s *)data;
39 Evas_Object *btn = NULL;
40
33 ad->seconds++; 41 ad->seconds++;
34 double value = ad->seconds / (double)GAME_TIME_SEC; 42 double value = ad->seconds / (double)GAME_TIME_SEC;
35 43
@@ -39,13 +47,18 @@ progress_timer_cb(void *data)
39 ad->popup = elm_popup_add(ad->win); 47 ad->popup = elm_popup_add(ad->win);
40 evas_object_layer_set(ad->popup, EVAS_LAYER_MAX); 48 evas_object_layer_set(ad->popup, EVAS_LAYER_MAX);
41 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 49 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42 elm_object_text_set(ad->popup, "<align=center>retry?</align>"); 50 elm_object_text_set(ad->popup, "<align=center>Retry?</align>");
43 elm_object_part_text_set(ad->popup, "title,text", "Time Over"); 51 elm_object_part_text_set(ad->popup, "title,text", "Time Over");
44 52
45 Evas_Object *btn1 = elm_button_add(ad->popup); 53 btn = elm_button_add(ad->popup);
46 elm_object_text_set(btn1, "retry"); 54 elm_object_text_set(btn, "Yes");
47 elm_object_part_content_set(ad->popup, "button1", btn1); 55 elm_object_part_content_set(ad->popup, "button1", btn);
48 evas_object_smart_callback_add(btn1, "clicked", retry_button_clicked_cb, ad); 56 evas_object_smart_callback_add(btn, "clicked", retry_button_clicked_cb, ad);
57
58 btn = elm_button_add(ad->popup);
59 elm_object_text_set(btn, "No");
60 elm_object_part_content_set(ad->popup, "button2", btn);
61 evas_object_smart_callback_add(btn, "clicked", close_button_clicked_cb, ad);
49 62
50 evas_object_show(ad->popup); 63 evas_object_show(ad->popup);
51 64