Skip to content

SidebarSystem migration: SC panel — GTK backend + cleanup #340

Description

@JDonaghy

Summary

Wire the GTK backend to use the SC panel's SidebarSystem (engine layer on #321, TUI on #339), then remove dead code.

What changes

Rendering (gtk/draw.rs)

Replace source_control_to_tree_view() + draw_tree() with populate_sc_sidebar_system() + sidebar.render().

Event routing (gtk/mod.rs)

  • Key routing (~line 5566): Replace handle_sc_key() with dispatch_sc_sidebar_key_unified().
  • Click (~line 9012): Keep header/commit/button hit zones. Replace the ~60-line section accumulator walk with handle_sc_sidebar_ui_event().
  • Wire wire_da_events for the SC DrawingArea → Msg::ScSidebarEvent(UiEvent).

Cleanup (after both backends wired)

  • Remove sc_selected, sc_sections_expanded, sc_has_focus from Engine.
  • Remove sc_flat_len(), sc_flat_to_section_idx(), sc_visual_row_to_flat().
  • Remove source_control_to_tree_view() from render.rs.
  • Slim SourceControlData — remove sections_expanded, selected, has_focus.
  • Update accessors.rs (sidebar_has_focus/clear_sidebar_focus), keys.rs (line 217 gate).
  • Remove all #[allow(dead_code)] from the new SidebarSystem methods.
  • Gate win-gui references behind #[cfg(feature = "win-gui")].
  • Update SC tests to use SidebarSystem state.

Key files

  • src/gtk/draw.rs, src/gtk/mod.rs — GTK rendering + events
  • src/core/engine/mod.rs — remove old fields
  • src/core/engine/source_control.rs — remove old helpers
  • src/core/engine/accessors.rs, keys.rs, buffers.rs, ext_panel.rs — update refs
  • src/render.rs — remove source_control_to_tree_view
  • src/core/engine/tests.rs — update SC tests

Prereqs

Testing

  • cargo test --no-default-features — all tests pass
  • cargo clippy -- -D warnings — clean (no dead_code allows remain)
  • Smoke test GTK: same interactions as TUI, plus mouse hover on buttons, double-click, scrollbar drag

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinfrastructureBuild, CI, distributionuiUI/rendering

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions