]> git.sesse.net Git - vlc/commitdiff
macosx: improve playItem, make sure that the complete pl is queued
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Fri, 2 Jan 2015 13:30:38 +0000 (14:30 +0100)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Fri, 2 Jan 2015 18:36:36 +0000 (19:36 +0100)
Simplifies the playItem action. For the playlist call, the current
root is taken instead of the parent node. This ensures that
playback does not stop on folder/node boundaries.

modules/gui/macosx/playlist.m

index cdb34e880eb6ad565cece8ace5dd14ebcaee77de..66d72a133efd0ff1d1bdbea772bf07c9f030f03f 100644 (file)
 /* When called retrieves the selected outlineview row and plays that node or item */
 - (IBAction)playItem:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Get(p_intf);
-
-    playlist_item_t *p_item;
-    playlist_item_t *p_node = NULL;
+    playlist_t *p_playlist = pl_Get(VLCIntf);
 
     // ignore clicks on column header when handling double action
-    if (sender != nil && [o_outline_view clickedRow] == -1 && sender != o_mi_play)
+    if (sender == o_outline_view && [o_outline_view clickedRow] == -1)
         return;
 
-    PL_LOCK;
     PLItem *o_item = [o_outline_view itemAtRow:[o_outline_view selectedRow]];
-    p_item = playlist_ItemGetById(p_playlist, [o_item plItemId]);
+    if (!o_item)
+        return;
 
-    if (p_item) {
-        if (p_item->i_children == -1) {
-            p_node = p_item->p_parent;
-        } else {
-            p_node = p_item;
-            if (p_node->i_children > 0 && p_node->pp_children[0]->i_children == -1)
-                p_item = p_node->pp_children[0];
-            else
-                p_item = NULL;
-        }
+    PL_LOCK;
+    playlist_item_t *p_item = playlist_ItemGetById(p_playlist, [o_item plItemId]);
+    playlist_item_t *p_node = playlist_ItemGetById(p_playlist, [[[self model] rootItem] plItemId]);
 
+    if (p_item && p_node) {
         playlist_Control(p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_node, p_item);
     }
     PL_UNLOCK;