Commit 626c340b authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* src/playlist/playlist.c:

  - added an intf-change variable. This is set whenever you add or delete
    an item in the playlist. You need to unset it yourself.
* modules/gui/macosx/intf.?:
  - listen for external playlist changes. update view when playlist changes.
  - activate/deactivate previous and next buttons and menuitems,
    whenever the playlist gets changed.
parent 173afde4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin * intf.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.h,v 1.25 2003/02/09 01:50:35 massiot Exp $ * $Id: intf.h,v 1.26 2003/02/13 00:09:51 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -66,8 +66,9 @@ struct intf_sys_t ...@@ -66,8 +66,9 @@ struct intf_sys_t
/* interface update */ /* interface update */
vlc_bool_t b_intf_update; vlc_bool_t b_intf_update;
vlc_bool_t b_play_status; vlc_bool_t b_play_status;
vlc_bool_t b_playlist_update;
/* menus handlers */ /* menus handlers */
vlc_bool_t b_chapter_update; vlc_bool_t b_chapter_update;
vlc_bool_t b_program_update; vlc_bool_t b_program_update;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.54 2003/02/11 15:35:29 hartman Exp $ * $Id: intf.m,v 1.55 2003/02/13 00:09:51 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -426,10 +426,19 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -426,10 +426,19 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( p_playlist != NULL ) if( p_playlist != NULL )
{ {
vlc_mutex_lock( &p_playlist->object_lock ); vlc_value_t val;
if( var_Get( (vlc_object_t *)p_playlist, "intf-change", &val )
>= 0 && val.b_bool )
{
p_intf->p_sys->b_playlist_update = 1;
p_intf->p_sys->b_intf_update = VLC_TRUE;
}
vlc_mutex_lock( &p_playlist->object_lock );
[self manage: p_playlist]; [self manage: p_playlist];
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
...@@ -591,6 +600,17 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -591,6 +600,17 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
} }
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
if ( p_intf->p_sys->b_playlist_update )
{
vlc_value_t val;
val.b_bool = 0;
var_Set( (vlc_object_t *)p_playlist, "intf-change", val );
[o_playlist playlistUpdated];
p_intf->p_sys->b_playlist_update = VLC_FALSE;
}
#define p_input p_playlist->p_input #define p_input p_playlist->p_input
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions * playlist.c : Playlist management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.31 2003/01/29 11:34:11 jlj Exp $ * $Id: playlist.c,v 1.32 2003/02/13 00:09:51 hartman Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -55,6 +55,7 @@ static void Poubellize ( playlist_t *, input_thread_t * ); ...@@ -55,6 +55,7 @@ static void Poubellize ( playlist_t *, input_thread_t * );
playlist_t * __playlist_Create ( vlc_object_t *p_parent ) playlist_t * __playlist_Create ( vlc_object_t *p_parent )
{ {
playlist_t *p_playlist; playlist_t *p_playlist;
vlc_value_t val;
/* Allocate structure */ /* Allocate structure */
p_playlist = vlc_object_create( p_parent, VLC_OBJECT_PLAYLIST ); p_playlist = vlc_object_create( p_parent, VLC_OBJECT_PLAYLIST );
...@@ -64,6 +65,10 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent ) ...@@ -64,6 +65,10 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
return NULL; return NULL;
} }
var_Create( p_playlist, "intf-change", VLC_VAR_BOOL );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
p_playlist->p_input = NULL; p_playlist->p_input = NULL;
p_playlist->i_status = PLAYLIST_STOPPED; p_playlist->i_status = PLAYLIST_STOPPED;
p_playlist->i_index = -1; p_playlist->i_index = -1;
...@@ -95,6 +100,8 @@ void playlist_Destroy( playlist_t * p_playlist ) ...@@ -95,6 +100,8 @@ void playlist_Destroy( playlist_t * p_playlist )
vlc_thread_join( p_playlist ); vlc_thread_join( p_playlist );
var_Destroy( p_playlist, "intf-change" );
vlc_object_destroy( p_playlist ); vlc_object_destroy( p_playlist );
} }
...@@ -128,6 +135,7 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target, ...@@ -128,6 +135,7 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target,
int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item, int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
int i_mode, int i_pos) int i_mode, int i_pos)
{ {
vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
...@@ -237,6 +245,9 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item, ...@@ -237,6 +245,9 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
return 0; return 0;
} }
...@@ -247,6 +258,7 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item, ...@@ -247,6 +258,7 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
*****************************************************************************/ *****************************************************************************/
int playlist_Delete( playlist_t * p_playlist, int i_pos ) int playlist_Delete( playlist_t * p_playlist, int i_pos )
{ {
vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
if( i_pos >= 0 && i_pos < p_playlist->i_size ) if( i_pos >= 0 && i_pos < p_playlist->i_size )
...@@ -279,6 +291,9 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos ) ...@@ -279,6 +291,9 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment