]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/playlist.m
macosx: Use input_ItemHasErrorWhenReading to display a small icon if there was an...
[vlc] / modules / gui / macosx / playlist.m
index a01e714b37751cdc6718e83385329977192f0ae3..f9e6e8efd6a3c8b7b65c5e695148eba63f3b3fa8 100644 (file)
  
     attempted_reload = NO;
 
-    if( [[o_tc identifier] isEqualToString:@"1"] )
+    if( [[o_tc identifier] isEqualToString:@"name"] )
     {
         /* sanity check to prevent the NSString class from crashing */
         char *psz_title =  input_item_GetTitle( p_item->p_input );
         else
         {
             char *psz_name = input_item_GetName( p_item->p_input );
-            if( !EMPTY_STR( psz_name ) )
-            {
+            if( psz_name )
                 o_value = [NSString stringWithUTF8String: psz_name];
-            }
             free( psz_name );
         }
         free( psz_title );
     }
-    else
+    else if( [[o_tc identifier] isEqualToString:@"artist"] )
     {
         char *psz_artist = input_item_GetArtist( p_item->p_input );
-        if( [[o_tc identifier] isEqualToString:@"2"] && !EMPTY_STR( psz_artist ) )
-        {
+        if( psz_artist )
             o_value = [NSString stringWithUTF8String: psz_artist];
+        free( psz_artist );
+    }
+    else if( [[o_tc identifier] isEqualToString:@"duration"] )
+    {
+        char psz_duration[MSTRTIME_MAX_SIZE];
+        mtime_t dur = input_item_GetDuration( p_item->p_input );
+        if( dur != -1 )
+        {
+            secstotimestr( psz_duration, dur/1000000 );
+            o_value = [NSString stringWithUTF8String: psz_duration];
         }
-        else if( [[o_tc identifier] isEqualToString:@"3"] )
+        else
+            o_value = @"--:--";
+    }
+    else if( [[o_tc identifier] isEqualToString:@"status"] )
+    {
+        if( input_ItemHasErrorWhenReading( p_item->p_input ) )
         {
-            char psz_duration[MSTRTIME_MAX_SIZE];
-            mtime_t dur = input_item_GetDuration( p_item->p_input );
-            if( dur != -1 )
-            {
-                secstotimestr( psz_duration, dur/1000000 );
-                o_value = [NSString stringWithUTF8String: psz_duration];
-            }
-            else
-            {
-                o_value = @"--:--";
-            }
+            o_value = [NSImage imageWithWarningIcon];
         }
-        free( psz_artist );
     }
     return o_value;
 }
     return self;
 }
 
+- (void)dealloc
+{
+    [o_nodes_array release];
+    [o_items_array release];
+    [super dealloc];
+}
+
 - (void)awakeFromNib
 {
     playlist_t * p_playlist = pl_Yield( VLCIntf );