]> git.sesse.net Git - vlc/blobdiff - modules/misc/notify/growl.m
Add --data-path option. Access the src share directory now works from build tree.
[vlc] / modules / misc / notify / growl.m
index b99904d3461677675a18b38b07df9d571aa06a60..575739f24881571e7148919a9af525f523c64d6b 100644 (file)
@@ -58,6 +58,7 @@
 #include <vlc_playlist.h>
 #include <vlc_meta.h>
 #include <vlc_interface.h>
+#include <vlc_url.h>
 
 
 /*****************************************************************************
@@ -114,9 +115,10 @@ static int Open( vlc_object_t *p_this )
     p_sys->app_name = CFSTR( "VLC media player" );
     p_sys->notification_type = CFSTR( "New input playing" );
 
-    const char *data_path = config_GetDataDir ();
+    char *data_path = config_GetDataDir ( p_this );
     char buf[strlen (data_path) + sizeof ("/vlc48x48.png")];
     snprintf (buf, sizeof (buf), "%s/vlc48x48.png", data_path);
+    free( data_path );
     p_sys->default_icon = (CFDataRef) readFile( buf );
 
     playlist_t *p_playlist = pl_Hold( p_intf );
@@ -159,13 +161,9 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     char *psz_artist        = NULL;
     char *psz_album         = NULL;
     input_thread_t *p_input;
-    playlist_t *p_playlist = pl_Hold( p_this );
-
-    p_input = playlist_CurrentInput( p_playlist );
-    pl_Release( p_this );
+    p_input = playlist_CurrentInput( (playlist_t*)p_this );
 
     if( !p_input ) return VLC_SUCCESS;
-    vlc_object_hold( p_input );
 
     char *psz_name = input_item_GetName( input_GetItem( p_input ) );
     if( p_input->b_dead || !psz_name )
@@ -214,7 +212,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     char *psz_arturl = input_item_GetArtURL( p_item );
     CFDataRef art = NULL;
     if( psz_arturl && !strncmp( psz_arturl, "file://", 7 ) &&
-                    strlen( psz_arturl ) > 7 )
+                    decode_URI( psz_arturl + 7 ) )
         art = (CFDataRef) readFile( psz_arturl + 7 );
 
     free( psz_title );
@@ -225,6 +223,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     NotifyToGrowl( p_intf, psz_tmp, art );
 
     if( art ) CFRelease( art );
+    free( psz_tmp );
 
     vlc_object_release( p_input );
     return VLC_SUCCESS;