ocarina: Use the playlist number
- Create new notebook page at number - Show number to left of label Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
bc800057e0
commit
a33e1e6d8d
|
@ -16,7 +16,7 @@ namespace ocarina
|
|||
{
|
||||
|
||||
void init();
|
||||
void push_page(GtkWidget *, GtkWidget *);
|
||||
void add_page(int, GtkWidget *, GtkWidget *);
|
||||
void remove_page(GtkWidget *);
|
||||
void switch_to_page(GtkWidget *);
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ namespace ocarina
|
|||
class Playlist : public libsaria::PlaylistRenderer {
|
||||
private:
|
||||
bool visible;
|
||||
GtkWidget *label;
|
||||
GtkWidget *name;
|
||||
GtkWidget *number;
|
||||
GtkWidget *box;
|
||||
GtkWidget *treeview;
|
||||
GtkListStore *liststore;
|
||||
|
@ -34,7 +35,7 @@ namespace ocarina
|
|||
void list_selected_tracks(list<libsaria::Track *> &);
|
||||
|
||||
void set_playlist(libsaria::Playlist *);
|
||||
void renamed(string &);
|
||||
void renumbered(int);
|
||||
void prepare_for_removal();
|
||||
|
||||
void goto_index(unsigned int);
|
||||
|
|
|
@ -42,9 +42,11 @@ namespace ocarina
|
|||
return tabs;
|
||||
};
|
||||
|
||||
void body::push_page(GtkWidget *page, GtkWidget *label)
|
||||
void body::add_page(int pg, GtkWidget *page, GtkWidget *label)
|
||||
{
|
||||
gtk_notebook_prepend_page(GTK_NOTEBOOK(tabs), page, label);
|
||||
if (pg == -1)
|
||||
pg = 0;
|
||||
gtk_notebook_insert_page(GTK_NOTEBOOK(tabs), page, label, pg);
|
||||
}
|
||||
|
||||
void body::remove_page(GtkWidget *page)
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace ocarina
|
|||
stream << playlist->get_size();
|
||||
text = stream.str();
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(label), text.c_str());
|
||||
gtk_label_set_text(GTK_LABEL(name), text.c_str());
|
||||
if (visible)
|
||||
set_length_label_text();
|
||||
}
|
||||
|
@ -121,25 +121,36 @@ namespace ocarina
|
|||
|
||||
void Playlist::set_playlist(libsaria::Playlist *p)
|
||||
{
|
||||
GtkWidget *label_box = gtk_hbox_new(FALSE, 0);
|
||||
|
||||
libsaria::PlaylistRenderer::set_playlist(p);
|
||||
|
||||
label = gtk_label_new("");
|
||||
box = gtk_vbox_new(FALSE, 0);
|
||||
number = gtk_label_new("");
|
||||
name = gtk_label_new("");
|
||||
box = gtk_vbox_new(FALSE, 0);
|
||||
|
||||
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.0);
|
||||
gtk_label_set_justify(GTK_LABEL(name), GTK_JUSTIFY_RIGHT);
|
||||
gtk_misc_set_alignment(GTK_MISC(name), 1.0, 0.0);
|
||||
setup_treeview();
|
||||
|
||||
gtk_widget_show(label);
|
||||
gtk_box_pack_start(GTK_BOX(label_box), number, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(label_box), name, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all(label_box);
|
||||
|
||||
gtk_widget_show_all(box);
|
||||
|
||||
set_label_text();
|
||||
body::push_page(box, label);
|
||||
renumbered(p->get_number());
|
||||
body::add_page(p->get_number(), box, label_box);
|
||||
}
|
||||
|
||||
void Playlist::renamed(string &s)
|
||||
void Playlist::renumbered(int n)
|
||||
{
|
||||
set_label_text();
|
||||
stringstream s;
|
||||
if (n == -1)
|
||||
return;
|
||||
s << "<span size='x-large'>" << n << " </span>";
|
||||
gtk_label_set_markup(GTK_LABEL(number), s.str().c_str());
|
||||
}
|
||||
|
||||
void Playlist::prepare_for_removal()
|
||||
|
|
Loading…
Reference in New Issue