tabs: Turn OcarinaTab into a pointer
And have in inherit from Gtk::HBox Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
a74cd5e6d1
commit
4f0b7070f9
20
gui/tabs.cpp
20
gui/tabs.cpp
|
@ -57,12 +57,11 @@ static void dec_sort_timeout()
|
|||
/*
|
||||
* Tab class definition
|
||||
*/
|
||||
class OcarinaTab {
|
||||
class OcarinaTab : public Gtk::HBox {
|
||||
public:
|
||||
Gtk::Label name_label;
|
||||
Gtk::Label size_label;
|
||||
Gtk::Image tab_icon;
|
||||
Gtk::HBox box;
|
||||
Gtk::VBox inner_box;
|
||||
bool big_size;
|
||||
|
||||
|
@ -80,14 +79,14 @@ OcarinaTab::OcarinaTab(const std::string &name, const std::string &icon)
|
|||
tab_icon.set_alignment(0, 0.5);
|
||||
name_label.set_use_markup();
|
||||
name_label.set_margin_right(1);
|
||||
box.set_spacing(5);
|
||||
set_spacing(5);
|
||||
|
||||
inner_box.pack_start(name_label);
|
||||
inner_box.pack_start(size_label);
|
||||
|
||||
box.pack_start(tab_icon);
|
||||
box.pack_start(inner_box);
|
||||
box.show_all();
|
||||
pack_start(tab_icon);
|
||||
pack_start(inner_box);
|
||||
show_all();
|
||||
|
||||
if (name == "" && icon == "") {
|
||||
name_label.hide();
|
||||
|
@ -121,7 +120,7 @@ private:
|
|||
Glib::RefPtr<PlayqueueModel> model;
|
||||
Gtk::Notebook *notebook;
|
||||
|
||||
OcarinaTab tab;
|
||||
OcarinaTab *tab;
|
||||
|
||||
/* Page widgets */
|
||||
Gtk::HBox page_toolbar;
|
||||
|
@ -156,10 +155,11 @@ public:
|
|||
|
||||
OcarinaPage::OcarinaPage(const std::string &name, const std::string &icon,
|
||||
Playqueue *pq, unsigned int flags, unsigned int pg)
|
||||
: init_flags(flags), tab(name, icon)
|
||||
: init_flags(flags)
|
||||
{
|
||||
get_builder()->get_widget("o_notebook", notebook);
|
||||
model = Glib::RefPtr<PlayqueueModel>(new PlayqueueModel(pq));
|
||||
tab = new OcarinaTab(name, icon);
|
||||
|
||||
|
||||
page_toolbar.set_spacing(5);
|
||||
|
@ -207,7 +207,7 @@ OcarinaPage::OcarinaPage(const std::string &name, const std::string &icon,
|
|||
|
||||
|
||||
/* Add to notebook */
|
||||
notebook->insert_page(*this, tab.box, pg);
|
||||
notebook->insert_page(*this, *tab, pg);
|
||||
tab_map[pq] = this;
|
||||
set_tab_size();
|
||||
};
|
||||
|
@ -253,7 +253,7 @@ void OcarinaPage::check_pq_flags()
|
|||
|
||||
void OcarinaPage::set_tab_size()
|
||||
{
|
||||
tab.set_size(model->queue->size());
|
||||
tab->set_size(model->queue->size());
|
||||
}
|
||||
|
||||
void OcarinaPage::queue_selected(bool random)
|
||||
|
|
Loading…
Reference in New Issue