gui: QueueTabs should implement the on_remove() notification
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
116d1cd28f
commit
e4ea994728
|
@ -7,6 +7,7 @@
|
||||||
#include <gui/tabs.h>
|
#include <gui/tabs.h>
|
||||||
|
|
||||||
|
|
||||||
|
static void renumber_queues();
|
||||||
static unsigned int q_col_width[] = { 20, 300, 60, 100, 100, 45, 100, 60, 1 };
|
static unsigned int q_col_width[] = { 20, 300, 60, 100, 100, 45, 100, 60, 1 };
|
||||||
|
|
||||||
static class QueueColumns : public Gtk::TreeModelColumnRecord {
|
static class QueueColumns : public Gtk::TreeModelColumnRecord {
|
||||||
|
@ -64,6 +65,7 @@ private:
|
||||||
public:
|
public:
|
||||||
QueueTab(Queue *, unsigned int num);
|
QueueTab(Queue *, unsigned int num);
|
||||||
~QueueTab();
|
~QueueTab();
|
||||||
|
void on_remove();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper functions
|
* Helper functions
|
||||||
|
@ -169,11 +171,15 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num)
|
||||||
q_vbox.show_all();
|
q_vbox.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueTab :: ~QueueTab()
|
QueueTab :: ~QueueTab() {}
|
||||||
|
|
||||||
|
void QueueTab :: on_remove()
|
||||||
{
|
{
|
||||||
queue_mapping.erase(tab_widget);
|
queue_mapping.erase(tab_widget);
|
||||||
tab_unmap();
|
tab_unmap();
|
||||||
gui :: get_widget<Gtk::Notebook>("o_notebook")->remove_page(q_vbox);
|
gui :: get_widget<Gtk::Notebook>("o_notebook")->remove_page(q_vbox);
|
||||||
|
renumber_queues();
|
||||||
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,15 +330,6 @@ void on_pq_created(Queue *pq, unsigned int num)
|
||||||
tab->on_post_init();
|
tab->on_post_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_pq_removed(Queue *pq)
|
|
||||||
{
|
|
||||||
Tab *tab = find_tab(pq);
|
|
||||||
if (tab) {
|
|
||||||
delete tab;
|
|
||||||
renumber_queues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void on_page_reordered(Gtk::Widget *page, int num)
|
static void on_page_reordered(Gtk::Widget *page, int num)
|
||||||
{
|
{
|
||||||
Gtk::Notebook *notebook = gui :: get_widget<Gtk::Notebook>("o_notebook");
|
Gtk::Notebook *notebook = gui :: get_widget<Gtk::Notebook>("o_notebook");
|
||||||
|
@ -352,9 +349,6 @@ static void on_page_reordered(Gtk::Widget *page, int num)
|
||||||
|
|
||||||
void init_queue_tabs()
|
void init_queue_tabs()
|
||||||
{
|
{
|
||||||
struct Callbacks *cb = get_callbacks();
|
|
||||||
cb->on_pq_removed = on_pq_removed;
|
|
||||||
|
|
||||||
Gtk::Notebook *notebook = gui :: get_widget<Gtk::Notebook>("o_notebook");
|
Gtk::Notebook *notebook = gui :: get_widget<Gtk::Notebook>("o_notebook");
|
||||||
notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered));
|
notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered));
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ void Tab :: tab_finish_init()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void Tab :: on_remove() {}
|
||||||
|
|
||||||
void Tab :: on_track_added(unsigned int row)
|
void Tab :: on_track_added(unsigned int row)
|
||||||
{
|
{
|
||||||
tab_model->on_row_inserted(row);
|
tab_model->on_row_inserted(row);
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* QNotifier implementation
|
* QNotifier implementation
|
||||||
*/
|
*/
|
||||||
|
virtual void on_remove();
|
||||||
void on_track_added(unsigned int);
|
void on_track_added(unsigned int);
|
||||||
void on_track_removed(unsigned int);
|
void on_track_removed(unsigned int);
|
||||||
void on_track_updated(unsigned int);
|
void on_track_updated(unsigned int);
|
||||||
|
|
Loading…
Reference in New Issue