From f6614cc47e8e433cde7d8e6930f50c939ec4c125 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Thu, 15 May 2003 01:23:05 +0000 Subject: [PATCH] * variable callback for the playlist. the input, audio and video still need to be done, waiting for gibalou to work his magic on that ;) cvs: ---------------------------------------------------------------------- --- modules/gui/macosx/intf.h | 4 +++- modules/gui/macosx/intf.m | 29 +++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index 329f178fdb..1bb5da50c5 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -2,7 +2,7 @@ * intf.h: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002-2003 VideoLAN - * $Id: intf.h,v 1.38 2003/05/11 19:09:51 hartman Exp $ + * $Id: intf.h,v 1.39 2003/05/15 01:23:05 hartman Exp $ * * Authors: Jon Lech Johansen * Christophe Massiot @@ -56,6 +56,8 @@ #define _ANS(s) [[NSApp localizedString: _(s)] substringFromIndex:2] int ExecuteOnMainThread( id target, SEL sel, void * p_arg ); +int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, + vlc_value_t old_val, vlc_value_t new_val, void *param ); /***************************************************************************** * intf_sys_t: description and status of the interface diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 6c49901abe..2a11a84a8d 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -2,7 +2,7 @@ * intf.m: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002-2003 VideoLAN - * $Id: intf.m,v 1.82 2003/05/12 01:17:10 hartman Exp $ + * $Id: intf.m,v 1.83 2003/05/15 01:23:05 hartman Exp $ * * Authors: Jon Lech Johansen * Christophe Massiot @@ -270,6 +270,19 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) return( i_ret ); } +/***************************************************************************** + * playlistChanged: Callback triggered by the intf-change playlist + * variable, to let the intf update the playlist. + *****************************************************************************/ +int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, + vlc_value_t old_val, vlc_value_t new_val, void *param ) +{ + intf_thread_t * p_intf = [NSApp getIntf]; + p_intf->p_sys->b_playlist_update = VLC_TRUE; + p_intf->p_sys->b_intf_update = VLC_TRUE; + return VLC_SUCCESS; +} + /***************************************************************************** * VLCMain implementation *****************************************************************************/ @@ -468,6 +481,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) if( p_playlist != NULL ) { + var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self ); vlc_mutex_lock( &p_playlist->object_lock ); [self manage: p_playlist]; @@ -493,13 +507,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) intf_thread_t * p_intf = [NSApp getIntf]; - if( var_Get( (vlc_object_t *)p_playlist, "intf-change", &val ) >= 0 && - val.b_bool ) - { - p_intf->p_sys->b_playlist_update = VLC_TRUE; - p_intf->p_sys->b_intf_update = VLC_TRUE; - } - #define p_input p_playlist->p_input if( p_input ) @@ -622,13 +629,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) if ( p_intf->p_sys->b_playlist_update ) { - vlc_value_t val; - - val.b_bool = FALSE; - var_Set( (vlc_object_t *)p_playlist, "intf-change", val ); - [o_playlist playlistUpdated]; - p_intf->p_sys->b_playlist_update = VLC_FALSE; } -- 2.39.2