]> git.sesse.net Git - vlc/commitdiff
* variable callback for the playlist. the input, audio and video still need
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 15 May 2003 01:23:05 +0000 (01:23 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 15 May 2003 01:23:05 +0000 (01:23 +0000)
  to be done, waiting for gibalou to work his magic on that ;)
cvs: ----------------------------------------------------------------------

modules/gui/macosx/intf.h
modules/gui/macosx/intf.m

index 329f178fdbcd232263e35bfe35d0ee1c53790dd9..1bb5da50c51265f3651a0052a55c2e44bc767e43 100644 (file)
@@ -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 <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -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
index 6c49901abea3b3b428e3bf806f235c3dcd96c0be..2a11a84a8d870801ed8efaefb414fb2428d71b0d 100644 (file)
@@ -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 <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -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;
     }