macosx gui playlist: allow drag & drop to the media library
authorRafaël Carré <funman@videolan.org>
Wed, 27 Feb 2008 14:24:51 +0000 (14:24 +0000)
committerRafaël Carré <funman@videolan.org>
Wed, 27 Feb 2008 14:24:51 +0000 (14:24 +0000)
modules/gui/macosx/playlist.m

index e073f15..0250ea4 100644 (file)
         p_item = (playlist_item_t *)[item pointerValue];
     }
     if( p_item )
         p_item = (playlist_item_t *)[item pointerValue];
     }
     if( p_item )
-            i_return = p_item->i_children;
+        i_return = p_item->i_children;
     vlc_object_release( p_playlist );
 
     vlc_object_release( p_playlist );
 
-    if( i_return <= 0 )
-        i_return = 0;
-
-    return i_return;
+    return i_return > 0 ? i_return : 0;
 }
 
 /* return the child at index for the Obj-C pointer item */ /* DONE */
 }
 
 /* return the child at index for the Obj-C pointer item */ /* DONE */
         /* Refuse to move items that are not in the General Node
            (Service Discovery) */
         if( ![self isItem: [o_item pointerValue] inNode:
         /* Refuse to move items that are not in the General Node
            (Service Discovery) */
         if( ![self isItem: [o_item pointerValue] inNode:
-                        p_playlist->p_local_category checkItemExistence: NO])
+                        p_playlist->p_local_category checkItemExistence: NO] &&
+            ( var_CreateGetBool( p_playlist, "media-library" ) &&
+            ![self isItem: [o_item pointerValue] inNode:
+                        p_playlist->p_ml_category checkItemExistence: NO]) )
         {
             vlc_object_release(p_playlist);
             return NO;
         {
             vlc_object_release(p_playlist);
             return NO;
     /* We refuse to drop an item in anything else than a child of the General
        Node. We still accept items that would be root nodes of the outlineview
        however, to allow drop in an empty playlist. */
     /* We refuse to drop an item in anything else than a child of the General
        Node. We still accept items that would be root nodes of the outlineview
        however, to allow drop in an empty playlist. */
-    if( !([self isItem: [item pointerValue] inNode: p_playlist->p_local_category
-                                    checkItemExistence: NO] || item == nil) )
+    if( !( ([self isItem: [item pointerValue] inNode: p_playlist->p_local_category checkItemExistence: NO] || 
+        ( var_CreateGetBool( p_playlist, "media-library" ) && [self isItem: [item pointerValue] inNode: p_playlist->p_ml_category checkItemExistence: NO] ) ) || item == nil ) )
     {
         vlc_object_release( p_playlist );
         return NSDragOperationNone;
     {
         vlc_object_release( p_playlist );
         return NSDragOperationNone;