ocarina: Added bare songlist and a library tab

Eventually the songlist class will list all songs in the library.  For
now, I just create an empty window and add it to the main tabs.
This commit is contained in:
Bryan Schumaker 2011-09-18 14:43:46 -04:00
parent 18ebac3937
commit 3a5a41f53f
5 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#ifndef OCARINA_LIBRARY_H
#define OCARINA_LIBRARY_H
void library_init();
#endif /* OCARINA_LIBRARY_H */

17
ocarina/library.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <ocarina/library.h>
#include <ocarina/body.h>
#include <ocarina/gtk.h>
#include "songlist/songlist.h"
static SongList library_list;
static GtkWidget *label;
void library_init()
{
library_list.init();
label = gtk_label_new("Library");
gtk_label_set_angle(GTK_LABEL(label), 90);
gtk_widget_show(label);
add_page(label, library_list.get_window(), true);
}

View File

@ -6,6 +6,7 @@
#include <ocarina/settings.h>
#include <ocarina/footer.h>
#include <ocarina/window.h>
#include <ocarina/library.h>
#include <libsaria/libsaria.h>
#include <libsaria/controls.h>
@ -37,6 +38,7 @@ void ocarina_init(int argc, char **argv)
gtk_widget_show(vbox);
window_add(vbox);
library_init();
settings_init();
}

View File

@ -0,0 +1,30 @@
#include <ocarina/gtk.h>
#include "songlist.h"
SongList::SongList()
{
}
SongList::~SongList()
{
}
/*
* I need an init() function to set up the scrolled window AFTER
* the gtk_init() function has been called.
*/
void SongList::init()
{
window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_show(window);
}
GtkWidget *SongList::get_window()
{
return window;
}

View File

@ -0,0 +1,19 @@
#ifndef OCARINA_SONGLIST_H
#define OCARINA_SONGLIST_H
#include <ocarina/gtk.h>
class SongList
{
private:
GtkWidget *window;
public:
SongList();
~SongList();
void init();
GtkWidget *get_window();
};
#endif /* OCARINA_SONGLIST_H */