ocarina: Add new playlists to front and back

I was waiting until I could renumber and rearrage tabs to do this.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-09-02 12:58:02 -04:00
parent 26e818cc21
commit 84ff25b3be
1 changed files with 8 additions and 6 deletions

View File

@ -141,7 +141,7 @@ static void selected_foreach_list(GtkTreeModel *model, GtkTreePath *path,
tracks->push_back(track);
}
static void new_playlist(string &key, GtkTreeView *treeview)
static void new_playlist(string &key, GtkTreeView *treeview, bool front)
{
list<libsaria::Track *> tracks;
GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
@ -150,10 +150,10 @@ static void new_playlist(string &key, GtkTreeView *treeview)
if (tracks.size() == 0)
return;
if (key == "s")
libsaria::deck::new_playlist(tracks, PLIST_SET, true);
if (key == "q")
libsaria::deck::new_playlist(tracks, PLIST_QUEUE, true);
if (key == "s" || key == "S")
libsaria::deck::new_playlist(tracks, PLIST_SET, front);
if (key == "q" || key == "Q")
libsaria::deck::new_playlist(tracks, PLIST_QUEUE, front);
}
static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
@ -162,7 +162,9 @@ static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
string key = gdk_keyval_name(event->key.keyval);
if (key == "s" || key == "q")
new_playlist(key, widgets->treeview);
new_playlist(key, widgets->treeview, false);
else if (key == "S" || key == "Q")
new_playlist(key, widgets->treeview, true);
else
return FALSE;
return TRUE;