empc should try to maintain scroller position and selection states when updating playlist
This commit is contained in:
parent
f52836820a
commit
f9b3c5a6a5
|
@ -2535,6 +2535,9 @@ queue_list_handler(Eina_Value *value, Eina_Bool cached)
|
|||
Empd_Empdd_Song *so;
|
||||
const char *album = NULL, *artist = NULL;
|
||||
Elm_Object_Item *itl = NULL, *ith = NULL;
|
||||
int x, y, w, h;
|
||||
Eina_Bool reset = EINA_FALSE;
|
||||
Eina_List *sel = NULL;
|
||||
static Elm_Genlist_Item_Class queue_itc = {
|
||||
.item_style = "default",
|
||||
.func = {
|
||||
|
@ -2559,11 +2562,23 @@ queue_list_handler(Eina_Value *value, Eina_Bool cached)
|
|||
return;
|
||||
}
|
||||
if ((!cached) && (!noclear))
|
||||
elm_genlist_clear(queue_list);
|
||||
{
|
||||
Elm_Object_Item *it;
|
||||
const Eina_List *l, *its = elm_genlist_selected_items_get(queue_list);
|
||||
elm_scroller_region_get(queue_list, &x, &y, &w, &h);
|
||||
elm_genlist_clear(queue_list);
|
||||
if (its)
|
||||
{
|
||||
EINA_LIST_FOREACH(its, l, it)
|
||||
sel = eina_list_append(sel, Empd_Empdd_Song_copy(elm_object_item_data_get(it)));
|
||||
}
|
||||
reset = EINA_TRUE;
|
||||
}
|
||||
EINA_LIST_FREE(songs->songs, so)
|
||||
{
|
||||
Elm_Object_Item *it = NULL;
|
||||
Empd_Empdd_Song *sop;
|
||||
Eina_List *l, *ll;
|
||||
|
||||
if (cached || noclear)
|
||||
{
|
||||
|
@ -2633,6 +2648,14 @@ queue_list_handler(Eina_Value *value, Eina_Bool cached)
|
|||
if (itl)
|
||||
elm_genlist_item_fields_update(elm_genlist_item_parent_get(itl), EMPC_TEXT_TIME, ELM_GENLIST_ITEM_FIELD_TEXT);
|
||||
}
|
||||
EINA_LIST_FOREACH_SAFE(sel, l, ll, sop)
|
||||
{
|
||||
if (!Empd_Empdd_Song_eq(so, sop)) continue;
|
||||
elm_genlist_item_selected_set(it, EINA_TRUE);
|
||||
sel = eina_list_remove_list(sel, l);
|
||||
Empd_Empdd_Song_free(sop);
|
||||
}
|
||||
E_FREE_LIST(sel, Empd_Empdd_Song_free);
|
||||
album = so->album;
|
||||
artist = so->artist;
|
||||
itl = it;
|
||||
|
@ -2640,6 +2663,8 @@ queue_list_handler(Eina_Value *value, Eina_Bool cached)
|
|||
free(songs);
|
||||
if (noclear)
|
||||
noclear--;
|
||||
if (reset)
|
||||
elm_scroller_region_show(queue_list, x, y, w, h);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
Loading…
Reference in New Issue