From b48c1d7415f3ac52a162389a17e4fe57aec937c3 Mon Sep 17 00:00:00 2001 From: titan Date: Tue, 8 Feb 2011 00:53:26 +0000 Subject: [PATCH] Cleanup the flow browsing some more. SVN revision: 56793 --- src/bin/ephoto_flow_browser.c | 54 +++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/src/bin/ephoto_flow_browser.c b/src/bin/ephoto_flow_browser.c index 350f1a3..3e8be5a 100644 --- a/src/bin/ephoto_flow_browser.c +++ b/src/bin/ephoto_flow_browser.c @@ -21,6 +21,7 @@ struct _Ephoto_Flow_Browser Evas_Object *images[5]; Evas_Object *toolbar; Ephoto_Flow_State efs; + char *swallows[5]; int flow_direct; struct { Elm_Toolbar_Item *go_back; @@ -35,9 +36,16 @@ Ephoto_Flow_Browser *efb; Evas_Object * ephoto_flow_browser_add(void) { + int i; + efb = calloc(1, sizeof(Ephoto_Flow_Browser)); efb->efs = EPHOTO_FLOW_STATE_FLOW; + efb->swallows[0] = "offscreen_left"; + efb->swallows[1] = "left"; + efb->swallows[2] = "center"; + efb->swallows[3] = "right"; + efb->swallows[4] = "offscreen_right"; efb->box = elm_box_add(ephoto->win); elm_box_horizontal_set(efb->box, EINA_FALSE); @@ -84,14 +92,13 @@ ephoto_flow_browser_add(void) edje_object_signal_callback_add (elm_layout_edje_get(efb->layout), "done", "ephoto", _ephoto_flow_done, NULL); - efb->images[0] = _ephoto_add_image("offscreen_left"); - efb->images[1] = _ephoto_add_image("left"); - efb->images[2] = _ephoto_add_image("center"); - evas_object_event_callback_add - (efb->images[2], EVAS_CALLBACK_MOUSE_DOWN, _ephoto_center_image_clicked, NULL); - efb->images[3] = _ephoto_add_image("right"); - efb->images[4] = _ephoto_add_image("offscreen_right"); - + for (i = 0; i < 5; i++) + { + efb->images[i] = _ephoto_add_image(efb->swallows[i]); + if (i == 2) + evas_object_event_callback_add + (efb->images[2], EVAS_CALLBACK_MOUSE_DOWN, _ephoto_center_image_clicked, NULL); + } return efb->box; } @@ -123,6 +130,14 @@ ephoto_flow_browser_image_set(void) void ephoto_flow_browser_del(void) { + int i; + + for (i = 0; i < 5; i++) + { + elm_layout_content_unset(efb->layout, efb->swallows[i]); + evas_object_del(efb->images[i]); + } + evas_object_del(efb->layout); evas_object_del(efb->box); free(efb); } @@ -155,6 +170,7 @@ _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char * { Evas_Object *edje, *image; Eina_List *prevv, *prev, *next, *nextt; + int i; prev = eina_list_prev(ephoto->current_index); if (!eina_list_data_get(prev)) @@ -172,11 +188,11 @@ _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char * edje = elm_layout_edje_get(efb->layout); edje_object_freeze(edje); - elm_layout_content_unset(efb->layout, "offscreen_right"); - elm_layout_content_unset(efb->layout, "right"); - elm_layout_content_unset(efb->layout, "center"); - elm_layout_content_unset(efb->layout, "left"); - elm_layout_content_unset(efb->layout, "offscreen_left"); + evas_object_event_callback_del + (efb->images[2], EVAS_CALLBACK_MOUSE_DOWN, _ephoto_center_image_clicked); + + for (i = 0; i < 5; i++) + elm_layout_content_unset(efb->layout, efb->swallows[i]); if (efb->flow_direct == 0) { @@ -187,13 +203,13 @@ _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char * efb->images[1] = efb->images[0]; efb->images[0] = image; + evas_object_event_callback_add + (efb->images[2], EVAS_CALLBACK_MOUSE_DOWN, _ephoto_center_image_clicked, NULL); + elm_image_file_set(efb->images[4], eina_list_data_get(nextt), NULL); elm_layout_content_set(efb->layout, "offscreen_right", efb->images[4]); -// elm_image_file_set(efb->images[3], eina_list_data_get(next), NULL); elm_layout_content_set(efb->layout, "right", efb->images[3]); -// elm_image_file_set(efb->images[2], eina_list_data_get(ephoto->current_index), NULL); elm_layout_content_set(efb->layout, "center", efb->images[2]); -// elm_image_file_set(efb->images[1], eina_list_data_get(prev), NULL); elm_layout_content_set(efb->layout, "left", efb->images[1]); elm_image_file_set(efb->images[0], eina_list_data_get(prevv), NULL); elm_layout_content_set(efb->layout, "offscreen_left", efb->images[0]); @@ -207,13 +223,13 @@ _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char * efb->images[3] = efb->images[4]; efb->images[4] = image; + evas_object_event_callback_add + (efb->images[2], EVAS_CALLBACK_MOUSE_DOWN, _ephoto_center_image_clicked, NULL); + elm_image_file_set(efb->images[0], eina_list_data_get(prevv), NULL); elm_layout_content_set(efb->layout, "offscreen_left", efb->images[0]); -// elm_image_file_set(efb->images[1], eina_list_data_get(prev), NULL); elm_layout_content_set(efb->layout, "left", efb->images[1]); -// elm_image_file_set(efb->images[2], eina_list_data_get(ephoto->current_index), NULL); elm_layout_content_set(efb->layout, "center", efb->images[2]); -// elm_image_file_set(efb->images[3], eina_list_data_get(next), NULL);; elm_layout_content_set(efb->layout, "right", efb->images[3]); elm_image_file_set(efb->images[4], eina_list_data_get(nextt), NULL); elm_layout_content_set(efb->layout, "offscreen_right", efb->images[4]);