ocarina: Show recent songs playlist

I also needed to add in a change to focus the library by default.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-25 10:07:22 -04:00
parent 3b3beb4625
commit 4116cd3ed2
7 changed files with 27 additions and 1 deletions

View File

@ -18,6 +18,7 @@ namespace ocarina
void init();
void push_page(GtkWidget *, GtkWidget *);
void remove_page(GtkWidget *);
void switch_to_page(GtkWidget *);
void set_idle_progress(float);
void hide_idle_progress();

View File

@ -24,6 +24,7 @@ namespace ocarina
Playlist(libsaria::Playlist *);
~Playlist();
void switch_to();
void right_click(guint, guint64);
void list_selected_tracks(list<libsaria::Track *> &);

View File

@ -14,6 +14,7 @@ static GtkWidget *dur_label;
static GtkWidget *play_button;
static GtkWidget *pause_button;
static GtkWidget *stop_button;
static GtkWidget *prev_button;
static GtkWidget *next_button;
static GstState last_state;
@ -66,6 +67,11 @@ static void on_click_stop(GtkWidget *b, GdkEvent *e, gpointer d)
libsaria::audio::stop();
}
static void on_click_prev(GtkWidget *b, GdkEvent *e, gpointer d)
{
libsaria::stack::prev();
}
static void on_click_next(GtkWidget *b, GdkEvent *e, gpointer d)
{
libsaria::stack::next();
@ -78,6 +84,7 @@ static GtkWidget *make_controls()
play_button = make_button(GTK_STOCK_MEDIA_PLAY, on_click_play, true);
pause_button = make_button(GTK_STOCK_MEDIA_PAUSE, on_click_pause, false);
stop_button = make_button(GTK_STOCK_MEDIA_STOP, on_click_stop, true);
prev_button = make_button(GTK_STOCK_MEDIA_PREVIOUS, on_click_prev, true);
next_button = make_button(GTK_STOCK_MEDIA_NEXT, on_click_next, true);
pos_label = gtk_label_new("");
@ -95,6 +102,7 @@ static GtkWidget *make_controls()
gtk_box_pack_start(GTK_BOX(box), play_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), pause_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), stop_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), prev_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), next_button, FALSE, FALSE, 0);
gtk_widget_show(pos_label);

View File

@ -52,4 +52,10 @@ namespace ocarina
gtk_notebook_remove_page(GTK_NOTEBOOK(tabs), pg);
}
void body::switch_to_page(GtkWidget *page)
{
int pg = gtk_notebook_page_num(GTK_NOTEBOOK(tabs), page);
gtk_notebook_set_current_page(GTK_NOTEBOOK(tabs), pg);
}
}; /* Namespace: ocarina */

View File

@ -1,9 +1,12 @@
// Copyright (c) 2011 Bryan Schumaker
#include <ocarina/playlist.h>
#include <ocarina/body.h>
#include <libsaria/library.h>
#include <libsaria/stack.h>
static ocarina::Playlist library_renderer(PL_STATIC);
static ocarina::Playlist recent_renderer(PL_STATIC);
namespace ocarina
{
@ -16,7 +19,9 @@ namespace ocarina
void playlist::init()
{
libsaria::set_on_new_playlist(on_new_playlist);
recent_renderer.set_playlist(libsaria::stack::get_recent_plist());
library_renderer.set_playlist(libsaria::library::get_playlist());
library_renderer.switch_to();
}
}; /* Namespace: ocarina */

View File

@ -50,6 +50,11 @@ namespace ocarina
gtk_tree_selection_selected_foreach(treesel, selected_foreach_list, &tracks);
}
void Playlist::switch_to()
{
body::switch_to_page(box);
}
void Playlist::set_playlist(libsaria::Playlist *p)
{
libsaria::PlaylistRenderer::set_playlist(p);

View File

@ -16,7 +16,7 @@ GtkWidget *queue_page;
static void rm_from_queue()
{
queue_list->rm_selected_indices();
libsaria::stack_top_pop();
//libsaria::stack_top_pop();
}
static void rm_from_queue_event(GtkMenuItem *menu, gpointer data)