Implement playtree.sort() (basic implementation)
authorClément Stenac <zorglub@videolan.org>
Sun, 4 Dec 2005 21:14:12 +0000 (21:14 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 4 Dec 2005 21:14:12 +0000 (21:14 +0000)
Fix a bug in delete

modules/gui/skins2/commands/cmd_playtree.cpp
modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/vars/playtree.cpp

index e74c12d..b565bff 100644 (file)
@@ -32,5 +32,14 @@ void CmdPlaytreeDel::execute()
 
 void CmdPlaytreeSort::execute()
 {
-    // TODO
+    // TODO: Choose sort method
+    playlist_t *p_playlist = getIntf()->p_sys->p_playlist;
+    vlc_mutex_lock( &p_playlist->object_lock );
+    playlist_view_t* p_view = playlist_ViewFind( p_playlist, p_playlist->status.i_view );
+    playlist_RecursiveNodeSort( p_playlist, p_view->p_root , SORT_TITLE, ORDER_NORMAL );
+    vlc_mutex_unlock( &p_playlist->object_lock );
+
+    // Ask for rebuild
+    Playtree &rVar = VlcProc::instance( getIntf() )->getPlaytreeVar();
+    rVar.onChange();
 }
index 35fbcb9..7023ef8 100644 (file)
@@ -140,6 +140,7 @@ void CtrlTree::onUpdate( Subject<VarTree, tree_update*> &rTree,
     }
     else if ( arg->i_type == 1 ) // Global change or deletion
     {
+        m_firstPos = m_rTree.begin();
         makeImage();
     }
     else if ( arg->i_type == 2 ) // Item-append
index d4aca6a..62468b2 100644 (file)
@@ -245,8 +245,7 @@ static void Run( intf_thread_t *p_intf )
                                            FIND_ANYWHERE );
         if( p_playlist )
         {
-            p_playlist->status.i_view = -1;
-            playlist_Control( p_playlist, PLAYLIST_AUTOPLAY );
+            playlist_LockControl( p_playlist, PLAYLIST_AUTOPLAY );
             vlc_object_release( p_playlist );
         }
     }
index bcfaa78..08a1956 100644 (file)
@@ -200,6 +200,7 @@ void Playtree::buildTree()
     buildNode( p_view->p_root, *this );
 
     vlc_mutex_unlock( &m_pPlaylist->object_lock );
-    checkParents( NULL );
+//  What is it ?
+//    checkParents( NULL );
 }