Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5ecc54f
feat(linux-grid): mark a field's key, edit and type in the row details
sedax90 Nov 8, 2026
d0f125b
docs(linux-grid): add the changelog entry
sedax90 Nov 8, 2026
bb9fc32
feat(linux-grid): search the row details' fields and show the edited …
sedax90 Nov 8, 2026
69e32e5
docs(linux-grid): add the changelog entry
sedax90 Nov 8, 2026
f743a96
fix(linux-grid): name a field's key and type to screen readers and dr…
datlechin Nov 8, 2026
faaf93d
Merge branch 'feat/linux-row-detail-fields' into feat/linux-row-detai…
datlechin Nov 8, 2026
d83d8ba
fix(linux-grid): add a symbolic type marker to row details
datlechin Nov 8, 2026
9e863bd
fix(linux-grid): compare accessible field text as strings
datlechin Nov 8, 2026
c3431d7
Merge branch 'feat/linux-row-detail-fields' into feat/linux-row-detai…
datlechin Nov 8, 2026
22e2078
fix(linux-grid): refresh row detail filters with their data
datlechin Nov 8, 2026
a34198c
fix(linux-grid): focus the row detail search when typing
datlechin Nov 8, 2026
4f0ee65
test(linux-grid): wait for row detail controls before tabbing
datlechin Nov 8, 2026
4ad9eca
feat(linux-grid): draw a row detail field as a name over its value, w…
sedax90 Nov 9, 2026
4f42a15
chore(linux): changelog for the row details design
sedax90 Nov 9, 2026
f168a84
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 9, 2026
2e485aa
fix(linux-grid): copy a row detail field's whole value through the gr…
datlechin Nov 9, 2026
78baf3d
test(linux-grid): keep the row detail copy tests clear of other open …
datlechin Nov 9, 2026
19de849
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
3df0c59
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
934ffcc
Merge remote-tracking branch 'origin/main' into feat/linux-row-detail…
datlechin Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linux/changelog.d/4156.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Each field in the row details has a button that copies its whole value.
74 changes: 65 additions & 9 deletions linux/crates/app/src/ui/data_grid/row_detail/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,32 @@ fn field_row() -> gtk::Box {
.min_chars(1)
.text_overflow(gtk::InscriptionOverflow::EllipsizeEnd)
.build();
let row = gtk::Box::builder()
// As the grid's cells and the value editor draw a value.
value.add_css_class("monospace");
let content = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.spacing(2)
.hexpand(true)
.valign(gtk::Align::Center)
.build();
content.append(&top);
content.append(&value);
// A suffix of the row, as on a libadwaita property row.
let copy = gtk::Button::builder()
.icon_name(icons::EDIT_COPY)
.valign(gtk::Align::Center)
.build();
copy.add_css_class("flat");
crate::ui::a11y::describe_icon_button(&copy, &gettext("Copy Value"), None);
let row = gtk::Box::builder()
.spacing(6)
.margin_top(6)
.margin_bottom(6)
.margin_start(12)
.margin_end(12)
.build();
row.append(&top);
row.append(&value);
row.append(&content);
row.append(&copy);
row
}

Expand All @@ -152,10 +168,12 @@ struct FieldParts {
edited: gtk::Image,
kind: gtk::Label,
value: gtk::Inscription,
copy: gtk::Button,
}

fn field_parts(row: &gtk::Widget) -> Option<FieldParts> {
let top = row.first_child()?;
let content = row.first_child()?;
let top = content.first_child()?;
let key = top.first_child()?;
let name = key.next_sibling()?;
let edited = name.next_sibling()?;
Expand All @@ -165,7 +183,8 @@ fn field_parts(row: &gtk::Widget) -> Option<FieldParts> {
name: name.downcast().ok()?,
edited: edited.downcast().ok()?,
kind: kind.downcast().ok()?,
value: row.last_child()?.downcast().ok()?,
value: top.next_sibling()?.downcast().ok()?,
copy: content.next_sibling()?.downcast().ok()?,
})
}

Expand Down Expand Up @@ -266,11 +285,32 @@ impl RowDetailPane {

fn field_factory(&self) -> gtk::SignalListItemFactory {
let factory = gtk::SignalListItemFactory::new();
factory.connect_setup(|_, item| {
if let Some(item) = item.downcast_ref::<gtk::ListItem>() {
item.set_child(Some(&field_row()));
factory.connect_setup(glib::clone!(
#[weak(rename_to = pane)]
self,
move |_, item| {
let Some(item) = item.downcast_ref::<gtk::ListItem>() else {
return;
};
let row = field_row();
if let Some(parts) = field_parts(row.upcast_ref()) {
// The grid's Copy, so the whole value goes rather than
// the text the field draws, which cuts a long one.
parts.copy.connect_clicked(glib::clone!(
#[weak]
pane,
#[weak]
item,
move |_| {
if let Some(column) = field_of(item.item()) {
pane.act_on_field(column, "copy");
}
}
));
}
item.set_child(Some(&row));
}
});
));
factory.connect_bind(glib::clone!(
#[weak(rename_to = pane)]
self,
Expand Down Expand Up @@ -370,6 +410,7 @@ impl RowDetailPane {
edited,
kind,
value: shown,
..
}) = field_parts(&row_box)
else {
return;
Expand Down Expand Up @@ -492,6 +533,21 @@ impl RowDetailPane {
.scroll_to(position, Some(&view_column), gtk::ListScrollFlags::FOCUS, None);
}

/// Run the grid's `action` on the shown row's `column`, whichever
/// field the editor holds, as a cell menu runs it on its cell.
fn act_on_field(&self, column: usize, action: &str) {
let (Some(grid), Some(row)) = (self.grid(), self.current_pin()) else {
return;
};
grid.hold_menu_target(crate::ui::data_grid::selection::Target {
cell: Some((row.clone(), column)),
rows: vec![row],
});
grid.refresh_actions();
grid.actions().activate_action(action, None);
grid.release_menu_target_soon();
}

/// A header drag, a hidden column or a new column set reorders the
/// fields once the grid has finished changing its columns.
fn schedule_field_sync(&self) {
Expand Down
73 changes: 73 additions & 0 deletions linux/crates/app/src/ui/data_grid/row_detail/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use super::clock::{ClockField, time_of, with_time};
use super::fields::{field_label, field_order};
use super::value_editor::value_content;
use crate::services::change_tracker::RowKey;
use crate::services::grid::display_text::DISPLAY_MAX_CHARS;
use crate::services::grid::{CellLock, GridColumn, GridRowId, grid_columns};
use crate::services::tracker_edit::TrackerEdit;
use crate::test_support::{
Expand Down Expand Up @@ -511,6 +512,78 @@ fn the_fields_follow_the_grid_column_order() {
assert_eq!(fields(&pane), [1, 2, 0], "a hidden column's field did not go last");
}

fn copy_button(pane: &RowDetailPane, column: usize) -> gtk::Button {
let row = drawn_field(pane, column).child().expect("the field's row");
descendants(&row)
.into_iter()
.filter_map(|widget| widget.downcast::<gtk::Button>().ok())
.find(|button| button.icon_name().as_deref() == Some(crate::ui::icons::EDIT_COPY))
.expect("the field's copy button")
}

#[gtk4::test]
fn a_fields_copy_button_copies_its_whole_value_and_leaves_the_editor() {
let long = "x".repeat(DISPLAY_MAX_CHARS + 500);
let (grid, pane) = opened(
three_text_columns(),
vec![vec![Value::Int(1), Value::Text("A".into()), Value::Text(long.clone())]],
);
grid.focus(0, 1);
drain_main_context();
let heard: Rc<RefCell<Vec<String>>> = Rc::default();
let log = heard.clone();
grid.grid.connect_request(move |_, request| {
if let GridRequest::Toast(text) = request {
log.borrow_mut().push(text);
}
});

copy_button(&pane, 2).emit_clicked();
wait_until(WAIT, || !heard.borrow().is_empty()).expect("the copy lands");

let clipboard = grid.grid.clipboard();
let copied = finish_on_main(WAIT, async move { clipboard.read_text_future().await })
.expect("the clipboard to answer")
.expect("text on the clipboard");
assert_eq!(
copied.as_deref().map(str::len),
Some(long.len()),
"the copy took the text the field draws"
);
assert_eq!(selected_field(&pane), Some(1), "the copy moved the editor");
assert_eq!(pane.typed_text(), "A");
}

/// The arrows go from field to field, so Tab leaves the list once past
/// the focused field's own buttons rather than through every field.
#[gtk4::test]
fn tab_leaves_the_field_list_after_the_focused_field() {
let (grid, pane) = opened(two_text_columns(), two_text_values());
crate::test_support::KeyInjector::focus_only(&grid.window);
take_keyboard(&grid);
grid.focus(0, 1);
let list = pane.imp().field_list.get();
wait_until(WAIT, || {
pane.imp().field_search.is_mapped() && list.width() > 0 && list.height() > 0
})
.expect("the fields are laid out");
crate::test_support::after_next_frame(&grid.window);
assert!(pane.imp().field_search.grab_focus());
let keys = crate::test_support::KeyInjector::connect().expect("an X11 display");
let on_copy = || {
gtk::prelude::GtkWindowExt::focus(&grid.window)
.and_downcast::<gtk::Button>()
.is_some_and(|button| button.icon_name().as_deref() == Some(crate::ui::icons::EDIT_COPY))
};

keys.press(gdk::Key::Tab, gdk::ModifierType::empty()).expect("Tab");
wait_until(WAIT, || crate::ui::a11y::holds_focus(&list)).expect("Tab to the list");
keys.press(gdk::Key::Tab, gdk::ModifierType::empty()).expect("Tab");
wait_until(WAIT, on_copy).expect("Tab to the field's copy button");
keys.press(gdk::Key::Tab, gdk::ModifierType::empty()).expect("Tab");
wait_until(WAIT, || !crate::ui::a11y::holds_focus(&list)).expect("Tab out of the list");
}

#[gtk4::test]
fn every_control_in_the_pane_is_named() {
let (grid, pane) = opened(two_text_columns(), two_text_values());
Expand Down
4 changes: 4 additions & 0 deletions linux/data/resources/ui/row-detail-pane.ui
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@
<property name="min-content-height">120</property>
<property name="child">
<object class="GtkListView" id="field_list">
<!-- Each field has buttons of its own, so Tab
leaves the list after them, and the
arrows go from field to field. -->
<property name="tab-behavior">item</property>
<accessibility>
<property name="label" translatable="yes">Fields</property>
</accessibility>
Expand Down
Loading