ui: per-signal slide-over pages; the drop's assignment and the colour reset as shared functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Opus 4.6 committed 2026-11-03 01:03:51 +01:00
1 parent 0dd235e41c
commit baf4a1f20f
8 files changed
+529 -48

No files matched your search

+19
View File
@@ -8,6 +8,7 @@
#include <adwaita.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -122,6 +123,24 @@ bool slideover_has_page(const App& app, const std::string& id) {
gtk_stack_get_child_by_name(GTK_STACK(app.slideover.stack), id.c_str()) != nullptr;
}
bool slideover_remove_page(App& app, const std::string& id) {
SlideOver& s = app.slideover;
if (!slideover_has_page(app, id) || s.page == id) return false;
GtkWidget* child = gtk_stack_get_child_by_name(GTK_STACK(s.stack), id.c_str());
if (is_source_page(id)) {
s.source_pages.erase(std::remove(s.source_pages.begin(), s.source_pages.end(), id),
s.source_pages.end());
AdwToggle* t = adw_toggle_group_get_toggle_by_name(ADW_TOGGLE_GROUP(s.source_switch), id.c_str());
if (t != nullptr) {
s.syncing = true;
adw_toggle_group_remove(ADW_TOGGLE_GROUP(s.source_switch), t);
s.syncing = false;
}
}
gtk_stack_remove(GTK_STACK(s.stack), child);
return true;
}
bool slideover_open(App& app, const std::string& id) {
SlideOver& s = app.slideover;
if (!slideover_has_page(app, id)) return false;