ui: the sidebar's tabs become one dock; Measure and Signals by keyboard section; session keeps the dock's state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Opus 4.6 committed 2026-11-02 20:37:55 +01:00
1 parent 31ff778e07
commit 4b65197f56
19 files changed
+421 -419

No files matched your search

-42
View File
@@ -11,48 +11,6 @@
namespace udpscope {
namespace ui_impl {
namespace {
/// Hide every `GtkImage` inside `w`, and keep it hidden. `AdwViewSwitcherButton` always builds an
/// icon -- in both of its layouts -- and a page with no `icon-name` gets `image-missing`, which is
/// the placeholder the sidebar's text tabs used to draw. There is no property or policy that turns
/// the icon off, so the image is hidden (a hidden child takes no space: the label gets the pill) and
/// a `notify::visible` handler puts it back to hidden if the button ever shows it again.
void hide_tab_icons(GtkWidget* w) {
if (GTK_IS_IMAGE(w)) {
if (g_object_get_data(G_OBJECT(w), "udpscope-icon-hidden") == nullptr) {
g_object_set_data(G_OBJECT(w), "udpscope-icon-hidden", GINT_TO_POINTER(1));
g_signal_connect(w, "notify::visible", G_CALLBACK(+[](GObject* o, GParamSpec*, gpointer) {
GtkWidget* img = GTK_WIDGET(o);
if (gtk_widget_get_visible(img)) gtk_widget_set_visible(img, FALSE);
}),
nullptr);
}
gtk_widget_set_visible(w, FALSE);
return;
}
for (GtkWidget* c = gtk_widget_get_first_child(w); c != nullptr; c = gtk_widget_get_next_sibling(c)) {
hide_tab_icons(c);
}
}
void on_tab_pages_changed(GListModel*, guint, guint, guint, gpointer sw) {
hide_tab_icons(GTK_WIDGET(sw));
}
} // namespace
void keep_tabs_icon_free(App& app) {
if (app.side_switcher == nullptr || app.side_stack == nullptr) return;
hide_tab_icons(app.side_switcher);
// A page added later gets a button when the model reports it; this handler is connected *after*
// the switcher's own, so the button already exists when it runs.
g_signal_connect_after(adw_view_stack_get_pages(ADW_VIEW_STACK(app.side_stack)), "items-changed",
G_CALLBACK(on_tab_pages_changed), app.side_switcher);
// And once more when the switcher is (re)mapped, which also covers a rebuild of the buttons.
g_signal_connect_swapped(app.side_switcher, "map", G_CALLBACK(hide_tab_icons), app.side_switcher);
}
void build_source_panels(App& app) {
if (app.slideover.stack == nullptr || app.acq == nullptr || app.acq->source() == nullptr) return;
SourceKind* kind = find_kind(app.source_kind);