Commit a2d9bd0a authored by Jakob Leben's avatar Jakob Leben Committed by Rémi Denis-Courmont

playlist: do not move both tree and non-tree items + restrict move action

Items are stored twice, once in a tree structure and once in a one-level list.
This patch removes attempt of the playlist_TreeMove() function to move both tree and
one-level instances of an item.

Firstly the reason is that function was not effective in this attempt.
And secondly, the attempt itself doesn't make sense in some cases: you can always
map moves within the tree to moves within one-level, but you can't always do it
the other way around, it is in most cases ambiguous.

Moreover, this patch restricts moves in the tree to within the present parent of the
item being moved. Again, in most cases, moving an item out of its parent or into another
parent is meaningless.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 953d13ba
...@@ -718,46 +718,7 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item, ...@@ -718,46 +718,7 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
int i_ret; int i_ret;
PL_ASSERT_LOCKED; PL_ASSERT_LOCKED;
/* Drop on a top level node. Move in the two trees */ if( p_node != p_item->p_parent ) return VLC_SUCCESS;
if( p_node->p_parent == p_playlist->p_root_category ||
p_node->p_parent == p_playlist->p_root_onelevel )
{
/* Fixme: avoid useless lookups but we need some clean helpers */
{
/* Fixme: if we try to move a node on a top-level node, it will
* fail because the node doesn't exist in onelevel and we will
* do some shit in onelevel. We should recursively move all items
* within the node */
playlist_item_t *p_node_onelevel;
playlist_item_t *p_item_onelevel;
p_node_onelevel = playlist_ItemFindFromInputAndRoot( p_playlist,
p_node->p_input,
p_playlist->p_root_onelevel,
false );
p_item_onelevel = playlist_ItemFindFromInputAndRoot( p_playlist,
p_item->p_input,
p_playlist->p_root_onelevel,
false );
if( p_node_onelevel && p_item_onelevel )
TreeMove( p_playlist, p_item_onelevel, p_node_onelevel, i_newpos );
}
{
playlist_item_t *p_node_category;
playlist_item_t *p_item_category;
p_node_category = playlist_ItemFindFromInputAndRoot( p_playlist,
p_node->p_input,
p_playlist->p_root_category,
false );
p_item_category = playlist_ItemFindFromInputAndRoot( p_playlist,
p_item->p_input,
p_playlist->p_root_category,
false );
if( p_node_category && p_item_category )
TreeMove( p_playlist, p_item_category, p_node_category, 0 );
}
i_ret = VLC_SUCCESS;
}
else
i_ret = TreeMove( p_playlist, p_item, p_node, i_newpos ); i_ret = TreeMove( p_playlist, p_item, p_node, i_newpos );
pl_priv(p_playlist)->b_reset_currently_playing = true; pl_priv(p_playlist)->b_reset_currently_playing = true;
vlc_cond_signal( &pl_priv(p_playlist)->signal ); vlc_cond_signal( &pl_priv(p_playlist)->signal );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment