+/**********************************************************************
+ * Update one playlist item
+ **********************************************************************/
+void Playlist::UpdateItem( int i )
+{
+ if( i < 0 ) return; /* Sanity check */
+
+ playlist_t *p_playlist =
+ (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+
+ if( p_playlist == NULL )
+ {
+ return;
+ }
+
+ playlist_item_t *p_item = playlist_ItemGetByPos( p_playlist, i );
+
+ if( !p_item )
+ {
+ vlc_object_release(p_playlist);
+ return;
+ }
+
+ listview->SetItem( i, 0, wxL2U(p_item->input.psz_name) );
+ listview->SetItem( i, 1, wxU( playlist_ItemGetInfo( p_item,
+ _("General") , _("Author") ) ) );
+ char *psz_group = playlist_FindGroup(p_playlist,
+ p_item->i_group);
+ listview->SetItem( i, 3,
+ wxL2U( psz_group ? psz_group : _("Normal") ) );
+
+ if( p_item->b_enabled == VLC_FALSE )
+ {
+ wxListItem listitem;
+ listitem.m_itemId = i;
+ listitem.SetTextColour( *wxLIGHT_GREY);
+ listview->SetItem(listitem);
+ }
+
+ char psz_duration[MSTRTIME_MAX_SIZE];
+ mtime_t dur = p_item->input.i_duration;
+ if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 );
+ else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") );
+ listview->SetItem( i, 2, wxU(psz_duration) );
+
+ /* Change the colour for the currenty played stream */
+ wxListItem listitem;
+ listitem.m_itemId = i;
+ if( i == p_playlist->i_index )
+ {
+ listitem.SetTextColour( *wxRED );
+ }
+ else
+ {
+ listitem.SetTextColour( *wxBLACK );
+ }
+ listview->SetItem( listitem );
+
+ vlc_object_release(p_playlist);
+}
+