Commit 24c07775 authored by Benjamin Pracht's avatar Benjamin Pracht

* vlc_symbols.h, vlc_playlist.h, view.c : add a function to remove a parent...

* vlc_symbols.h, vlc_playlist.h, view.c : add a function to remove a parent from the parent list of an item (if anybody wants to make that another way...)
* playlist.m: implements full drag and drop of playlist items. Drop of multiple items and of items and nodes at the same time should be supported. You cannot mode service discovery items. This is a choice and can be changed if wanted.
* Hopes that compiles on current trunk (cannot check since latest comits on net functions broke the built of a half the modules and core of the OSX port...)

parent 60b3038b
......@@ -298,6 +298,7 @@ VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *,int,char *, p
VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,int,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,int,playlist_item_t*,playlist_item_t *, int) );
VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeRemoveParent, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
......
......@@ -376,6 +376,7 @@ struct module_symbols_t
void (*net_ListenClose_inner) (int *fd);
void (*DigestMD5_inner) (struct md5_s *, uint32_t *);
int (*__net_CheckIP_inner) (vlc_object_t *p_this, char *psz_ip, char **ppsz_hosts, int i_hosts);
int (*playlist_NodeRemoveParent_inner) (playlist_t *,playlist_item_t*,playlist_item_t *);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -737,6 +738,7 @@ struct module_symbols_t
# define net_ListenClose (p_symbols)->net_ListenClose_inner
# define DigestMD5 (p_symbols)->DigestMD5_inner
# define __net_CheckIP (p_symbols)->__net_CheckIP_inner
# define playlist_NodeRemoveParent (p_symbols)->playlist_NodeRemoveParent_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1101,6 +1103,7 @@ struct module_symbols_t
((p_symbols)->net_ListenClose_inner) = net_ListenClose; \
((p_symbols)->DigestMD5_inner) = DigestMD5; \
((p_symbols)->__net_CheckIP_inner) = __net_CheckIP; \
((p_symbols)->playlist_NodeRemoveParent_inner) = playlist_NodeRemoveParent; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
# endif /* __PLUGIN__ */
......
This diff is collapsed.
......@@ -496,14 +496,14 @@ int playlist_NodeInsert( playlist_t *p_playlist,
}
/**
* Deletes an item from the children of a node
* Deletes a parent from the parent list of a node
*
* \param p_playlist the playlist
* \param p_item the item to remove
* \param p_parent the parent node
* \return VLC_SUCCESS or an error
*/
int playlist_NodeRemoveItem( playlist_t *p_playlist,
int playlist_NodeRemoveParent( playlist_t *p_playlist,
playlist_item_t *p_item,
playlist_item_t *p_parent )
{
......@@ -513,6 +513,34 @@ int playlist_NodeRemoveItem( playlist_t *p_playlist,
msg_Err( p_playlist, "invalid node" );
}
for( i = 0; i < p_item->i_parents; i++ )
{
if( p_item->pp_parents[i]->p_parent == p_parent )
{
if( p_item->pp_parents[i] )
{
free( p_item->pp_parents[i] );
}
REMOVE_ELEM( p_item->pp_parents, p_item->i_parents, i );
}
}
p_item->i_serial++;
return VLC_SUCCESS;
}
/**
* Deletes an item from the children of a node
*
* \param p_playlist the playlist
* \param p_item the item to remove
* \param p_parent the parent node
* \return VLC_SUCCESS or an error
*/
int playlist_NodeRemoveItem( playlist_t *p_playlist,
playlist_item_t *p_item,
playlist_item_t *p_parent )
{
int i;
for( i= 0; i< p_parent->i_children ; i++ )
{
if( p_parent->pp_children[i] == p_item )
......
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