|
|
|
@ -466,134 +466,23 @@ _sort_mod_desc(void *data, Evas_Object *obj EINA_UNUSED, |
|
|
|
|
NULL, tb->dirs_only, tb->thumbs_only); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static Eina_Bool |
|
|
|
|
_similarity_items_process(void *data) |
|
|
|
|
{ |
|
|
|
|
Ephoto_Thumb_Browser *tb = data; |
|
|
|
|
Ephoto_Entry *entry; |
|
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
if ((tb->animator.processed == tb->animator.count)) |
|
|
|
|
{ |
|
|
|
|
Evas_Object *popup = evas_object_data_get(tb->grid, "popup"); |
|
|
|
|
Eina_List *similar = NULL; |
|
|
|
|
Elm_Object_Item *it; |
|
|
|
|
|
|
|
|
|
if (tb->animator.count == 0) |
|
|
|
|
return EINA_TRUE; |
|
|
|
|
tb->animator.todo_items = NULL; |
|
|
|
|
tb->processing = 0; |
|
|
|
|
if (popup) |
|
|
|
|
{ |
|
|
|
|
evas_object_del(popup); |
|
|
|
|
evas_object_data_del(popup, "popup"); |
|
|
|
|
}
|
|
|
|
|
it = elm_gengrid_first_item_get(tb->grid); |
|
|
|
|
while(it) |
|
|
|
|
{ |
|
|
|
|
Ephoto_Entry *e = elm_object_item_data_get(it); |
|
|
|
|
similar = eina_list_append(similar, e); |
|
|
|
|
it = elm_gengrid_item_next_get(it); |
|
|
|
|
} |
|
|
|
|
if (tb->searching) |
|
|
|
|
{ |
|
|
|
|
if (eina_list_count(tb->searchentries)) |
|
|
|
|
eina_list_free(tb->searchentries); |
|
|
|
|
tb->searchentries = eina_list_clone(similar); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (eina_list_count(tb->entries)) |
|
|
|
|
eina_list_free(tb->entries); |
|
|
|
|
if (eina_list_count(tb->ephoto->entries)) |
|
|
|
|
eina_list_free(tb->ephoto->entries); |
|
|
|
|
tb->entries = eina_list_clone(similar); |
|
|
|
|
tb->ephoto->entries = eina_list_clone(similar); |
|
|
|
|
} |
|
|
|
|
if (eina_list_count(similar)) |
|
|
|
|
eina_list_free(similar); |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
tb->animator.todo_items = NULL; |
|
|
|
|
tb->processing = 1; |
|
|
|
|
EINA_LIST_FREE(tb->todo_items, entry) |
|
|
|
|
{ |
|
|
|
|
i++; |
|
|
|
|
if (i > TODO_ITEM_MIN_BATCH) |
|
|
|
|
return EINA_TRUE; |
|
|
|
|
const Elm_Gengrid_Item_Class *ic; |
|
|
|
|
|
|
|
|
|
ic = &_ephoto_thumb_file_class; |
|
|
|
|
if (tb->sort == EPHOTO_SORT_SIMILARITY) |
|
|
|
|
entry->item = |
|
|
|
|
elm_gengrid_item_sorted_insert(tb->grid, ic, entry, |
|
|
|
|
_entry_cmp_grid_similarity, NULL, NULL); |
|
|
|
|
if (entry->item) |
|
|
|
|
{ |
|
|
|
|
elm_object_item_data_set(entry->item, entry); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
ephoto_entry_free(tb->ephoto, entry); |
|
|
|
|
} |
|
|
|
|
tb->animator.processed++; |
|
|
|
|
} |
|
|
|
|
return EINA_TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
_sort_similarity(void *data, Evas_Object *obj EINA_UNUSED, |
|
|
|
|
void *event_data EINA_UNUSED) |
|
|
|
|
{ |
|
|
|
|
Ephoto_Thumb_Browser *tb = data; |
|
|
|
|
Evas_Object *popup, *box, *label, *pb, *ic; |
|
|
|
|
Evas_Object *ic; |
|
|
|
|
|
|
|
|
|
tb->sort = EPHOTO_SORT_SIMILARITY; |
|
|
|
|
tb->ephoto->sort = EPHOTO_SORT_SIMILARITY; |
|
|
|
|
tb->thumbs_only = 1; |
|
|
|
|
tb->dirs_only = 0; |
|
|
|
|
|
|
|
|
|
ic = elm_icon_add(obj); |
|
|
|
|
elm_icon_standard_set(ic, "view-sort-ascending"); |
|
|
|
|
elm_object_part_content_set(obj, "icon", ic); |
|
|
|
|
evas_object_show(ic); |
|
|
|
|
|
|
|
|
|
ephoto_thumb_browser_clear(tb->ephoto); |
|
|
|
|
|
|
|
|
|
tb->todo_items = eina_list_clone(tb->entries); |
|
|
|
|
tb->animator.count = eina_list_count(tb->todo_items); |
|
|
|
|
tb->animator.processed = 0; |
|
|
|
|
if (!tb->animator.todo_items) |
|
|
|
|
tb->animator.todo_items = ecore_animator_add(_similarity_items_process, tb); |
|
|
|
|
|
|
|
|
|
popup = elm_popup_add(tb->ephoto->win); |
|
|
|
|
elm_object_part_text_set(popup, "title,text", _("Sorting")); |
|
|
|
|
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER); |
|
|
|
|
|
|
|
|
|
box = elm_box_add(popup); |
|
|
|
|
elm_box_horizontal_set(box, EINA_FALSE); |
|
|
|
|
evas_object_size_hint_weight_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); |
|
|
|
|
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); |
|
|
|
|
evas_object_show(box); |
|
|
|
|
|
|
|
|
|
label = elm_label_add(box); |
|
|
|
|
elm_object_text_set(label, _("Sorting Images By Similarity")); |
|
|
|
|
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); |
|
|
|
|
evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); |
|
|
|
|
elm_box_pack_end(box, label); |
|
|
|
|
evas_object_show(label); |
|
|
|
|
|
|
|
|
|
pb = elm_progressbar_add(box); |
|
|
|
|
evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, 0.0); |
|
|
|
|
evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); |
|
|
|
|
elm_object_style_set(pb, "wheel"); |
|
|
|
|
elm_progressbar_pulse_set(pb, EINA_TRUE); |
|
|
|
|
elm_box_pack_end(box, pb); |
|
|
|
|
evas_object_show(pb); |
|
|
|
|
elm_progressbar_pulse(pb, EINA_TRUE); |
|
|
|
|
|
|
|
|
|
evas_object_data_set(tb->grid, "popup", popup); |
|
|
|
|
elm_object_part_content_set(popup, "default", box); |
|
|
|
|
evas_object_show(popup); |
|
|
|
|
ephoto_directory_set(tb->ephoto, tb->ephoto->config->directory, |
|
|
|
|
NULL, tb->dirs_only, tb->thumbs_only); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
@ -1231,7 +1120,11 @@ _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, |
|
|
|
|
e->item = |
|
|
|
|
elm_gengrid_item_sorted_insert(tb->grid, ic, e, |
|
|
|
|
_entry_cmp_grid_mod_desc, NULL, NULL); |
|
|
|
|
if (e->item) |
|
|
|
|
else if (tb->sort == EPHOTO_SORT_SIMILARITY) |
|
|
|
|
e->item = |
|
|
|
|
elm_gengrid_item_sorted_insert(tb->grid, ic, e, |
|
|
|
|
_entry_cmp_grid_similarity, NULL, NULL); |
|
|
|
|
if (e->item) |
|
|
|
|
{ |
|
|
|
|
Eina_File *f; |
|
|
|
|
elm_object_item_data_set(e->item, e); |
|
|
|
@ -1465,11 +1358,15 @@ _todo_items_process(void *data) |
|
|
|
|
entry->item = |
|
|
|
|
elm_gengrid_item_sorted_insert(tb->grid, ic, entry, |
|
|
|
|
_entry_cmp_grid_mod_desc, NULL, NULL); |
|
|
|
|
else if (tb->sort == EPHOTO_SORT_SIMILARITY) |
|
|
|
|
entry->thumb = |
|
|
|
|
ephoto_thumb_add(entry->ephoto, tb->grid, entry); |
|
|
|
|
|
|
|
|
|
if (entry->item) |
|
|
|
|
{ |
|
|
|
|
elm_object_item_data_set(entry->item, entry); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
else if (tb->sort != EPHOTO_SORT_SIMILARITY) |
|
|
|
|
{ |
|
|
|
|
ephoto_entry_free(tb->ephoto, entry); |
|
|
|
|
} |
|
|
|
@ -1488,20 +1385,6 @@ _ephoto_thumb_populate_start(void *data, int type EINA_UNUSED, |
|
|
|
|
if (tb->dirs_only) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
|
|
|
|
|
if (tb->sort == EPHOTO_SORT_SIMILARITY) |
|
|
|
|
{ |
|
|
|
|
Evas_Object *ic; |
|
|
|
|
|
|
|
|
|
tb->sort = EPHOTO_SORT_ALPHABETICAL_ASCENDING; |
|
|
|
|
|
|
|
|
|
ic = elm_icon_add(tb->hover); |
|
|
|
|
elm_icon_standard_set(ic, "view-sort-ascending"); |
|
|
|
|
elm_object_part_content_set(tb->hover, "icon", ic); |
|
|
|
|
evas_object_show(ic); |
|
|
|
|
|
|
|
|
|
elm_object_text_set(tb->hover, _("Sort")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
elm_object_item_disabled_set(tb->similarity, EINA_TRUE); |
|
|
|
|
tb->animator.processed = 0; |
|
|
|
|
tb->animator.count = 0; |
|
|
|
@ -1976,6 +1859,10 @@ ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry) |
|
|
|
|
entry->item = |
|
|
|
|
elm_gengrid_item_sorted_insert(tb->grid, ic, entry, |
|
|
|
|
_entry_cmp_grid_mod_desc, NULL, NULL); |
|
|
|
|
else if (tb->sort == EPHOTO_SORT_SIMILARITY) |
|
|
|
|
entry->item = |
|
|
|
|
elm_gengrid_item_sorted_insert(tb->grid, ic, entry, |
|
|
|
|
_entry_cmp_grid_similarity, NULL, NULL); |
|
|
|
|
if (entry->item) |
|
|
|
|
{ |
|
|
|
|
elm_object_item_data_set(entry->item, entry); |
|
|
|
|