gui: Add a close tab button
Only visible for playqueue tabs Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
07a7f3d4a7
commit
5df8c94ae5
19
gui/tabs.cpp
19
gui/tabs.cpp
|
@ -113,6 +113,8 @@ void PresetTab::set_size(unsigned int size)
|
|||
class PQTab : public OcarinaTab {
|
||||
public:
|
||||
Gtk::Label size_label;
|
||||
Gtk::Image close_icon;
|
||||
Gtk::Button close_button;
|
||||
PQTab();
|
||||
~PQTab();
|
||||
void set_size(unsigned int);
|
||||
|
@ -120,7 +122,11 @@ public:
|
|||
|
||||
PQTab::PQTab() : size_label("0", 0.5, 0.5)
|
||||
{
|
||||
pack_start(size_label);
|
||||
close_icon.set(Gtk::Stock::CLOSE, Gtk::ICON_SIZE_MENU);
|
||||
close_button.set_image(close_icon);
|
||||
close_button.set_relief(Gtk::RELIEF_NONE);
|
||||
pack_start(size_label, true, true);
|
||||
pack_start(close_button, false, false);
|
||||
show_all();
|
||||
}
|
||||
|
||||
|
@ -171,6 +177,7 @@ public:
|
|||
void check_pq_flags();
|
||||
void queue_selected(bool);
|
||||
|
||||
void on_close_clicked();
|
||||
void on_row_inserted(unsigned int);
|
||||
void on_row_deleted(unsigned int);
|
||||
void on_row_changed(unsigned int);
|
||||
|
@ -192,7 +199,11 @@ OcarinaPage::OcarinaPage(const std::string &name, const std::string &icon,
|
|||
|
||||
OcarinaPage::OcarinaPage(Playqueue *pq, unsigned int flags, unsigned int pg)
|
||||
{
|
||||
tab = new PQTab();
|
||||
PQTab *pqt = new PQTab();
|
||||
tab = pqt;
|
||||
|
||||
pqt->close_button.signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&OcarinaPage::on_close_clicked));
|
||||
setup_common(pq, pg);
|
||||
}
|
||||
|
||||
|
@ -318,7 +329,11 @@ void OcarinaPage::queue_selected(bool random)
|
|||
track_id = (*model->queue)[(*it)[0]];
|
||||
pq->add(track_id);
|
||||
}
|
||||
}
|
||||
|
||||
void OcarinaPage::on_close_clicked()
|
||||
{
|
||||
deck :: remove(notebook->page_num(*this));
|
||||
}
|
||||
|
||||
void OcarinaPage::on_row_inserted(unsigned int row)
|
||||
|
|
Loading…
Reference in New Issue