# HG changeset patch # User nenolod # Date 1165836952 28800 # Node ID fbcea190a607bf155e76cf73eb6c66b995528c53 # Parent b98891c9e15598385d7270d252122b0600f0688e [svn] - update playlist_ins(), playlist_add(). diff -r b98891c9e155 -r fbcea190a607 ChangeLog --- a/ChangeLog Mon Dec 11 03:30:07 2006 -0800 +++ b/ChangeLog Mon Dec 11 03:35:52 2006 -0800 @@ -1,3 +1,11 @@ +2006-12-11 11:30:07 +0000 William Pitcock + revision [3167] + - update playlist_delete_filenames() and friends + + trunk/audacious/playlist.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + + 2006-12-11 11:25:21 +0000 William Pitcock revision [3165] - this commit breaks the API. I'm not done here, but hopefully the new API is diff -r b98891c9e155 -r fbcea190a607 audacious/playlist.c --- a/audacious/playlist.c Mon Dec 11 03:30:07 2006 -0800 +++ b/audacious/playlist.c Mon Dec 11 03:35:52 2006 -0800 @@ -408,7 +408,7 @@ PLAYLIST_LOCK(); for (fnode = filenames; fnode; fnode = g_list_next(fnode)) { - node = playlist; + node = playlist->entries; while (node) { GList *next = g_list_next(node); @@ -486,7 +486,8 @@ } static void -__playlist_ins_with_info(const gchar * filename, +__playlist_ins_with_info(Playlist * playlist, + const gchar * filename, gint pos, const gchar * title, gint len, @@ -495,7 +496,7 @@ g_return_if_fail(filename != NULL); PLAYLIST_LOCK(); - playlist = g_list_insert(playlist, + playlist->entries = g_list_insert(playlist->entries, playlist_entry_new(filename, title, len, dec), pos); PLAYLIST_UNLOCK(); @@ -507,7 +508,8 @@ } static void -__playlist_ins_with_info_tuple(const gchar * filename, +__playlist_ins_with_info_tuple(Playlist * playlist, + const gchar * filename, gint pos, TitleInput *tuple, InputPlugin * dec) @@ -515,18 +517,18 @@ GList *node; PlaylistEntry *entry; + g_return_if_fail(playlist != NULL); g_return_if_fail(filename != NULL); PLAYLIST_LOCK(); - playlist = g_list_insert(playlist, + playlist->entries = g_list_insert(playlist->entries, playlist_entry_new(filename, tuple->track_name, tuple->length, dec), pos); - if(pos < 0 ) { - pos = g_list_length(playlist) - 1; /* last element. */ - } - - node = g_list_nth(playlist, pos); + if (pos < 0) + pos = g_list_length(playlist->entries) - 1; /* last element. */ + + node = g_list_nth(playlist->entries, pos); entry = PLAYLIST_ENTRY(node->data); if (tuple != NULL) { @@ -544,20 +546,23 @@ } static void -__playlist_ins(const gchar * filename, gint pos, InputPlugin *dec) +__playlist_ins(Playlist * playlist, const gchar * filename, gint pos, InputPlugin *dec) { - __playlist_ins_with_info(filename, pos, NULL, -1, dec); + __playlist_ins_with_info(playlist, filename, pos, NULL, -1, dec); playlist_recalc_total_time(); } gboolean -playlist_ins(const gchar * filename, gint pos) +playlist_ins(Playlist * playlist, const gchar * filename, gint pos) { gchar buf[64], *p; gint r; VFSFile *file; InputPlugin *dec; + g_return_val_if_fail(playlist != NULL, FALSE); + g_return_val_if_fail(filename != NULL, FALSE); + if (is_playlist_name(filename)) { loading_playlist = TRUE; playlist_load_ins(filename, pos); @@ -572,7 +577,7 @@ if (cfg.playlist_detect == TRUE || loading_playlist == TRUE || (loading_playlist == FALSE && dec != NULL)) { - __playlist_ins(filename, pos, dec); + __playlist_ins(playlist, filename, pos, dec); playlist_generate_shuffle_list(playlist); playlistwin_update_list(); return TRUE; @@ -733,9 +738,9 @@ } gboolean -playlist_add(const gchar * filename) +playlist_add(Playlist * playlist, const gchar * filename) { - return playlist_ins(filename, -1); + return playlist_ins(playlist, filename, -1); } guint