diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index ce9c84f..ce75554 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -61,6 +61,7 @@ void ephoto_config_slideshow(Ephoto *em); void ephoto_config_about(Ephoto *em); Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent); +void ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries); void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry); void ephoto_single_browser_path_pending_set(Evas_Object *obj, const char *path); @@ -72,6 +73,7 @@ void ephoto_single_browser_cancel_editing(Evas_Object *main, /* smart callbacks called: "back" - the user wants to go back to the previous * screen. */ Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent); +void ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries); void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry); /* smart callbacks called: "back" - the user wants to go back to the previous @@ -163,6 +165,7 @@ struct _Ephoto Eina_List *entries; Eina_List *direntries; + Eina_List *selentries; Eina_List *thumbs; int thumb_gen_size; diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index dcebeea..5785cdf 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -39,12 +39,19 @@ _ephoto_thumb_browser_show(Ephoto *ephoto, Ephoto_Entry *entry) ephoto_title_set(ephoto, ephoto->config->directory); if ((entry) && (entry->item)) - elm_gengrid_item_bring_in(entry->item, ELM_GENGRID_ITEM_SCROLLTO_IN); + { + elm_gengrid_item_selected_set(entry->item, EINA_TRUE); + elm_gengrid_item_bring_in(entry->item, ELM_GENGRID_ITEM_SCROLLTO_IN); + } } static void _ephoto_single_browser_show(Ephoto *ephoto, Ephoto_Entry *entry) { + if (ephoto->selentries) + ephoto_single_browser_entries_set(ephoto->single_browser, ephoto->selentries); + else + ephoto_single_browser_entries_set(ephoto->single_browser, ephoto->entries); ephoto_single_browser_entry_set(ephoto->single_browser, entry); elm_naviframe_item_simple_promote(ephoto->pager, ephoto->single_browser); elm_object_focus_set(ephoto->single_browser, EINA_TRUE); @@ -54,6 +61,10 @@ _ephoto_single_browser_show(Ephoto *ephoto, Ephoto_Entry *entry) static void _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry) { + if (ephoto->selentries) + ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->selentries); + else + ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->entries); ephoto_slideshow_entry_set(ephoto->slideshow, entry); elm_naviframe_item_simple_promote(ephoto->pager, ephoto->slideshow); elm_object_focus_set(ephoto->slideshow, EINA_TRUE); @@ -67,6 +78,7 @@ _ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED, Ephoto *ephoto = data; Ephoto_Entry *entry = event_info; + ephoto->selentries = NULL; _ephoto_thumb_browser_show(ephoto, entry); } @@ -84,10 +96,12 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED, break; case EPHOTO_STATE_THUMB: + ephoto->selentries = NULL; _ephoto_thumb_browser_show(ephoto, entry); break; default: + ephoto->selentries = NULL; _ephoto_thumb_browser_show(ephoto, entry); } } @@ -108,6 +122,7 @@ _ephoto_thumb_browser_changed_directory(void *data, { Ephoto *ephoto = data; + ephoto->selentries = NULL; ephoto_single_browser_entry_set(ephoto->single_browser, NULL); ephoto_slideshow_entry_set(ephoto->slideshow, NULL); } @@ -172,6 +187,7 @@ ephoto_window_add(const char *path) EPHOTO_EVENT_POPULATE_END = ecore_event_type_new(); EPHOTO_EVENT_POPULATE_ERROR = ecore_event_type_new(); + ephoto->selentries = NULL; ephoto->win = elm_win_util_standard_add("ephoto", "Ephoto"); if (!ephoto->win) { @@ -642,6 +658,11 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry) { node = eina_list_data_find_list(ephoto->entries, entry); ephoto->entries = eina_list_remove_list(ephoto->entries, node); + if (ephoto->selentries) + { + node = eina_list_data_find_list(ephoto->selentries, entry); + ephoto->selentries = eina_list_remove_list(ephoto->selentries, node); + } } eina_stringshare_del(entry->path); eina_stringshare_del(entry->label); diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 3e8f7f3..c20bd03 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -25,6 +25,7 @@ struct _Ephoto_Single_Browser Ephoto_Orient orient; Eina_List *handlers; Eina_List *upload_handlers; + Eina_List *entries; Eina_Bool editing:1; Eina_Bool cropping:1; unsigned int *edited_image_data; @@ -598,13 +599,13 @@ _mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, static Ephoto_Entry * _first_entry_find(Ephoto_Single_Browser *sb) { - return eina_list_nth(sb->ephoto->entries, 0); + return eina_list_nth(sb->entries, 0); } static Ephoto_Entry * _last_entry_find(Ephoto_Single_Browser *sb) { - return eina_list_last_data_get(sb->ephoto->entries); + return eina_list_last_data_get(sb->entries); } static char * @@ -819,7 +820,7 @@ _next_entry(Ephoto_Single_Browser *sb) Ephoto_Entry *entry = NULL; Eina_List *node; - node = eina_list_data_find_list(sb->ephoto->entries, sb->entry); + node = eina_list_data_find_list(sb->entries, sb->entry); if (!node) return; if ((node = node->next)) @@ -837,7 +838,7 @@ _prev_entry(Ephoto_Single_Browser *sb) { Eina_List *node; Ephoto_Entry *entry = NULL; - node = eina_list_data_find_list(sb->ephoto->entries, sb->entry); + node = eina_list_data_find_list(sb->entries, sb->entry); if (!node) return; if ((node = node->prev)) @@ -2429,7 +2430,7 @@ _entry_free(void *data, const Ephoto_Entry *entry) if (entry == sb->entry) { elm_object_item_del(entry->item); - if (eina_list_count(sb->ephoto->entries) <= 1) + if (eina_list_count(sb->entries) <= 1) evas_object_smart_callback_call(sb->main, "back", NULL); else _next_entry(sb); @@ -2681,6 +2682,15 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent) return NULL; } +void +ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries) +{ + Ephoto_Single_Browser *sb = evas_object_data_get(obj, "single_browser"); + + if (entries) + sb->entries = entries; +} + void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry) { diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c index cc2b17c..41b97b2 100644 --- a/src/bin/ephoto_slideshow.c +++ b/src/bin/ephoto_slideshow.c @@ -9,6 +9,7 @@ struct _Ephoto_Slideshow Evas_Object *notify; Evas_Object *bar; Evas_Object *event; + Eina_List *entries; Elm_Object_Item *pause; Elm_Object_Item *pause_after; Elm_Object_Item *fullscreen; @@ -478,6 +479,15 @@ _slideshow_item_get(void *data, Evas_Object *obj) static const Elm_Slideshow_Item_Class _item_cls = { {_slideshow_item_get, NULL} }; +void +ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries) +{ + Ephoto_Slideshow *ss = evas_object_data_get(obj, "slideshow"); + + if (entries) + ss->entries = entries; +} + void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry) { @@ -529,7 +539,7 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry) } } - EINA_LIST_FOREACH(ss->ephoto->entries, l, itr) + EINA_LIST_FOREACH(ss->entries, l, itr) { Elm_Object_Item *slideshow_item; diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index e8667c6..c40ff4c 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -572,9 +572,24 @@ _ephoto_thumb_activated(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) { Ephoto_Thumb_Browser *tb = data; + Eina_List *selected, *s; + Elm_Object_Item *item; Elm_Object_Item *it = event_info; Ephoto_Entry *e = elm_object_item_data_get(it); + elm_gengrid_item_selected_set(it, EINA_TRUE); + selected = + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + if (eina_list_count(selected) <= 1) + tb->ephoto->selentries = NULL; + else + { + EINA_LIST_FOREACH(selected, s, item) + { + tb->ephoto->selentries = eina_list_append(tb->ephoto->selentries, + elm_object_item_data_get(item)); + } + } evas_object_smart_callback_call(tb->main, "view", e); } @@ -625,6 +640,8 @@ _slideshow(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; + Eina_List *selected, *s; + Elm_Object_Item *item; Elm_Object_Item *it = elm_gengrid_selected_item_get(tb->grid); Ephoto_Entry *entry; @@ -635,6 +652,18 @@ _slideshow(void *data, Evas_Object *obj EINA_UNUSED, if (!entry) return; + selected = + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + if (eina_list_count(selected) <= 1) + tb->ephoto->selentries = NULL; + else + { + EINA_LIST_FOREACH(selected, s, item) + { + tb->ephoto->selentries = eina_list_append(tb->ephoto->selentries, + elm_object_item_data_get(item)); + } + } evas_object_smart_callback_call(tb->main, "slideshow", entry); } @@ -3450,7 +3479,7 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent) elm_gengrid_align_set(tb->grid, 0.5, 0.0); elm_gengrid_multi_select_set(tb->grid, EINA_TRUE); elm_gengrid_multi_select_mode_set(tb->grid, - ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL); + ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT); elm_scroller_bounce_set(tb->grid, EINA_FALSE, EINA_TRUE); evas_object_smart_callback_add(tb->grid, "activated", _ephoto_thumb_activated, tb);