fix bar crashing on monitor add/remove
This commit is contained in:
@@ -27,10 +27,12 @@ ControlCenter::ControlCenter(Icon::Type icon, std::string name)
|
||||
this->mediaTabButton = std::make_unique<TabButton>(Icon::PLAY_CIRCLE);
|
||||
this->infoTabButton = std::make_unique<TabButton>(Icon::EMPTY_DASHBOARD);
|
||||
this->timerButton = std::make_unique<TabButton>(Icon::TOKEN);
|
||||
this->settingsTabButton = std::make_unique<TabButton>(Icon::SETTINGS);
|
||||
|
||||
this->tabRow.append(*this->mediaTabButton);
|
||||
this->tabRow.append(*this->infoTabButton);
|
||||
this->tabRow.append(*this->timerButton);
|
||||
this->tabRow.append(*this->settingsTabButton);
|
||||
|
||||
this->container.append(this->tabRow);
|
||||
|
||||
@@ -41,10 +43,12 @@ ControlCenter::ControlCenter(Icon::Type icon, std::string name)
|
||||
this->mediaControlWidget = std::make_unique<MediaWidget>();
|
||||
this->weatherWidget = std::make_unique<WeatherWidget>();
|
||||
this->timerWidget = std::make_unique<TimerWidget>();
|
||||
this->settingsWidget = std::make_unique<SettingsWidget>();
|
||||
|
||||
this->contentStack.add(*this->mediaControlWidget, "controls", "Controls");
|
||||
this->contentStack.add(*this->weatherWidget, "info", "Info");
|
||||
this->contentStack.add(*this->timerWidget, "timer", "Timer");
|
||||
this->contentStack.add(*this->settingsWidget, "settings", "Settings");
|
||||
|
||||
this->contentStack.set_visible_child("controls");
|
||||
this->setActiveTab("controls");
|
||||
@@ -63,6 +67,9 @@ ControlCenter::ControlCenter(Icon::Type icon, std::string name)
|
||||
this->setActiveTab("timer");
|
||||
});
|
||||
|
||||
this->settingsTabButton->signal_clicked().connect([this]() {
|
||||
this->setActiveTab("settings");
|
||||
});
|
||||
}
|
||||
|
||||
void ControlCenter::setActiveTab(const std::string &tab_name) {
|
||||
|
||||
Reference in New Issue
Block a user