diff --git a/src/bin/ephoto.c b/src/bin/ephoto.c index 86d3548..5b401af 100644 --- a/src/bin/ephoto.c +++ b/src/bin/ephoto.c @@ -1,6 +1,7 @@ #include "ephoto.h" -int main(int argc, char **argv) +int +main(int argc, char **argv) { ethumb_client_init(); elm_need_efreet(); diff --git a/src/bin/ephoto_flow_browser.c b/src/bin/ephoto_flow_browser.c index 05e6ca2..48cf9e6 100644 --- a/src/bin/ephoto_flow_browser.c +++ b/src/bin/ephoto_flow_browser.c @@ -12,7 +12,8 @@ static Eina_List *iter; static Evas_Object *image, *toolbar; /*Create the flow browser*/ -void ephoto_create_flow_browser(void) +void +ephoto_create_flow_browser(void) { Evas_Object *o; @@ -61,7 +62,8 @@ void ephoto_create_flow_browser(void) } /*Show the flow browser*/ -void ephoto_show_flow_browser(const char *current_image) +void +ephoto_show_flow_browser(const char *current_image) { iter = eina_list_data_find_list(em->images, current_image); if (iter == NULL) @@ -75,7 +77,8 @@ void ephoto_show_flow_browser(const char *current_image) } /*Hide the flow browser*/ -void ephoto_hide_flow_browser(void) +void +ephoto_hide_flow_browser(void) { evas_object_hide(image); evas_object_hide(toolbar); @@ -83,7 +86,8 @@ void ephoto_hide_flow_browser(void) } /*Delete the flow browser*/ -void ephoto_delete_flow_browser(void) +void +ephoto_delete_flow_browser(void) { Eina_List *items; @@ -100,7 +104,8 @@ void ephoto_delete_flow_browser(void) } /*Go back to the thumbnail viewer*/ -static void _ephoto_go_back(void *data, Evas_Object *obj, void *event_info) +static void +_ephoto_go_back(void *data, Evas_Object *obj, void *event_info) { ephoto_hide_flow_browser(); ephoto_show_thumb_browser(); @@ -109,7 +114,8 @@ static void _ephoto_go_back(void *data, Evas_Object *obj, void *event_info) } /*Go to the very first image in the list*/ -static void _ephoto_go_first(void *data, Evas_Object *obj, void *event_info) +static void +_ephoto_go_first(void *data, Evas_Object *obj, void *event_info) { iter = eina_list_nth_list(em->images, 0); @@ -119,7 +125,8 @@ static void _ephoto_go_first(void *data, Evas_Object *obj, void *event_info) } /*Go to the very last image in the list*/ -static void _ephoto_go_last(void *data, Evas_Object *obj, void *event_info) +static void +_ephoto_go_last(void *data, Evas_Object *obj, void *event_info) { iter = eina_list_last(em->images); @@ -129,7 +136,8 @@ static void _ephoto_go_last(void *data, Evas_Object *obj, void *event_info) } /*Go to the next image in the list*/ -static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info) +static void +_ephoto_go_next(void *data, Evas_Object *obj, void *event_info) { iter = iter->next; if (!iter) @@ -141,7 +149,8 @@ static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info) } /*Go to the previous image in the list*/ -static void _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info) +static void +_ephoto_go_previous(void *data, Evas_Object *obj, void *event_info) { iter = iter->prev; if (!iter) diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index c61bf7f..5788400 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -7,7 +7,8 @@ Ephoto *em; static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info); /*Create the main ephoto window*/ -void ephoto_create_main_window(void) +void +ephoto_create_main_window(void) { em = calloc(1, sizeof(Ephoto)); em->thumbs_images = eina_hash_string_superfast_new((Eina_Free_Cb)eina_stringshare_del); @@ -42,7 +43,8 @@ void ephoto_create_main_window(void) } /*Delete the main ephoto window*/ -static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info) +static void +_ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info) { ephoto_delete_thumb_browser(); ephoto_delete_flow_browser(); diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index e57da88..cb6c53e 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -11,6 +11,7 @@ static char *_ephoto_get_label(const void *data, Evas_Object *obj, const char *p static Evas_Object *_ephoto_get_icon(const void *data, Evas_Object *obj, const char *part); static Eina_Bool _ephoto_get_state(const void *data, Evas_Object *obj, const char *part); static void _ephoto_grid_del(const void *data, Evas_Object *obj); +static void _ephoto_thumb_clicked(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info); /*Inline Variables*/ @@ -307,6 +308,8 @@ _ephoto_get_icon(const void *data, Evas_Object *obj, const char *part) elm_layout_file_set(thumb, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "/ephoto/thumb"); evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_event_callback_add(thumb, EVAS_CALLBACK_MOUSE_DOWN, + _ephoto_thumb_clicked, NULL); evas_object_show(thumb); o = elm_bg_add(em->win); @@ -335,12 +338,49 @@ _ephoto_grid_del(const void *data, Evas_Object *obj) return; } +/*Check to see if the thumbnail was double clicked*/ +static void +_ephoto_thumb_clicked(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + char *file; + const Eina_List *selected; + Evas_Event_Mouse_Down *emd; + Evas_Object *o; + + emd = event_info; + if (emd->flags == EVAS_BUTTON_DOUBLE_CLICK || + emd->flags == EVAS_BUTTON_TRIPLE_CLICK) + { + selected = elm_gengrid_selected_items_get(em->thumb_browser); + o = eina_list_data_get(selected); + file = (char *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o); + ephoto_hide_thumb_browser(); + ephoto_show_flow_browser(file); + } +} + /*Show the flow browser*/ static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info) { + const Eina_List *selected; + Evas_Object *o; + char *file; + ephoto_hide_thumb_browser(); - ephoto_show_flow_browser(eina_list_data_get(em->images)); + + selected = elm_gengrid_selected_items_get(em->thumb_browser); + + if (eina_list_data_get(selected)) + { + o = eina_list_data_get(selected); + file = (char *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o); + ephoto_show_flow_browser(file); + } + else + { + ephoto_show_flow_browser(eina_list_data_get(em->images)); + } elm_toolbar_item_unselect_all(toolbar); }