changeset 3980:bf0471c64f6a

remove duplicated code between playlist_set_info() and playlist_set_info_old_abi(). now playlist_set_info_old_abi() become wrapper function for playlist_set_info().
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Wed, 21 Nov 2007 01:25:36 +0900
parents 67f01143e613
children bd8de2a3cbea efccc622bbfd
files src/audacious/playlist.c
diffstat 1 files changed, 9 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Wed Nov 21 00:46:54 2007 +0900
+++ b/src/audacious/playlist.c	Wed Nov 21 01:25:36 2007 +0900
@@ -1113,20 +1113,20 @@
     return entries;
 }
 
+/* set info for current song. */
 void
-playlist_set_info_old_abi(const gchar * title, gint length, gint rate,
+playlist_set_info(Playlist * playlist, const gchar * title, gint length, gint rate,
                           gint freq, gint nch)
 {
-    Playlist *playlist = playlist_get_active();
     PlaylistEventInfoChange *msg;
     gchar *text;
 
+    g_return_if_fail(playlist != NULL);
+
     if(length == -1) {
         event_queue("hide seekbar", (gpointer)0xdeadbeef); // event_queue hates NULL --yaz
     }
 
-    g_return_if_fail(playlist != NULL);
-
     if (playlist->position) {
         g_free(playlist->position->title);
         playlist->position->title = g_strdup(title);
@@ -1156,25 +1156,13 @@
         hook_call( "playlist set info" , playlist->position );
 }
 
+/* wrapper for playlist_set_info. this function is called by input plugins. */
 void
-playlist_set_info(Playlist * playlist, const gchar * title, gint length, gint rate,
-                  gint freq, gint nch)
+playlist_set_info_old_abi(const gchar * title, gint length, gint rate,
+                          gint freq, gint nch)
 {
-    g_return_if_fail(playlist != NULL);
-
-    if (playlist->position) {
-        g_free(playlist->position->title);
-        playlist->position->title = g_strdup(title);
-        playlist->position->length = length;
-    }
-
-    playlist_recalc_total_time(playlist);
-    PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz
-
-    mainwin_set_song_info(rate, freq, nch);
-
-    if (playlist->position)
-        hook_call( "playlist set info" , playlist->position );
+    Playlist *playlist = playlist_get_active();
+    playlist_set_info(playlist, title, length, rate, freq, nch);
 }
 
 void