pp_sds = NULL;
i_update_counter = 0;
i_sort_mode = MODE_NONE;
- b_need_update = VLC_FALSE;
+ b_need_update = false;
i_items_to_append = 0;
- p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
+ p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return;
SetIcon( *p_intf->p_sys->p_icon );
/* Update the playlist */
p_current_treeroot = p_playlist->p_local_category;
- Rebuild( VLC_TRUE );
+ Rebuild( true );
}
Playlist::~Playlist()
if( !p_data ) return;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- ((PlaylistItem *)p_data)->i_id, VLC_TRUE );
+ ((PlaylistItem *)p_data)->i_id, true );
if( !p_item )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
wxU( " )" ) );
}
- if( !psz_artist || !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
+ if( !psz_artist || !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == true )
{
msg = wxString( wxU( psz_name ) ) + duration;
}
msg = wxString(wxU( psz_artist )) + wxT(" - ") +
wxString(wxU(psz_name)) + duration;
}
- if( psz_artist )
- free( psz_artist );
+ free( psz_artist );
free( psz_name );
treectrl->SetItemText( item , msg );
treectrl->SetItemImage( item, p_item->p_input->i_type );
node = FindItem( treectrl->GetRootItem(), p_add->i_node );
if( !node.IsOk() ) goto update;
- p_item = playlist_ItemGetById( p_playlist, p_add->i_item, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_add->i_item, true );
if( !p_item ) goto update;
if( (p_item->i_flags & PLAYLIST_DBL_FLAG ) ) goto update;
{
playlist_item_t *p_item;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, ((PlaylistItem *)treectrl->GetItemData( item ))->i_id, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, ((PlaylistItem *)treectrl->GetItemData( item ))->i_id, true );
if( p_item && p_item->i_children == -1 )
count++;
UnlockPlaylist( p_intf->p_sys, p_playlist );
}
/* Find a wxItem from a name (from current) */
-wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string, wxTreeItemId current, vlc_bool_t *pb_current_found )
+wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string, wxTreeItemId current, bool *pb_current_found )
{
wxTreeItemIdValue cookie;
wxTreeItemId search;
if( treectrl->GetItemText( item).Lower().Contains(
search_string.Lower() ) )
{
- if( !current.IsOk() || *pb_current_found == VLC_TRUE )
+ if( !current.IsOk() || *pb_current_found == true )
{
return item;
}
else if( current.IsOk() && item == current )
{
- *pb_current_found = VLC_TRUE;
+ *pb_current_found = true;
}
}
if( treectrl->ItemHasChildren( item ) )
/**********************************************************************
* Rebuild the playlist
**********************************************************************/
-void Playlist::Rebuild( vlc_bool_t b_root )
+void Playlist::Rebuild( bool b_root )
{
i_items_to_append = 0;
void Playlist::ShowPlaylist( bool show )
{
- if( show ) Rebuild( VLC_TRUE );
+ if( show ) Rebuild( true );
Show( show );
}
if( this->b_need_update )
{
- this->b_need_update = VLC_FALSE;
- Rebuild( VLC_TRUE );
+ this->b_need_update = false;
+ Rebuild( true );
}
/* Updating the playing status every 0.5s is enough */
p_wxitem = (PlaylistItem *)treectrl->GetItemData( item );
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, true );
if( !p_item )
{
void Playlist::DeleteItem( int item_id )
{
- playlist_DeleteFromInput( p_playlist, item_id, VLC_TRUE );
+ playlist_DeleteFromInput( p_playlist, item_id, true );
}
void Playlist::DeleteNode( playlist_item_t *p_item )
{
- playlist_NodeDelete( p_playlist, p_item, VLC_TRUE , VLC_FALSE );
+ playlist_NodeDelete( p_playlist, p_item, true , false );
}
void Playlist::OnMenuClose( wxCommandEvent& event )
case SortTitle_Event:
playlist_RecursiveNodeSort( p_playlist,
playlist_ItemGetById( p_playlist, p_wxitem->i_id,
- VLC_TRUE ),
+ true ),
SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
break;
case RSortTitle_Event:
playlist_RecursiveNodeSort( p_playlist,
playlist_ItemGetById( p_playlist, p_wxitem->i_id,
- VLC_TRUE ),
+ true ),
SORT_TITLE_NODES_FIRST, ORDER_REVERSE );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
- Rebuild( VLC_TRUE );
+ Rebuild( true );
}
/**********************************************************************
PlaylistItem *p_wxroot;
p_wxroot = (PlaylistItem *)treectrl->GetItemData( treectrl->GetRootItem() );
playlist_item_t *p_root = playlist_ItemGetById( p_playlist, p_wxroot->i_id,
- VLC_TRUE );
+ true );
assert( p_root );
char *psz_name = wxFromLocale( search_string );
playlist_LiveSearchUpdate( p_playlist, p_root, psz_name );
- Rebuild( VLC_TRUE );
+ Rebuild( true );
wxLocaleFree( psz_name );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
return;
}
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, true );
p_parent = p_item;
while( p_parent )
if( p_parent )
{
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_parent, p_item );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, p_parent, p_item );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
}
}
playlist_item_t *p_drageditem =
- playlist_ItemGetById(p_playlist, p_wxdrageditem->i_id, VLC_TRUE );
+ playlist_ItemGetById(p_playlist, p_wxdrageditem->i_id, true );
playlist_item_t *p_destitem =
- playlist_ItemGetById(p_playlist, p_wxdestitem->i_id, VLC_TRUE );
+ playlist_ItemGetById(p_playlist, p_wxdestitem->i_id, true );
if( !p_drageditem || !p_destitem )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
return;
}
playlist_item_t *p_destitem2 =
- playlist_ItemGetById( p_playlist, p_parent->i_id, VLC_TRUE );
+ playlist_ItemGetById( p_playlist, p_parent->i_id, true );
if( !p_destitem2 )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
UnlockPlaylist( p_intf->p_sys, p_playlist );
/* FIXME: having this Rebuild() is dirty */
- Rebuild( VLC_TRUE );
+ Rebuild( true );
}
#if wxUSE_DRAG_AND_DROP
{
PlaylistItem *p_plitem =
(PlaylistItem *)p->treectrl->GetItemData( item );
- p_dest = playlist_ItemGetById( p->p_playlist, p_plitem->i_id, VLC_TRUE );
+ p_dest = playlist_ItemGetById( p->p_playlist, p_plitem->i_id, true );
if( p_dest->i_children == -1 )
{
return FALSE;
}
playlist_item_t *p_node =
- playlist_ItemGetById( p->p_playlist, p_parent->i_id, VLC_TRUE );
+ playlist_ItemGetById( p->p_playlist, p_parent->i_id, true );
if( !p_node )
{
UnlockPlaylist( p->p_intf->p_sys, p->p_playlist );
char *psz_utf8 = wxDnDFromLocale( filenames[i] );
input_item_t *p_input = input_ItemNew( p->p_playlist,
psz_utf8, psz_utf8 );
- playlist_NodeAddInput( p->p_playlist, p_input,
- p_dest, PLAYLIST_PREPARSE, i_pos, VLC_FALSE );
+ int i_ret = ( playlist_BothAddInput( p->p_playlist, p_input, p_dest,
+ PLAYLIST_PREPARSE, i_pos, NULL, NULL, pl_Unlocked ) != VLC_SUCCESS );
+ vlc_gc_decref( p_input );
wxDnDLocaleFree( psz_utf8 );
+ if( i_ret != VLC_SUCCESS )
+ return FALSE;
}
/* FIXME: having this Rebuild() is dirty */
- p->Rebuild( VLC_TRUE );
+ p->Rebuild( true );
return TRUE;
}
char **ppsz_longnames;
char **ppsz_names = services_discovery_GetServicesNames( p_playlist,
&ppsz_longnames );
+ if( !ppsz_names )
+ return p_sd_menu;
+
char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
+ int i_number = 0;
+
for( ; *ppsz_name; ppsz_name++, ppsz_longname++ )
{
- p_sd_menu->AppendCheckItem( FirstSD_Event + i_number ,
+ p_sd_menu->AppendCheckItem( FirstSD_Event + i_number++ ,
wxU( *ppsz_longname ) );
if( playlist_IsServicesDiscoveryLoaded( p_playlist, *ppsz_name ) )
treectrl->SelectItem( i_wx_popup_item );
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, i_popup_item, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, i_popup_item, true );
if( !p_item )
{
{
playlist_item_t *p_popup_item, *p_popup_parent;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item, VLC_TRUE );
+ p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item, true );
p_popup_parent = p_popup_item;
while( p_popup_parent )
if( p_popup_parent )
{
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_popup_parent,
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, p_popup_parent,
p_popup_item );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
{
playlist_item_t *p_popup_item;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item, VLC_TRUE );
+ p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item, true );
if( p_popup_item != NULL )
{
p_wxitem = (PlaylistItem *)treectrl->GetItemData( i_wx_popup_item );
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, true );
if( p_item->i_children >= 0 )
{
playlist_RecursiveNodeSort( p_playlist, p_item,
LockPlaylist( p_intf->p_sys, p_playlist );
playlist_item_t *p_popup_item = playlist_ItemGetById( p_playlist,
i_popup_item,
- VLC_TRUE );
+ true );
if( p_popup_item )
{
iteminfo_dialog = new ItemInfoDialog( p_intf, p_popup_item, this );
p_wxitem = (PlaylistItem *)treectrl->GetItemData( i_wx_popup_item );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, true );
playlist_NodeCreate( p_playlist, psz_name, p_item, 0, NULL );
UnlockPlaylist( p_intf->p_sys, p_playlist );
- Rebuild( VLC_TRUE );
+ Rebuild( true );
wxLocaleFree( psz_name );
}
if( !p_current_treeroot || i_id != p_current_treeroot->i_id )
{
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id,
- VLC_TRUE );
+ true );
if( p_item ) p_current_treeroot = p_item;
- Rebuild( VLC_TRUE );
+ Rebuild( true );
}
}
vlc_value_t oval, vlc_value_t nval, void *param )
{
Playlist *p_playlist_dialog = (Playlist *)param;
- p_playlist_dialog->b_need_update = VLC_TRUE;
+ p_playlist_dialog->b_need_update = true;
return VLC_SUCCESS;
}
{
/* Too many items waiting to be added, it will be quicker to rebuild
* the whole playlist */
- p_playlist_dialog->b_need_update = VLC_TRUE;
+ p_playlist_dialog->b_need_update = true;
return VLC_SUCCESS;
}