]> git.sesse.net Git - vlc/commitdiff
don't send twice the signal when an item is added or removed
authorRafaël Carré <funman@videolan.org>
Sun, 9 Mar 2008 17:28:45 +0000 (18:28 +0100)
committerRafaël Carré <funman@videolan.org>
Sun, 9 Mar 2008 17:29:15 +0000 (18:29 +0100)
modules/control/dbus.c

index aa97d42d1ab09a9a6f170ec33bcad6859be76c88..681207ef679a1dc0f021b14baeaf95ac4704f07a 100644 (file)
@@ -837,15 +837,27 @@ DBUS_SIGNAL( TrackListChangeSignal )
 /*****************************************************************************
  * TrackListChangeEmit: Emits the TrackListChange signal
  *****************************************************************************/
-/* FIXME: It is not called on tracklist reorder and seems to be called
- * twice on element addition / removal */
+/* FIXME: It is not called on tracklist reordering */
 static int TrackListChangeEmit( vlc_object_t *p_this, const char *psz_var,
             vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
-    VLC_UNUSED(p_this); VLC_UNUSED(psz_var);
-    VLC_UNUSED(oldval); VLC_UNUSED(newval);
+    VLC_UNUSED(oldval);
     intf_thread_t *p_intf = p_data;
 
+    if( !strcmp( psz_var, "item-append" ) || !strcmp( psz_var, "item-remove" ) )
+    {
+        /* don't signal when items are added/removed in p_category */
+        playlist_t *p_playlist = (playlist_t*)p_this;
+        playlist_add_t *p_add = newval.p_address;
+        playlist_item_t *p_item;
+        p_item = playlist_ItemGetById( p_playlist, p_add->i_node, VLC_TRUE );
+        assert( p_item );
+        while( p_item->p_parent )
+            p_item = p_item->p_parent;
+        if( p_item == p_playlist->p_root_category )
+            return VLC_SUCCESS;
+    }
+
     if( p_intf->b_dead )
         return VLC_SUCCESS;