]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/playlist.m
macosx: Replace "Get Stream Information" by "Fetch Meta Data".
[vlc] / modules / gui / macosx / playlist.m
index 90d75e1220fce50f191d2c0849f3c99869c516bf..4e13ad6e763c95c48d71d5c648ed9874178fb5a9 100644 (file)
     [o_outline_view setTarget: self];
     [o_outline_view setDelegate: self];
     [o_outline_view setDataSource: self];
+    [o_outline_view setAllowsEmptySelection: NO];
 
     vlc_object_release( p_playlist );
     [self initStrings];
     [o_mi_delete setTitle: _NS("Delete")];
     [o_mi_recursive_expand setTitle: _NS("Expand Node")];
     [o_mi_selectall setTitle: _NS("Select All")];
-    [o_mi_info setTitle: _NS("Information")];
-    [o_mi_preparse setTitle: _NS("Get Stream Information")];
+    [o_mi_info setTitle: _NS("Information...")];
+    [o_mi_preparse setTitle: _NS("Fetch Meta Data")];
     [o_mi_sort_name setTitle: _NS("Sort Node by Name")];
     [o_mi_sort_author setTitle: _NS("Sort Node by Author")];
     [o_mi_services setTitle: _NS("Services discovery")];
     vlc_object_release( p_playlist );
 }
 
+- (void)outlineViewSelectionDidChange:(NSNotification *)notification
+{
+    // FIXME: unsafe
+    playlist_item_t * p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
+
+    if( p_item )
+    {
+        /* update our info-panel to reflect the new item */
+        [[[VLCMain sharedInstance] getInfo] updatePanelWithItem:p_item->p_input];
+    }
+}
+
+- (BOOL)isSelectionEmpty
+{
+    return [o_outline_view selectedRow] == -1;
+}
+
 - (void)updateRowSelection
 {
     int i_row;
     unsigned int j;
 
+    // FIXME: unsafe
     playlist_t *p_playlist = pl_Yield( VLCIntf );
     playlist_item_t *p_item, *p_temp_item;
     NSMutableArray *o_array = [NSMutableArray array];
 
     }
 
+    /* update our info-panel to reflect the new item */
+    [[[VLCMain sharedInstance] getInfo] updatePanelWithItem:p_item->p_input];
+
     vlc_object_release( p_playlist );
 
-    /* update our info-panel to reflect the new item */
-    [[[VLCMain sharedInstance] getInfo] updatePanel];
 }
 
 /* Check if p_item is a child of p_node recursively. We need to check the item
                 p_item = NULL;
             }
         }
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, p_node, p_item );
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, false, p_node, p_item );
     }
     vlc_object_release( p_playlist );
 }
     int i_item;
     playlist_t * p_playlist = pl_Yield( VLCIntf );
 
+    PL_LOCK;
     for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
     {
         input_item_t *p_input;
 
         /* Add the item */
         /* FIXME: playlist_AddInput() can fail */
+        
         playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
              i_position == -1 ? PLAYLIST_END : i_position + i_item, true,
-         false );
+         true );
 
         if( i_item == 0 && !b_enqueue )
         {
             p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
             playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL, p_item );
         }
-        else
-        {
-            playlist_item_t *p_item;
-            p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
-            playlist_Control( p_playlist, PLAYLIST_SKIP, true, p_item );
-        }
         vlc_gc_decref( p_input );
     }
+    PL_UNLOCK;
+
     [self playlistUpdated];
     vlc_object_release( p_playlist );
 }
             p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
             playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL, p_item );
         }
-        else
-        {
-            playlist_item_t *p_item;
-            p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
-            playlist_Control( p_playlist, PLAYLIST_SKIP, true, p_item );
-        }
         vlc_gc_decref( p_input );
     }
     [self playlistUpdated];
 
     pt = [o_outline_view convertPoint: [o_event locationInWindow]
                                                  fromView: nil];
-    b_item_sel = ( [o_outline_view rowAtPoint: pt] != -1 &&
-                   [o_outline_view selectedRow] != -1 );
+    NSInteger row = [o_outline_view rowAtPoint:pt];
+    if( row != -1 )
+        [o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
+
+    b_item_sel = ( row != -1 && [o_outline_view selectedRow] != -1 );
     b_rows = [o_outline_view numberOfRows] != 0;
 
     [o_mi_play setEnabled: b_item_sel];