]> git.sesse.net Git - vlc/commitdiff
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 e74c12df272538fb9de77bb33f9ca94d3b2686ae..b565bffa8727e962c2b0c0d0960e25f24ea2d1e5 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 35fbcb9d568751e19188b1b5431063c28a33bc6d..7023ef8bc572de5cd3dccb4c0988409154e9ac66 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 d4aca6a307c60d6def0e5933c938ad3608e747ed..62468b25fb91ea2f740dd22e59bc2620ffc82983 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 bcfaa7824a56f5b875018eb9704e538941a5f06f..08a19563245e43e108ddba5658830af1d59a3936 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 );
 }