changeset 2083:0d37e05dbad3 trunk

[svn] - more updates
author nenolod
date Mon, 11 Dec 2006 03:44:07 -0800
parents fbcea190a607
children 4caeed450f2f
files ChangeLog audacious/playlist.c audacious/playlist.h
diffstat 3 files changed, 39 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 11 03:35:52 2006 -0800
+++ b/ChangeLog	Mon Dec 11 03:44:07 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-11 11:35:52 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [3169]
+  - update playlist_ins(), playlist_add().
+  
+  trunk/audacious/playlist.c |   35 ++++++++++++++++++++---------------
+  1 file changed, 20 insertions(+), 15 deletions(-)
+
+
 2006-12-11 11:30:07 +0000  William Pitcock <nenolod@nenolod.net>
   revision [3167]
   - update playlist_delete_filenames() and friends
--- a/audacious/playlist.c	Mon Dec 11 03:35:52 2006 -0800
+++ b/audacious/playlist.c	Mon Dec 11 03:44:07 2006 -0800
@@ -132,7 +132,7 @@
     playlist_compare_playlist
 };
 
-static guint playlist_load_ins(const gchar * filename, gint pos);
+static guint playlist_load_ins(Playlist * playlist, const gchar * filename, gint pos);
 
 static void playlist_generate_shuffle_list(Playlist *);
 static void playlist_generate_shuffle_list_nolock(Playlist *);
@@ -565,7 +565,7 @@
 
     if (is_playlist_name(filename)) {
         loading_playlist = TRUE;
-        playlist_load_ins(filename, pos);
+        playlist_load_ins(playlist, filename, pos);
         loading_playlist = FALSE;
         return TRUE;
     }
@@ -606,7 +606,7 @@
     for (p = buf; r-- > 0 && (*p == '\r' || *p == '\n'); p++);
 
     if (r > 5 && str_has_prefix_nocase(p, "http:")) {
-        playlist_load_ins(filename, pos);
+        playlist_load_ins(playlist, filename, pos);
         return TRUE;
     }
 
@@ -744,19 +744,19 @@
 }
 
 guint 
-playlist_add_dir(const gchar * directory)
+playlist_add_dir(Playlist * playlist, const gchar * directory)
 {
-    return playlist_ins_dir(directory, -1, TRUE);
+    return playlist_ins_dir(playlist, directory, -1, TRUE);
 }
 
 guint
-playlist_add_url(const gchar * url)
+playlist_add_url(Playlist * playlist, const gchar * url)
 {
-    return playlist_ins_url(url, -1);
+    return playlist_ins_url(playlist, url, -1);
 }
 
 guint
-playlist_ins_dir(const gchar * path,
+playlist_ins_dir(Playlist * playlist, const gchar * path,
                     gint pos,
                     gboolean background)
 {
@@ -772,7 +772,7 @@
     g_hash_table_foreach_remove(htab, devino_destroy, NULL);
 
     for (node = list; node; node = g_list_next(node)) {
-        __playlist_ins(node->data, pos, NULL);
+        __playlist_ins(playlist, node->data, pos, NULL);
         g_free(node->data);
         entries++;
         if (pos >= 0)
@@ -788,7 +788,7 @@
 }
 
 guint
-playlist_ins_url(const gchar * string,
+playlist_ins_url(Playlist * playlist, const gchar * string,
                     gint pos)
 {
     gchar *tmp;
@@ -798,6 +798,7 @@
     gboolean success = FALSE;
     gchar *decoded = NULL;
 
+    g_return_val_if_fail(playlist != NULL, 0);
     g_return_val_if_fail(string != NULL, 0);
 
     playlistwin_update_list();
@@ -814,14 +815,14 @@
         decoded = g_strdup(string);
 
         if (g_file_test(decoded, G_FILE_TEST_IS_DIR)) {
-            i = playlist_ins_dir(decoded, pos, FALSE);
+            i = playlist_ins_dir(playlist, decoded, pos, FALSE);
         }
         else {
             if (is_playlist_name(decoded)) {
-                i = playlist_load_ins(decoded, pos);
+                i = playlist_load_ins(playlist, decoded, pos);
             }
             else {
-                success = playlist_ins(decoded, pos);
+                success = playlist_ins(playlist, decoded, pos);
                 i = 1;
             }
         }
@@ -855,15 +856,17 @@
 }
 
 void
-playlist_set_info(const gchar * title, gint length, gint rate,
+playlist_set_info(Playlist * playlist, const gchar * title, gint length, gint rate,
                   gint freq, gint nch)
 {
     PLAYLIST_LOCK();
 
-    if (playlist_position) {
-        g_free(playlist_position->title);
-        playlist_position->title = g_strdup(title);
-        playlist_position->length = length;
+    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_UNLOCK();
@@ -1363,16 +1366,17 @@
 }
 
 gboolean
-playlist_save(const gchar * filename)
+playlist_save(Playlist * playlist, const gchar * filename)
 {
     PlaylistContainer *plc = NULL;
     gchar *ext;
 
+    g_return_val_if_fail(playlist != NULL, FALSE);
     g_return_val_if_fail(filename != NULL, FALSE);
 
     ext = strrchr(filename, '.') + 1;
 
-    playlist_set_current_name(filename);
+    playlist_set_current_name(playlist, filename);
 
     if ((plc = playlist_container_find(ext)) == NULL)
         return FALSE;
@@ -1386,12 +1390,12 @@
 }
 
 gboolean
-playlist_load(const gchar * filename)
+playlist_load(Playlist * playlist, const gchar * filename)
 {
     gboolean ret = FALSE;
 
     loading_playlist = TRUE;
-    ret = playlist_load_ins(filename, -1);
+    ret = playlist_load_ins(Playlist * playlist, filename, -1);
     loading_playlist = FALSE;
 
     return ret;
@@ -1508,11 +1512,12 @@
 }
 
 static guint
-playlist_load_ins(const gchar * filename, gint pos)
+playlist_load_ins(Playlist * playlist, const gchar * filename, gint pos)
 {
     PlaylistContainer *plc;
     gchar *ext;
 
+    g_return_val_if_fail(playlist != NULL, 0);
     g_return_val_if_fail(filename != NULL, 0);
 
     ext = strrchr(filename, '.') + 1;
--- a/audacious/playlist.h	Mon Dec 11 03:35:52 2006 -0800
+++ b/audacious/playlist.h	Mon Dec 11 03:44:07 2006 -0800
@@ -102,7 +102,7 @@
 guint playlist_add_url(Playlist *playlist, const gchar * url);
 guint playlist_ins_url(Playlist *playlist, const gchar * string, gint pos);
 
-void playlist_set_info(const gchar * title, gint length, gint rate,
+void playlist_set_info(Playlist *playlist, const gchar * title, gint length, gint rate,
                        gint freq, gint nch);
 void playlist_check_pos_current(Playlist *playlist);
 void playlist_next(Playlist *playlist);
@@ -192,11 +192,11 @@
 
 G_LOCK_EXTERN(playlists);
 
-extern void playlist_load_ins_file(const gchar * filename,
+extern void playlist_load_ins_file(Playlist *playlist, const gchar * filename,
                                    const gchar * playlist_name, gint pos,
                                    const gchar * title, gint len);
 
-extern void playlist_load_ins_file_tuple(const gchar * filename_p,
+extern void playlist_load_ins_file_tuple(Playlist *playlist, const gchar * filename_p,
 					 const gchar * playlist_name, gint pos,
 					 TitleInput *tuple);