]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/vars/playtree.cpp
Use pl_Locked and pl_Unlocked
[vlc] / modules / gui / skins2 / vars / playtree.cpp
index 07fe03aeb397bf76b01f8ad63a39e6a8086a6f48..0033e1ce8ef9dadd6b5d6f0edd9cf2be15ad359d 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 
 #include "playtree.hpp"
+#include <vlc_playlist.h>
 #include "../utils/ustring.hpp"
 
-#include "charset.h"
+#include "vlc_charset.h"
 
 
 Playtree::Playtree( intf_thread_t *pIntf ): VarTree( pIntf )
@@ -37,30 +42,17 @@ Playtree::Playtree( intf_thread_t *pIntf ): VarTree( pIntf )
 
     i_items_to_append = 0;
 
-    // Try to guess the current charset
-    char *pCharset;
-    vlc_current_charset( &pCharset );
-    iconvHandle = vlc_iconv_open( "UTF-8", pCharset );
-    msg_Dbg( pIntf, "using character encoding: %s", pCharset );
-    free( pCharset );
-
-    if( iconvHandle == (vlc_iconv_t) - 1 )
-    {
-        msg_Warn( pIntf, "unable to do requested conversion" );
-    }
-
     buildTree();
 }
 
 Playtree::~Playtree()
 {
-    if( iconvHandle != (vlc_iconv_t) - 1 ) vlc_iconv_close( iconvHandle );
 }
 
 void Playtree::delSelected()
 {
     Iterator it = begin();
-    vlc_mutex_lock( &getIntf()->p_sys->p_playlist->object_lock );
+    vlc_object_lock( getIntf()->p_sys->p_playlist );
     for( it = begin(); it != end(); it = getNextVisibleItem( it ) )
     {
         if( (*it).m_selected && !(*it).isReadonly() )
@@ -81,8 +73,8 @@ void Playtree::delSelected()
             playlist_item_t *p_item = (playlist_item_t *)(it->m_pData);
             if( p_item->i_children == -1 )
             {
-                playlist_DeleteFromItemId( getIntf()->p_sys->p_playlist,
-                                           p_item->i_id );
+                playlist_DeleteFromInput( getIntf()->p_sys->p_playlist,
+                                          p_item->p_input->i_id, pl_Locked );
                 it2 = getNextVisibleItem( it ) ;
                 it->parent()->removeChild( it );
                 it = it2;
@@ -90,7 +82,7 @@ void Playtree::delSelected()
             else
             {
                 playlist_NodeDelete( getIntf()->p_sys->p_playlist, p_item,
-                                     VLC_TRUE, VLC_FALSE );
+                                     true, false );
                 it2 = getNextSibling( it );
                 it->parent()->removeChild( it );
                 it = it2;
@@ -101,12 +93,12 @@ void Playtree::delSelected()
             it = getNextVisibleItem( it );
         }
     }
-    vlc_mutex_unlock( &getIntf()->p_sys->p_playlist->object_lock );
+    vlc_object_unlock( getIntf()->p_sys->p_playlist );
 }
 
 void Playtree::action( VarTree *pItem )
 {
-    vlc_mutex_lock( &m_pPlaylist->object_lock );
+    vlc_object_lock( m_pPlaylist );
     VarTree::Iterator it;
 
     playlist_item_t *p_item = (playlist_item_t *)pItem->m_pData;
@@ -120,9 +112,9 @@ void Playtree::action( VarTree *pItem )
 
     if( p_parent )
     {
-        playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, p_parent, p_item );
+        playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, pl_Locked, p_parent, p_item );
     }
-    vlc_mutex_unlock( &m_pPlaylist->object_lock );
+    vlc_object_unlock( m_pPlaylist );
 }
 
 void Playtree::onChange()
@@ -183,7 +175,7 @@ void Playtree::onAppend( playlist_add_t *p_add )
         if( item == end() )
         {
             playlist_item_t *p_item = playlist_ItemGetById(
-                                        m_pPlaylist, p_add->i_item );
+                                        m_pPlaylist, p_add->i_item, pl_Unlocked );
             if( !p_item ) return;
             UString *pName = new UString( getIntf(),
                                           p_item->p_input->psz_name );
@@ -221,7 +213,7 @@ void Playtree::buildNode( playlist_item_t *pNode, VarTree &rTree )
 void Playtree::buildTree()
 {
     clear();
-    vlc_mutex_lock( &m_pPlaylist->object_lock );
+    vlc_object_lock( m_pPlaylist );
 
     i_items_to_append = 0;
 
@@ -236,7 +228,7 @@ void Playtree::buildTree()
 
     buildNode( m_pPlaylist->p_root_category, *this );
 
-    vlc_mutex_unlock( &m_pPlaylist->object_lock );
+    vlc_object_unlock( m_pPlaylist );
 //  What is it ?
 //    checkParents( NULL );
 }