Fix compilation.

This commit is contained in:
Zachary Hall 2024-04-13 13:44:56 -07:00
parent cdbb5bff49
commit 2b31c8b1b2

View file

@ -41,6 +41,11 @@ void MainWindow::update_file(optional<std::string> new_file) {
seek_bar.set_value(0.0); seek_bar.set_value(0.0);
} }
int i = 0; int i = 0;
for (auto row : stream_selection_box.get_children()) {
int *data = (int*)row->get_data(Glib::Quark("id"));
row->remove_data(Glib::Quark("id"));
delete data;
}
stream_selection_box.remove_all(); stream_selection_box.remove_all();
for (auto &stream : playback->get_streams()) { for (auto &stream : playback->get_streams()) {
int id = i++; int id = i++;
@ -58,14 +63,14 @@ void MainWindow::update_file(optional<std::string> new_file) {
Gtk::ListBoxRow listBoxRow; Gtk::ListBoxRow listBoxRow;
listBoxRow.set_child(parentBox); listBoxRow.set_child(parentBox);
listBoxRow.set_hexpand(); listBoxRow.set_hexpand();
listBoxRow.set_data(Glib::Quark("id"), (void*)id); listBoxRow.set_data(Glib::Quark("id"), new int(id));
stream_selection_box.append(listBoxRow); stream_selection_box.append(listBoxRow);
if (id == this->playback->get_current_stream()) { if (id == this->playback->get_current_stream()) {
stream_selection_box.select_row(listBoxRow); stream_selection_box.select_row(listBoxRow);
} }
} }
stream_selection_box.signal_row_selected().connect([=,this](auto *row) { stream_selection_box.signal_row_selected().connect([=,this](auto *row) {
this->playback->play_stream((int)row->get_data(Glib::Quark("id"))); this->playback->play_stream(*(int*)row->get_data(Glib::Quark("id")));
}); });
std::optional<std::string> title = playback->get_current_title(); std::optional<std::string> title = playback->get_current_title();
song_name = title.value_or(""); song_name = title.value_or("");