]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/playlist.m
macosx: Fix a typo. (Fix sd listing at startup).
[vlc] / modules / gui / macosx / playlist.m
index 762e8d929cd063b5e17eff827697abdfc3e396f9..7ffa25e9bd846b8aaa24632dbfeecbc83e02a953 100644 (file)
@@ -92,7 +92,6 @@
 
 @end
 
-
 /*****************************************************************************
  * VLCPlaylistCommon implementation
  *
     int i_return = 0;
     playlist_item_t *p_item = NULL;
     playlist_t * p_playlist = pl_Yield( VLCIntf );
-    if( outlineView != o_outline_view )
-    {
-        vlc_object_release( p_playlist );
-        return 0;
-    }
+    assert( outlineView == o_outline_view );
 
-    if( item == nil )
-    {
-        /* root object */
+    if( !item )
         p_item = p_playlist->p_root_category;
-    }
     else
-    {
         p_item = (playlist_item_t *)[item pointerValue];
-    }
+
     if( p_item )
         i_return = p_item->i_children;
-    vlc_object_release( p_playlist );
+
+    pl_Release( VLCIntf );
 
     return i_return > 0 ? i_return : 0;
 }
         else
         {
             char *psz_name = input_item_GetName( p_item->p_input );
-            if( psz_name != NULL )
+            if( !EMPTY_STR( psz_name ) )
             {
                 o_value = [NSString stringWithUTF8String: psz_name];
             }
         @"VLCPlaylistItemPboardType", nil]];
     [o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
 
-    /* This uses private Apple API which works fine until 10.4.
+    /* This uses private Apple API which works fine until 10.5.
      * We need to keep checking in the future!
      * These methods are being added artificially to NSOutlineView's interface above */
     o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
     for( i = 0; ppsz_services[i]; i++ )
     {
         bool  b_enabled;
-        char        *objectname;
         NSMenuItem  *o_lmi;
 
         char * name = ppsz_name[i] ? ppsz_name[i] : ppsz_services[i];
         /* Check whether to enable these menuitems */
-        b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, objectname );
+        b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, ppsz_services[i] );
 
         /* Create the menu entries used in the playlist menu */
         o_lmi = [[o_mi_services submenu] addItemWithTitle:
 
 - (void)playlistUpdated
 {
-    unsigned int i;
-
     /* Clear indications of any existing column sorting */
-    for( i = 0 ; i < [[o_outline_view tableColumns] count] ; i++ )
+    for( unsigned int i = 0 ; i < [[o_outline_view tableColumns] count] ; i++ )
     {
         [o_outline_view setIndicatorImage:nil inTableColumn:
                             [[o_outline_view tableColumns] objectAtIndex:i]];
 - (void)playModeUpdated
 {
     playlist_t *p_playlist = pl_Yield( VLCIntf );
-    vlc_value_t val, val2;
 
-    var_Get( p_playlist, "loop", &val2 );
-    var_Get( p_playlist, "repeat", &val );
-    if( val.b_bool == true )
-    {
+    bool loop = var_GetBool( p_playlist, "loop" );
+    bool repeat = var_GetBool( p_playlist, "repeat" );
+    if( repeat )
         [[[VLCMain sharedInstance] getControls] repeatOne];
-   }
-    else if( val2.b_bool == true )
-    {
+    else if( loop )
         [[[VLCMain sharedInstance] getControls] repeatAll];
-    }
     else
-    {
         [[[VLCMain sharedInstance] getControls] repeatOff];
-    }
 
     [[[VLCMain sharedInstance] getControls] shuffle];
 
         }
         else if( b_selected_item_met == YES &&
                     ( [o_current_name rangeOfString:[o_search_field
-                        stringValue] options:NSCaseInsensitiveSearch ].length ||
+                        stringValue] options:NSCaseInsensitiveSearch].length ||
                       [o_current_author rangeOfString:[o_search_field
-                        stringValue] options:NSCaseInsensitiveSearch ].length ) )
+                        stringValue] options:NSCaseInsensitiveSearch].length ) )
         {
             vlc_object_release( p_playlist );
             /*Adds the parent items in the result array as well, so that we can
         i_type = ORDER_NORMAL;
     }
 
-    vlc_mutex_lock( &p_playlist->object_lock );
+    vlc_object_lock( p_playlist );
     playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
-    vlc_mutex_unlock( &p_playlist->object_lock );
+    vlc_object_unlock( p_playlist );
 
     vlc_object_release( p_playlist );
     [self playlistUpdated];