Files
udpscope/src/ui/source-chooser.ui
T
Martino Ferrari d8a79b96ba help: default the contextual layer off, and carry the help into the chooser
The contextual help was on by default, so a first run met a window with a "?"
beside every surface it had not asked to have explained; `contextual_help` now
defaults to false and the layer is asked for from the Help menu, from the
chooser's new help menu, or with Ctrl+H.

The source chooser runs before `App` exists, which makes it the window a user
who does not know how to start is looking at, so it now carries the same three
help affordances the window's Help view does: Documentation (the manual is
another process and needs nothing of the app), Enable contextual help (a row
whose check *is* the setting, written to the file the app reads a moment
later), and Guided tour. The tour is drawn on the app's own window, so the
chooser can only record the wish: it sets `Config::tour_pending` -- the value
`main()` owns and hands to both `choose_source()` and `run_ui()` -- and
`on_activate()` starts it once the window is up and laid out, through its own
callback so the readings can tell a request from the first-run auto-start.
The rows are the window's own `menu_button()`/`menu_toggle()`; `install_css()`
therefore runs from `choose_source()` (it is idempotent now) so the popover
gets the `.udpscope-menu` rules before it is shown.

Opening the manual could also fail with a message that blamed the handler
whatever was missing. `help_installed_path()` now resolves `help:<id>` the way
the specification does and the failure alert says which of the two it is: with
the set installed it names the viewer, without it it names the identifier, the
expected installed path and the install command. `show_help()` gained an
optional reporter, which `UDPSCOPE_PROBE_HELP_MS` uses for a new reading --
`[help] launch attempted= done= ok= error='' installed=` -- since a successful
launch leaves no window of ours to observe.

Tested: clean --clean-first build, three warnings as documented; test-ui 13/13
and test-help pass; no Gtk-CRITICAL in the help, helpui and chooser runs.
2026-10-14 17:22:03 +02:00

131 lines
6.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: MIT -->
<!-- SPDX-FileCopyrightText: 2026 Martino Ferrari -->
<!--
What to watch: one page of sources it can connect to, one page of waveforms opened before, and the
three buttons that are about the chooser rather than about a source.
This window exists *before* the application does. `main()` asks it what to open and only then builds
the model and the rest of the interface, which is why the preferences are reachable from here at all
— and why nothing in this file may reach for `App`.
The two pages are an `AdwViewStack` under an `AdwViewSwitcherBar` and not a `GtkNotebook`: a tab strip
is the wrong shape for two views of one thing, and the switcher is what current libadwaita asks for.
The bar is revealed unconditionally because this window is small enough that it always is narrow.
The rows are not here, deliberately. A source row and a waveform row are *data* — `source_dialog.cpp`
builds them from the known hosts and the recent files, and rebuilds them whenever either changes — so
this file holds the frame and the fixed buttons, and nothing here carries a value.
-->
<interface>
<object class="AdwWindow" id="chooser_window">
<property name="title" translatable="yes">udpscope — choose a source</property>
<property name="default-width">420</property>
<property name="default-height">360</property>
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<child type="start">
<object class="GtkButton" id="prefs_button">
<property name="label" translatable="yes">_Preferences…</property>
<property name="use-underline">1</property>
<property name="tooltip-text" translatable="yes">the event cache, relative time and the interface's theme — the same dialog as the main window's menu, and the only place relative time can still change this run</property>
</object>
</child>
<!-- The help menu: the same three affordances the window's Help view carries, because a
user who has not started yet is exactly the one who does not know how to start. Only
the button is here — its rows carry a handler and a setting, so they are code, the
same division every other row in this file follows. Beside `_Preferences`, because
both act on the *program* rather than on a source. -->
<child type="start">
<object class="GtkMenuButton" id="help_menu_button">
<property name="icon-name">help-about-symbolic</property>
<property name="tooltip-text" translatable="yes">the manual, a guided tour after start-up, and the contextual help</property>
</object>
</child>
<child type="end">
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="use-underline">1</property>
</object>
</child>
<child type="end">
<object class="GtkButton" id="new_host_button">
<property name="label" translatable="yes">_New host…</property>
<property name="use-underline">1</property>
</object>
</child>
</object>
</child>
<property name="content">
<object class="AdwViewStack" id="page_stack">
<child>
<object class="AdwViewStackPage">
<property name="name">sources</property>
<property name="title" translatable="yes">Sources</property>
<property name="icon-name">network-transmit-receive-symbolic</property>
<property name="child">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="child">
<object class="GtkListBox" id="sources_list">
<property name="activate-on-single-click">1</property>
</object>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="AdwViewStackPage">
<property name="name">waveforms</property>
<property name="title" translatable="yes">Waveforms</property>
<property name="icon-name">document-open-recent-symbolic</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="child">
<object class="GtkListBox" id="waves_list">
<property name="activate-on-single-click">1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="halign">end</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-end">12</property>
<child>
<object class="GtkButton" id="waves_open">
<property name="label" translatable="yes">_Open…</property>
<property name="use-underline">1</property>
<property name="tooltip-text" translatable="yes">choose an exported .npy to view and analyse</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</property>
<child type="bottom">
<object class="AdwViewSwitcherBar" id="page_switcher">
<property name="reveal">1</property>
</object>
</child>
</object>
</child>
</object>
</interface>