]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/playlistinfo.m
lower case the module_* functions
[vlc] / modules / gui / macosx / playlistinfo.m
index edc4e5150a769cd2793f9957e01657af19635656..eac0d916445e561117e7c2e4bba846c829405eaa 100644 (file)
@@ -64,7 +64,8 @@ static VLCInfo *_o_sharedInstance = nil;
 
 - (void)awakeFromNib
 {
-    [o_info_window setExcludedFromWindowsMenu: TRUE];
+    [o_info_window setExcludedFromWindowsMenu: YES];
+    [o_info_window setFloatingPanel: NO];
 
     [o_info_window setTitle: _NS("Media Information")];
     [o_uri_lbl setStringValue: _NS("Location")];
@@ -114,7 +115,7 @@ static VLCInfo *_o_sharedInstance = nil;
     [o_info_window setInitialFirstResponder: o_uri_txt];
     [o_info_window setDelegate: self];
 
-    /* We may be awoken from nib way after initialiwation
+    /* We may be awoken from nib way after initialisation
      * Update ourselves */
     [self updatePanelWithItem:p_item];
 }
@@ -218,6 +219,7 @@ static VLCInfo *_o_sharedInstance = nil;
     if( _p_item != p_item )
     {
         if( p_item ) vlc_gc_decref( p_item );
+        [o_saveMetaData_btn setEnabled: NO];
         if( _p_item ) vlc_gc_incref( _p_item );
         p_item = _p_item;
     }
@@ -244,26 +246,31 @@ static VLCInfo *_o_sharedInstance = nil;
     }
     else
     {
-        /* fill uri info */
-        char * psz_url = input_item_GetURI( p_item );
-        [o_uri_txt setStringValue: [NSString stringWithUTF8String: psz_url ? psz_url : ""  ]];
-
         if( !input_item_IsPreparsed( p_item ) )
         {
-            playlist_t * p_playlist = pl_Yield( VLCIntf );
+            playlist_t * p_playlist = pl_Hold( VLCIntf );
             playlist_PreparseEnqueue( p_playlist, p_item );
             pl_Release( VLCIntf );
         }
 
+        /* fill uri info */
+        char * psz_url = input_item_GetURI( p_item );
+        [o_uri_txt setStringValue: [NSString stringWithUTF8String: psz_url ? psz_url : ""  ]];
         free( psz_url );
 
+        /* fill title info */
+        char * psz_title = input_item_GetTitle( p_item );
+        if( !psz_title )
+            psz_title = input_item_GetName( p_item );
+        [o_title_txt setStringValue: [NSString stringWithUTF8String: psz_title ? : ""  ]];
+        free( psz_title );
+
     #define SET( foo, bar ) \
         char *psz_##foo = input_item_Get##bar ( p_item ); \
         [self setMeta: psz_##foo forLabel: o_##foo##_txt]; \
         FREENULL( psz_##foo );
 
         /* fill the other fields */
-        SET( title, Title );
         SET( author, Artist );
         SET( collection, Album );
         SET( seqNum, TrackNum );
@@ -356,7 +363,7 @@ static VLCInfo *_o_sharedInstance = nil;
 
 - (IBAction)saveMetaData:(id)sender
 {
-    playlist_t * p_playlist = pl_Yield( VLCIntf );
+    playlist_t * p_playlist = pl_Hold( VLCIntf );
     vlc_value_t val;
 
     if( !p_item ) goto error;
@@ -398,9 +405,9 @@ static VLCInfo *_o_sharedInstance = nil;
     PL_LOCK;
     p_playlist->p_private = &p_export;
 
-    module_t *p_mod = module_Need( p_playlist, "meta writer", NULL, 0 );
+    module_t *p_mod = module_need( p_playlist, "meta writer", NULL, 0 );
     if( p_mod )
-        module_Unneed( p_playlist, p_mod );
+        module_unneed( p_playlist, p_mod );
     PL_UNLOCK;
 
     val.b_bool = true;
@@ -414,13 +421,13 @@ static VLCInfo *_o_sharedInstance = nil;
 error:
     pl_Release( VLCIntf );
     NSRunAlertPanel(_NS("Error while saving meta"),
-        _NS("Impossible to save the meta data."),
+        _NS("VLC was unable to save the meta data."),
         _NS("OK"), nil, nil);
 }
 
 - (input_item_t *)item
 {
-    vlc_gc_incref( p_item );
+    if( p_item ) vlc_gc_incref( p_item );
     return p_item;
 }