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.
This commit is contained in:
parent
357204b81c
commit
eddaf21a02
@ -74,15 +74,17 @@
|
|||||||
|
|
||||||
<!-- Split View: Request (left) | Response (right) -->
|
<!-- Split View: Request (left) | Response (right) -->
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwOverlaySplitView" id="split_view">
|
<object class="GtkPaned" id="split_pane">
|
||||||
<property name="vexpand">True</property>
|
<property name="vexpand">True</property>
|
||||||
<property name="sidebar-position">start</property>
|
<property name="orientation">horizontal</property>
|
||||||
<property name="show-sidebar">True</property>
|
<property name="position">600</property>
|
||||||
<property name="min-sidebar-width">300</property>
|
<property name="shrink-start-child">False</property>
|
||||||
<property name="max-sidebar-width">600</property>
|
<property name="shrink-end-child">False</property>
|
||||||
|
<property name="resize-start-child">True</property>
|
||||||
|
<property name="resize-end-child">True</property>
|
||||||
|
|
||||||
<!-- LEFT SIDEBAR: Request Configuration -->
|
<!-- LEFT: Request Configuration -->
|
||||||
<property name="sidebar">
|
<property name="start-child">
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
|
||||||
@ -96,8 +98,8 @@
|
|||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- RIGHT CONTENT: Response Display -->
|
<!-- RIGHT: Response Display -->
|
||||||
<property name="content">
|
<property name="end-child">
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,9 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
url_entry = Gtk.Template.Child()
|
url_entry = Gtk.Template.Child()
|
||||||
send_button = Gtk.Template.Child()
|
send_button = Gtk.Template.Child()
|
||||||
|
|
||||||
|
# Split pane
|
||||||
|
split_pane = Gtk.Template.Child()
|
||||||
|
|
||||||
# Containers for tabs
|
# Containers for tabs
|
||||||
request_tabs_container = Gtk.Template.Child()
|
request_tabs_container = Gtk.Template.Child()
|
||||||
response_tabs_container = Gtk.Template.Child()
|
response_tabs_container = Gtk.Template.Child()
|
||||||
@ -68,6 +71,22 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
# Add initial header row
|
# Add initial header row
|
||||||
self._add_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):
|
def _create_actions(self):
|
||||||
"""Create window-level actions."""
|
"""Create window-level actions."""
|
||||||
action = Gio.SimpleAction.new("toggle-history", None)
|
action = Gio.SimpleAction.new("toggle-history", None)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user