From 6c0bcb4c08d5ce96c8d5a498341a3a3bad8545fd Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 20 Apr 2010 20:00:37 +0100 Subject: mainwindow: Add a method to remove all widgets (e.g. on disconnect) --- src/mainwindow.cc | 29 +++++++++++++++++++++++++++++ src/mainwindow.h | 2 ++ 2 files changed, 31 insertions(+) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 99b9530..7a831e8 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -896,6 +896,35 @@ void MainWindow::removeClient(uint32_t index) { clientNames.erase(index); } +void MainWindow::removeAllWidgets() { + { + std::map::iterator it; + for (it = sinkInputWidgets.begin(); it != sinkInputWidgets.end(); ++it) + removeSinkInput(it->first); + }{ + std::map::iterator it; + for (it = sourceOutputWidgets.begin(); it != sourceOutputWidgets.end(); ++it) + removeSourceOutput(it->first); + }{ + std::map::iterator it; + for (it = sinkWidgets.begin(); it != sinkWidgets.end(); ++it) + removeSink(it->first); + }{ + std::map::iterator it; + for (it = sourceWidgets.begin(); it != sourceWidgets.end(); ++it) + removeSource(it->first); + }{ + std::map::iterator it; + for (it = cardWidgets.begin(); it != cardWidgets.end(); ++it) + removeCard(it->first); + }{ + std::map::iterator it; + for (it = clientNames.begin(); it != clientNames.end(); ++it) + removeSourceOutput(it->first); + } + deleteEventRoleWidget(); +} + void MainWindow::onSinkTypeComboBoxChanged() { showSinkType = (SinkType) sinkTypeComboBox->get_active_row_number(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 0ee84b5..92db272 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -55,6 +55,8 @@ public: void removeSourceOutput(uint32_t index); void removeClient(uint32_t index); + void removeAllWidgets(); + Gtk::Notebook *notebook; Gtk::VBox *streamsVBox, *recsVBox, *sinksVBox, *sourcesVBox, *cardsVBox; Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel, *noCardsLabel; -- cgit