From 2943298a6e9532251247f26064422a343c4c7adf Mon Sep 17 00:00:00 2001 From: vesp Date: Thu, 18 Dec 2025 12:38:07 +0100 Subject: [PATCH] Make Request and Response sections equal width Replaces AdwOverlaySplitView with GtkPaned to allow both sections to have equal width by default. The divider automatically centers at 50/50 split when the window is first shown, while still allowing users to adjust it as needed. --- src/main-window.ui | 20 +++++++++++--------- src/window.py | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/main-window.ui b/src/main-window.ui index b0e1e15..58a170e 100644 --- a/src/main-window.ui +++ b/src/main-window.ui @@ -74,15 +74,17 @@ - + True - start - True - 300 - 600 + horizontal + 600 + False + False + True + True - - + + vertical @@ -96,8 +98,8 @@ - - + + vertical diff --git a/src/window.py b/src/window.py index ccd59d0..20df2bb 100644 --- a/src/window.py +++ b/src/window.py @@ -36,6 +36,9 @@ class RosterWindow(Adw.ApplicationWindow): url_entry = Gtk.Template.Child() send_button = Gtk.Template.Child() + # Split pane + split_pane = Gtk.Template.Child() + # Containers for tabs request_tabs_container = Gtk.Template.Child() response_tabs_container = Gtk.Template.Child() @@ -68,6 +71,22 @@ class RosterWindow(Adw.ApplicationWindow): # Add initial header row self._add_header_row() + # Set split pane position to center after window is shown + self.connect("map", self._on_window_mapped) + + def _on_window_mapped(self, widget): + """Set split pane position to center when window is mapped.""" + # Use idle_add to ensure the widget is fully allocated + GLib.idle_add(self._center_split_pane) + + def _center_split_pane(self): + """Center the split pane divider.""" + # Get the allocated width of the paned widget + allocation = self.split_pane.get_allocation() + if allocation.width > 0: + self.split_pane.set_position(allocation.width // 2) + return False # Don't repeat + def _create_actions(self): """Create window-level actions.""" action = Gio.SimpleAction.new("toggle-history", None)