Skip to content

refactor(linux-grid): rebuild the data grid as one native grid for every surface - #3836

Open
datlechin wants to merge 2 commits into
mainfrom
refactor/linux-grid-rewrite
Open

datlechin wants to merge 2 commits into
mainfrom
refactor/linux-grid-rewrite

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • One DataGrid widget (ui/data_grid) replaces ui/grid on every surface: table tabs, SQL results and key tabs. It owns selection, keys, menus, editing, copy, find and the column layout, through one grid action group, so a key, its menu item and a host's button share one enabled state.
  • Pure rules move to services::grid (column, display text, editability, edit parsing, policy, copy scope, layout, find, filter rules), tested without GTK.
  • Rows live in stable slots (GridStore, GridRow with a generation), so a reload rewrites data in place instead of rebuilding every cell widget. Anything that acts later (menu, editor, copy, paste, delete question) holds a PinnedRow.
  • A row number column carries each row's pending icon and accessible description; changed values are bold in Adwaita's warning colour and deleted rows struck through. The row tints, the error flash and its timer are gone: a failed save marks its row until it is edited or saved again.
  • Row Details pane (AdwOverlaySplitView, Alt+Return) with every field of the focused row and an editor for long text, JSON, XML and dates; the popover editors are gone.
  • Inline editing: F2, Return, a double click or typing on a cell (dead keys and Compose included); a refused value stays in the editor with its reason; Tab moves to the next editable cell. A click focuses the cell under it (GTK gives a column view cell no click of its own) and a right click the row it is on, so Row Details and the keys act on what was clicked.
  • Columns open wide enough for their longest sampled value, measured with Pango. Drag to reorder, hide and show (header menu, cell menu, Columns dialog), sizes per column type; order, hidden columns and widths are kept per table in the column layout file, now version 2 (a version 1 file of widths upgrades on read). A save writes only what that grid changed, so two tabs on one table keep each other's changes.
  • Find in SQL results and key tabs (Ctrl+F, Ctrl+G); Ctrl+F stays Filter in table tabs. Filter by Value and Exclude Value add a rule to the table tab's filter strip.
  • Copy (Ctrl+C everywhere): the focused cell's value for one row, the rows otherwise; Copy As, export, Show Row as JSON and the INSERT copy take the columns on screen in their order.
  • Fixed: Ctrl+C did nothing in SQL results and key tabs (D2); Insert Row and Duplicate in the menu of a keyless table saved rows with no key (D1); Ctrl+S skipped the value being typed (D5); a row marked for deletion took edits that were never saved (D8); MongoDB fields with . or a leading $ could be sorted and edited and then failed at the server (D4); the selection count offered Delete where it did nothing (D12); booleans drew three ways and made rows taller (D9, D10); tint gaps (D11) and the flash on a dragged column (D13) went with the tints.
  • platform-linux.md (fix-issue): dark and light shots take ADW_DEBUG_COLOR_SCHEME=prefer-dark or prefer-light; libadwaita ignores force-dark.
  • ADR 0027 records the grid; ARCHITECTURE.md, docs/storage.md, docs/testing.md and docs/regression-tests.md follow.
  • Tests changed on purpose: rejected_edit_restores_cell_display (a refused value now stays in the editor), the popover editor tests (editors moved to the pane), the check button tests (booleans are text), menu_item_shows_local_and_component_keys (Copy now shows Ctrl+C), the tint and flash tests, page_rows_have_single_owner (the slot keeps a reference), the page-turn store change (slots are reused), kill_during_save (opens the editor with grid.edit; the per-cell double-click gesture is gone).

Test plan

  • verify.sh --platform linux test tablepro in the CI image: 2411 passed, 0 failed, every integration binary included; mouse clicks and double clicks driven through XTEST.
  • New: 102 core grid tests, the edit controller, copy and references, row detail pane, find, column chooser and layout store tests; host tests for the table tab, SQL results and key tab; F-004 and F-005 guards kept.
  • clippy with and without default features, rustfmt, POTFILES.
Before After
Table before Table after
Editor before Editor after

Table after, dark

Row Details on the clicked cell

Needs the maintainer

  • Retake linux/data/screenshots/01-table.png and 02-editor.png on a GNOME desktop (README, Screenshots): the window shadow and rounded corners take a compositing window manager with _GTK_FRAME_EXTENTS, which the CI image under Xvfb does not have.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant