signal page: the header names it, numbered; no duplicate title or back button
The slide-over's header already prints the open page's title beside its Close button, so the signal page's body carried the name twice and a "Back to signals" button that only repeated navigation the header owns. Both are gone. The header's title is now the **numbered** name -- `<n>. <name>`, `measure_channel_number()`'s number, the same one the signal badges and the measurements pane use -- so the panel says *which acquired channel* it is and not only what it is called. `slideover_set_title()` retitles a page in place (the open one included): the number follows the stream's channel numbering, and the page is refilled whenever the model's signal list changes. Probe: `[signalpage]` reads `title='1. sine' title_ok=1` (the header text against the numbered name) and `no_dup=1` (no "Back to signals" button and no `title-3` label in the body); the old `back_to_list` reading is gone with the button. Help, README and the probe doc follow.
This commit is contained in:
1 parent
bdf0ff7ddc
commit
706d247b58
7 files changed
+76
-22
No files matched your search
@@ -118,6 +118,23 @@ bool slideover_add_page(App& app, const std::string& id, const std::string& titl
|
||||
return true;
|
||||
}
|
||||
|
||||
bool slideover_set_title(App& app, const std::string& id, const std::string& title) {
|
||||
SlideOver& s = app.slideover;
|
||||
if (s.stack == nullptr || title.empty()) return false;
|
||||
GtkWidget* child = gtk_stack_get_child_by_name(GTK_STACK(s.stack), id.c_str());
|
||||
if (child == nullptr) return false;
|
||||
GtkStackPage* page = gtk_stack_get_page(GTK_STACK(s.stack), child);
|
||||
gtk_stack_page_set_title(page, title.c_str());
|
||||
if (is_source_page(id)) {
|
||||
AdwToggle* t = adw_toggle_group_get_toggle_by_name(ADW_TOGGLE_GROUP(s.source_switch), id.c_str());
|
||||
if (t != nullptr) adw_toggle_set_label(t, title.c_str());
|
||||
}
|
||||
// The header shows the *open* page's title, so a retitle of the page on show is visible at once --
|
||||
// a signal page's channel number can change under it when the stream renumbers its channels.
|
||||
if (s.page == id) gtk_label_set_text(GTK_LABEL(s.title), title.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool slideover_has_page(const App& app, const std::string& id) {
|
||||
return app.slideover.stack != nullptr &&
|
||||
gtk_stack_get_child_by_name(GTK_STACK(app.slideover.stack), id.c_str()) != nullptr;
|
||||
|
||||
Reference in new issue
Block a user