Mercurial > audlegacy
changeset 3480:3f4ad59a5c02 trunk
Load extra playlists on startup
author | Kieran Clancy <clancy.kieran+audacious@gmail.com> |
---|---|
date | Mon, 10 Sep 2007 14:42:07 +0930 |
parents | 26910525cec8 |
children | 308e5fb348db |
files | src/audacious/main.c |
diffstat | 1 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/main.c Mon Sep 10 14:18:18 2007 +0930 +++ b/src/audacious/main.c Mon Sep 10 14:42:07 2007 +0930 @@ -1108,6 +1108,35 @@ return TRUE; } +static gboolean +load_extra_playlist(const gchar * path, const gchar * basename, + gpointer def) +{ + const gchar *title; + Playlist *playlist; + Playlist *deflist; + + deflist = (Playlist *)def; + playlist = playlist_new(); + if (!playlist) { + g_warning("Couldn't create new playlist\n"); + return FALSE; + } + + playlist_add_playlist(playlist); + playlist_load(playlist, path); + + title = playlist_get_current_name(playlist); + + if (playlist_playlists_equal(playlist, deflist)) { + /* same as default playlist */ + playlist_remove_playlist(playlist); + playlist_filename_set(deflist, path); + } + + return FALSE; /* keep loading other playlists */ +} + gint main(gint argc, gchar ** argv) { @@ -1231,6 +1260,12 @@ playlist_load(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); playlist_set_position(playlist, cfg.playlist_position); + /* Load extra playlists */ + if(!dir_foreach(bmp_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist, + playlist, NULL)) { + g_warning("Could not load extra playlists\n"); + } + /* this needs to be called after all 3 windows are created and * input plugins are setup'ed * but not if we're running headless --nenolod