From 30cbc75689c4f51da6269ebca4337bef45701995 Mon Sep 17 00:00:00 2001 From: titan Date: Mon, 14 Feb 2011 03:04:20 +0000 Subject: [PATCH] Ephoto now uses the currently selected image in the thumb view as the center of the flow view when view flow is clicked. Also double clicking an image in the thumb view will take you to the flow view and use that image as the center of the flow view. SVN revision: 57002 --- src/bin/ephoto.h | 2 +- src/bin/ephoto_main.c | 7 +++++-- src/bin/ephoto_thumb_browser.c | 28 +++++++++++++++++----------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 5cf7395..1c392a2 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -43,7 +43,7 @@ Evas_Object *ephoto_slideshow_add(void); void ephoto_slideshow_del(void); Evas_Object *ephoto_thumb_browser_add(void); -void ephoto_thumb_browser_thumb_append(const char *file); +void ephoto_thumb_browser_thumb_append(Eina_List *node); void ephoto_thumb_browser_del(void); void ephoto_thumb_browser_show(void); diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index 64dfd4e..a39acb2 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -111,11 +111,14 @@ _ephoto_thumb_populate_filter(void *data __UNUSED__, Eio_File *handler __UNUSED_ static void _ephoto_thumb_populate_main(void *data __UNUSED__, Eio_File *handler __UNUSED__, const Eina_File_Direct_Info *info) { + Eina_List *node; ephoto->images = eina_list_append(ephoto->images, info->path); + node = eina_list_nth_list + (ephoto->images, (eina_list_count(ephoto->images)-1)); - ephoto_thumb_browser_thumb_append(info->path); + ephoto_thumb_browser_thumb_append(node); if (ephoto->file && !strcmp(ephoto->file, info->path)) - ephoto->current_index = ephoto->images; + ephoto->current_index = node; } static void diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index b9be259..34a32fd 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -100,6 +100,7 @@ ephoto_thumb_browser_add(void) evas_object_size_hint_weight_set (etb->grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_box_pack_end(etb->box, etb->grid); + evas_object_smart_callback_add(etb->grid, "clicked", _ephoto_show_flow, NULL); evas_object_show(etb->grid); return etb->box; @@ -122,29 +123,28 @@ ephoto_thumb_browser_show(void) } void -ephoto_thumb_browser_thumb_append(const char *file) +ephoto_thumb_browser_thumb_append(Eina_List *node) { - char *f; + Elm_Gengrid_Item *egi; const Elm_Gengrid_Item_Class *egic; - f = strdup(file); - egic = &_ephoto_thumbnail_class; - elm_gengrid_item_append(etb->grid, egic, f, NULL, NULL); + egi = elm_gengrid_item_append(etb->grid, egic, node, NULL, NULL); + elm_gengrid_item_data_set(egi, node); } static Evas_Object * _ephoto_thumbnail_icon_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) { + Eina_List *node = data; Evas_Object *o; - const char *file = data; ethumb_client_format_set(ephoto->client, ETHUMB_THUMB_FDO); ethumb_client_size_set(ephoto->client, etb->thumb_size, etb->thumb_size); o = elm_thumb_add(ephoto->win); elm_object_style_set(o, "noframe"); - elm_thumb_file_set(o, file, NULL); + elm_thumb_file_set(o, eina_list_data_get(node), NULL); evas_object_show(o); return o; @@ -153,9 +153,10 @@ _ephoto_thumbnail_icon_get(void *data, Evas_Object *obj __UNUSED__, const char * static char * _ephoto_thumbnail_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) { - const char *file = data, *f; + Eina_List *node = data; + const char *f; - f = ecore_file_file_get(file); + f = ecore_file_file_get(eina_list_data_get(node)); return strdup(f); } @@ -208,8 +209,13 @@ _ephoto_zoom_out(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_i static void _ephoto_show_flow(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) { - elm_toolbar_item_selected_set - (elm_toolbar_selected_item_get(etb->toolbar), EINA_FALSE); + Elm_Gengrid_Item *egi; + + elm_toolbar_item_selected_set(etb->action.view_flow, EINA_FALSE); + + egi = elm_gengrid_selected_item_get(etb->grid); + if (egi) + ephoto->current_index = elm_gengrid_item_data_get(egi); ephoto_flow_browser_show(); }