[vlc-commits] Growl: remove trailing spaces
Jean-Baptiste Kempf
git at videolan.org
Wed Apr 18 11:11:48 CEST 2012
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Apr 17 15:01:53 2012 +0200| [a25584c02064b08eb8286f76ccd47bf8201ab82e] | committer: Jean-Baptiste Kempf
Growl: remove trailing spaces
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a25584c02064b08eb8286f76ccd47bf8201ab82e
---
modules/notify/growl.m | 82 ++++++++++++++++++++++++------------------------
1 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/modules/notify/growl.m b/modules/notify/growl.m
index 8ce8835..7e95f84 100644
--- a/modules/notify/growl.m
+++ b/modules/notify/growl.m
@@ -2,7 +2,7 @@
* growl.m : growl notification plugin
*****************************************************************************
* VLC specific code:
- *
+ *
* Copyright © 2008,2011 the VideoLAN team
* $Id$
*
@@ -109,25 +109,25 @@ static int Open( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t *)p_this;
playlist_t *p_playlist;
intf_sys_t *p_sys;
-
+
p_sys = p_intf->p_sys = calloc( 1, sizeof(intf_sys_t) );
if( !p_sys )
return VLC_ENOMEM;
-
+
p_sys->app_name = CFSTR( "VLC media player" );
p_sys->notification_type = CFSTR( "New input playing" );
-
+
char *data_path = config_GetDataDir ();
char buf[strlen (data_path) + sizeof ("/vlc512x512.png")];
snprintf (buf, sizeof (buf), "%s/vlc512x512.png", data_path);
msg_Dbg( p_this, "looking for icon at %s", buf );
free( data_path );
p_sys->default_icon = (CFDataRef) readFile( buf );
-
+
p_playlist = pl_Get( p_intf );
var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-
+
RegisterToGrowl( p_this );
return VLC_SUCCESS;
}
@@ -140,10 +140,10 @@ static void Close( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t *)p_this;
playlist_t *p_playlist = pl_Get( p_this );
intf_sys_t *p_sys = p_intf->p_sys;
-
+
var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
-
+
CFRelease( p_sys->default_icon );
CFRelease( p_sys->app_name );
CFRelease( p_sys->notification_type );
@@ -157,16 +157,16 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
VLC_UNUSED(oldval);
-
+
intf_thread_t *p_intf = (intf_thread_t *)param;
char *psz_tmp = NULL;
char *psz_title = NULL;
char *psz_artist = NULL;
char *psz_album = NULL;
input_item_t *p_item = newval.p_address;
-
+
bool b_is_item_current = !strcmp( "item-current", psz_var );
-
+
/* Don't update each time an item has been preparsed */
if( b_is_item_current )
{ /* stores the current input item id */
@@ -188,22 +188,22 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
* We'll limit the number of changes to 1 per input. */
if( p_intf->p_sys->i_item_changes > 0 )
return VLC_SUCCESS;
-
+
p_intf->p_sys->i_item_changes++;
}
-
-
+
+
input_thread_t *p_input = playlist_CurrentInput( (playlist_t*)p_this );
-
+
if( !p_input ) return VLC_SUCCESS;
-
+
if( p_input->b_dead || !input_GetItem(p_input)->psz_name )
{
/* Not playing anything ... */
vlc_object_release( p_input );
return VLC_SUCCESS;
}
-
+
/* Playing something ... */
if( input_item_GetNowPlaying( p_item ) )
psz_title = input_item_GetNowPlaying( p_item );
@@ -215,12 +215,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
vlc_object_release( p_input );
return VLC_SUCCESS;
}
-
+
psz_artist = input_item_GetArtist( p_item );
if( EMPTY_STR( psz_artist ) ) FREENULL( psz_artist );
psz_album = input_item_GetAlbum( p_item ) ;
if( EMPTY_STR( psz_album ) ) FREENULL( psz_album );
-
+
int i_ret;
if( psz_artist && psz_album )
i_ret = asprintf( &psz_tmp, "%s\n%s [%s]",
@@ -229,7 +229,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
i_ret = asprintf( &psz_tmp, "%s\n%s", psz_title, psz_artist );
else
i_ret = asprintf(&psz_tmp, "%s", psz_title );
-
+
if( i_ret == -1 )
{
free( psz_title );
@@ -238,7 +238,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
vlc_object_release( p_input );
return VLC_ENOMEM;
}
-
+
char *psz_arturl = input_item_GetArtURL( p_item );
if( psz_arturl )
{
@@ -249,17 +249,17 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
CFDataRef art = NULL;
if( psz_arturl )
art = (CFDataRef) readFile( psz_arturl );
-
+
free( psz_title );
free( psz_artist );
free( psz_album );
free( psz_arturl );
-
+
NotifyToGrowl( p_intf, psz_tmp, art );
-
+
if( art ) CFRelease( art );
free( psz_tmp );
-
+
vlc_object_release( p_input );
return VLC_SUCCESS;
}
@@ -270,31 +270,31 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
static void RegisterToGrowl( vlc_object_t *p_this )
{
intf_sys_t *p_sys = ((intf_thread_t *)p_this)->p_sys;
-
+
CFArrayRef defaultAndAllNotifications = CFArrayCreate(
kCFAllocatorDefault, (const void **)&(p_sys->notification_type), 1,
&kCFTypeArrayCallBacks );
-
+
CFTypeRef registerKeys[4] = {
GROWL_APP_NAME,
GROWL_NOTIFICATIONS_ALL,
GROWL_NOTIFICATIONS_DEFAULT,
GROWL_APP_ICON
};
-
+
CFTypeRef registerValues[4] = {
p_sys->app_name,
defaultAndAllNotifications,
defaultAndAllNotifications,
p_sys->default_icon
};
-
+
CFDictionaryRef registerInfo = CFDictionaryCreate(
kCFAllocatorDefault, registerKeys, registerValues, 4,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
-
+
CFRelease( defaultAndAllNotifications );
-
+
CFNotificationCenterPostNotificationWithOptions(
CFNotificationCenterGetDistributedCenter(),
(CFStringRef)GROWL_APP_REGISTRATION, NULL, registerInfo,
@@ -305,34 +305,34 @@ static void RegisterToGrowl( vlc_object_t *p_this )
static void NotifyToGrowl( intf_thread_t *p_intf, const char *psz_desc, CFDataRef art )
{
intf_sys_t *p_sys = p_intf->p_sys;
-
+
CFStringRef title = CFStringCreateWithCString( kCFAllocatorDefault, _("Now playing"), kCFStringEncodingUTF8 );
CFStringRef desc = CFStringCreateWithCString( kCFAllocatorDefault, psz_desc, kCFStringEncodingUTF8 );
-
+
CFMutableDictionaryRef notificationInfo = CFDictionaryCreateMutable(
kCFAllocatorDefault, 5, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
-
+
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_NAME, p_sys->notification_type );
CFDictionarySetValue( notificationInfo, GROWL_APP_NAME, p_sys->app_name );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_TITLE, title );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_DESCRIPTION, desc );
-
- CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_ICON,
+
+ CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_ICON,
art ? art : p_sys->default_icon );
-
+
CFRelease( title );
CFRelease( desc );
-
+
CFNotificationCenterPostNotificationWithOptions(
CFNotificationCenterGetDistributedCenter(),
(CFStringRef)GROWL_NOTIFICATION, NULL, notificationInfo,
kCFNotificationPostToAllSessions );
-
+
CFRelease( notificationInfo );
}
-/* Ripped from CFGrowlAdditions.c
+/* Ripped from CFGrowlAdditions.c
* Strangely, this function does exist in Growl shared library, but is not
* defined in public header files */
static CFDataRef readFile(const char *filename)
@@ -342,7 +342,7 @@ static CFDataRef readFile(const char *filename)
FILE *fp = fopen(filename, "r");
if( !fp )
return NULL;
-
+
fseek(fp, 0, SEEK_END);
long dataLength = ftell(fp);
fseek(fp, 0, SEEK_SET);
More information about the vlc-commits
mailing list