void Controller::process_command_playlist_add(const Arguments &args) { if (args.size() < 3) return; last_created_playlist = args[1]; if (args.size() == 3 && args[2] == "add") { add_playlist(last_created_playlist); } else if (args.size() == 4 && args[2] == "add") { add_song(args[3], last_created_playlist); } }
static void enqueue_one_file(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer ptr) { struct playlist_page *page = page_playlist(); struct playlist_ui_ctx *ctx = get_playlist_ui_ctx(page->playlist); UNUSED(model); UNUSED(iter); UNUSED(ptr); struct playlist_entry *entry = entry_from_store(ctx->store, path); entry = add_playlist(japlay_queue, get_entry_song(entry), false); if (entry) put_entry(entry); }
static void playlist_clicked(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer ptr) { struct playlist_page *page = page_playlist(); if (page->playlist == japlay_queue) return; struct playlist_ui_ctx *ctx = get_playlist_ui_ctx(page->playlist); UNUSED(view); UNUSED(col); UNUSED(ptr); struct playlist_entry *entry = entry_from_store(ctx->store, path); entry = add_playlist(japlay_queue, get_entry_song(entry), true); if (entry) { /* possible race with the playback engine */ japlay_skip(); put_entry(entry); } }