ocarina: Add tabs from Songlist init()

If Songlists manage this, then I can have them remove their pages
through on_playlist_empty().

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-02-28 08:13:29 -05:00
parent ef62f5d2b0
commit c23c4a2740
5 changed files with 10 additions and 20 deletions

View File

@ -32,6 +32,7 @@ class SongList : public libsaria::PlaylistRenderer
GtkWidget *window;
GtkWidget *label;
GtkWidget *page;
GtkWidget *treeview;
GtkListStore *liststore;
@ -50,9 +51,7 @@ class SongList : public libsaria::PlaylistRenderer
SongList(libsaria::Playlist *);
~SongList();
void init(string, list<MenuItem> *, bool);
GtkWidget *get_window();
GtkWidget *get_label();
GtkWidget *init(string, list<MenuItem> *, bool);
void insert(libsaria::Track *);
void fill();

View File

@ -54,9 +54,7 @@ namespace ocarina
register_shortcut("q", add_to_queue);
library_list.set_playlist(libsaria::library::get_playlist());
library_list.init("Library", &library_menu, true);
library_page = make_page(library_list.get_window());
push_page(library_page, library_list.get_label(), true);
library_page = library_list.init("Library", &library_menu, true);
set_current_page(library_page);
ocarina::library::refresh();
}

View File

@ -45,9 +45,7 @@ namespace ocarina
register_shortcut("Delete", rm_from_queue);
queue_list.set_playlist(libsaria::queue::get_playlist());
queue_list.init("Queue", &queue_menu, false);
queue_page = make_page(queue_list.get_window());;
push_page(queue_page, queue_list.get_label(), true);
queue_page = queue_list.init("Queue", &queue_menu, false);
ocarina::queue::refresh();
}

View File

@ -1,5 +1,6 @@
// Copyright (c) 2011 Bryan Schumaker
#include <ocarina/songlist.h>
#include <ocarina/body.h>
#include "songlist.h"
SongList::SongList() {}
@ -120,7 +121,7 @@ static void setup_columns(GtkCellRenderer *textcell, GtkWidget *treeview)
* the gtk_init() function has been called. This allows the songlst
* to be used as a static global variable in other files.
*/
void SongList::init(string text, list <MenuItem> *menu, bool enable_filter)
GtkWidget *SongList::init(string text, list <MenuItem> *menu, bool enable_filter)
{
/* Initialize helper variables */
name = text;
@ -141,4 +142,8 @@ void SongList::init(string text, list <MenuItem> *menu, bool enable_filter)
gtk_widget_show(label);
gtk_widget_show_all(window);
page = make_page(window);
push_page(page, label, true);
return page;
}

View File

@ -83,16 +83,6 @@ void SongList::index_removed(int index)
set_label_text();
}
GtkWidget *SongList::get_window()
{
return window;
}
GtkWidget *SongList::get_label()
{
return label;
}
void SongList::set_label_text()
{
string res;