ocarina: Remove the SongListFuncs struct
I can get everything I need using playlists and renderers, so I can safely remove this bit of code (I never really liked it anyway...). I have to keep around the queue::size() function for a little bit longer, since choosing the next song still uses it. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
f7d7589882
commit
6637a82573
|
@ -15,6 +15,7 @@ namespace libsaria
|
|||
~PlaylistRenderer();
|
||||
|
||||
void set_playlist(Playlist *);
|
||||
Playlist *get_playlist();
|
||||
|
||||
void fill();
|
||||
virtual void insert(Track *) = 0;
|
||||
|
|
|
@ -23,17 +23,10 @@ class MenuItem
|
|||
GtkWidget *get_widget();
|
||||
};
|
||||
|
||||
/* Make this a class to inherit from? */
|
||||
struct SongListFuncs
|
||||
{
|
||||
unsigned int (*size)();
|
||||
};
|
||||
|
||||
class SongList : public libsaria::PlaylistRenderer
|
||||
{
|
||||
private:
|
||||
int ins_next;
|
||||
SongListFuncs *list_funcs;
|
||||
list <MenuItem> *menu_items;
|
||||
string name;
|
||||
|
||||
|
@ -55,7 +48,7 @@ class SongList : public libsaria::PlaylistRenderer
|
|||
SongList(libsaria::Playlist *);
|
||||
~SongList();
|
||||
|
||||
void init(string, SongListFuncs *, list<MenuItem> *, bool);
|
||||
void init(string, list<MenuItem> *, bool);
|
||||
GtkWidget *get_window();
|
||||
GtkWidget *get_label();
|
||||
|
||||
|
|
|
@ -28,11 +28,6 @@ namespace libsaria
|
|||
lib_playlist.sort();
|
||||
}
|
||||
|
||||
unsigned int library::size()
|
||||
{
|
||||
return lib_playlist.apparent_size();
|
||||
}
|
||||
|
||||
string library::next_file()
|
||||
{
|
||||
libsaria::Track *cur = lib_playlist.next();
|
||||
|
|
|
@ -19,6 +19,11 @@ namespace libsaria
|
|||
playlist->set_renderer(this);
|
||||
}
|
||||
|
||||
Playlist *PlaylistRenderer::get_playlist()
|
||||
{
|
||||
return playlist;
|
||||
}
|
||||
|
||||
void PlaylistRenderer::fill()
|
||||
{
|
||||
if (playlist == NULL)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
using namespace std;
|
||||
|
||||
static SongList library_list;
|
||||
static struct SongListFuncs library_funcs;
|
||||
static list <MenuItem> library_menu;
|
||||
|
||||
static void add_to_queue()
|
||||
|
@ -50,12 +49,11 @@ namespace ocarina
|
|||
void library::init()
|
||||
{
|
||||
library_menu.push_back(MenuItem("Add to Queue", add_to_queue_event));
|
||||
library_funcs.size = libsaria::library::size;
|
||||
|
||||
register_shortcut("q", add_to_queue);
|
||||
|
||||
library_list.set_playlist(libsaria::library::get_playlist());
|
||||
library_list.init("Library", &library_funcs, &library_menu, true);
|
||||
library_list.init("Library", &library_menu, true);
|
||||
add_page(library_list.get_label(), library_list.get_window(), true);
|
||||
ocarina::library::refresh();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
using namespace std;
|
||||
|
||||
static SongList queue_list;
|
||||
static struct SongListFuncs queue_funcs;
|
||||
static list <MenuItem> queue_menu;
|
||||
unsigned int queue_index;
|
||||
|
||||
|
@ -43,12 +42,10 @@ namespace ocarina
|
|||
void queue::init()
|
||||
{
|
||||
queue_menu.push_back(MenuItem("Remove from Queue", rm_from_queue_event));
|
||||
queue_funcs.size = libsaria::queue::size;
|
||||
|
||||
register_shortcut("Delete", rm_from_queue);
|
||||
|
||||
queue_list.set_playlist(libsaria::queue::get_playlist());
|
||||
queue_list.init("Queue", &queue_funcs, &queue_menu, false);
|
||||
queue_list.init("Queue", &queue_menu, false);
|
||||
queue_index = add_page(queue_list.get_label(),
|
||||
queue_list.get_window(), true);
|
||||
ocarina::queue::refresh();
|
||||
|
|
|
@ -120,10 +120,9 @@ 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, SongListFuncs *funcs, list <MenuItem> *menu, bool enable_filter)
|
||||
void SongList::init(string text, list <MenuItem> *menu, bool enable_filter)
|
||||
{
|
||||
/* Initialize helper variables */
|
||||
list_funcs = funcs;
|
||||
name = text;
|
||||
menu_items = menu;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void SongList::set_label_text()
|
|||
stringstream stream;
|
||||
|
||||
stream << name << " (";
|
||||
stream << list_funcs->size() << ")";
|
||||
stream << get_playlist()->apparent_size() << ")";
|
||||
res = stream.str();
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(label), res.c_str());
|
||||
|
|
Loading…
Reference in New Issue