Replace collapsible history panel with resizable vertical pane

This commit is contained in:
vesp 2025-12-18 16:58:43 +01:00
parent df100319f4
commit f2b35b79d6
2 changed files with 19 additions and 68 deletions

View File

@ -72,10 +72,21 @@
</object> </object>
</child> </child>
<!-- 3-Column Layout: Sidebar | Request | Response --> <!-- Vertical Paned: Main Content | History Panel -->
<child> <child>
<object class="GtkPaned" id="main_pane"> <object class="GtkPaned" id="vertical_pane">
<property name="orientation">vertical</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="position">600</property>
<property name="shrink-start-child">False</property>
<property name="shrink-end-child">True</property>
<property name="resize-start-child">True</property>
<property name="resize-end-child">True</property>
<!-- START: Main Content Area -->
<property name="start-child">
<!-- 3-Column Layout: Sidebar | Request | Response -->
<object class="GtkPaned" id="main_pane">
<property name="orientation">horizontal</property> <property name="orientation">horizontal</property>
<property name="position">250</property> <property name="position">250</property>
<property name="shrink-start-child">False</property> <property name="shrink-start-child">False</property>
@ -220,15 +231,6 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
</object> </object>
</child> </child>
<!-- History Toggle Button -->
<child>
<object class="GtkToggleButton" id="history_toggle_button">
<property name="icon-name">view-list-symbolic</property>
<property name="tooltip-text">Toggle History Panel</property>
<signal name="toggled" handler="on_history_toggle_button_toggled"/>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -236,18 +238,12 @@
</object> </object>
</property> </property>
</object> </object>
</child> </property>
<!-- History Panel (Collapsible) --> <!-- END: History Panel -->
<child> <property name="end-child">
<object class="GtkRevealer" id="history_revealer">
<property name="reveal-child">False</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="height-request">200</property>
<!-- History Header --> <!-- History Header -->
<child> <child>
@ -268,14 +264,6 @@
</style> </style>
</object> </object>
</child> </child>
<child>
<object class="GtkButton" id="hide_history_button">
<property name="icon-name">go-down-symbolic</property>
<property name="tooltip-text">Hide history</property>
<signal name="clicked" handler="on_toggle_history"/>
</object>
</child>
</object> </object>
</child> </child>
@ -283,6 +271,7 @@
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="min-content-height">150</property>
<child> <child>
<object class="GtkListBox" id="history_listbox"> <object class="GtkListBox" id="history_listbox">
@ -294,7 +283,7 @@
</object> </object>
</child> </child>
</object> </object>
</child> </property>
</object> </object>
</child> </child>
</object> </object>
@ -304,12 +293,6 @@
</template> </template>
<menu id="primary_menu"> <menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">Toggle History</attribute>
<attribute name="action">win.toggle-history</attribute>
</item>
</section>
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">_Preferences</attribute> <attribute name="label" translatable="yes">_Preferences</attribute>

View File

@ -55,12 +55,9 @@ class RosterWindow(Adw.ApplicationWindow):
# Status bar # Status bar
status_label = Gtk.Template.Child() status_label = Gtk.Template.Child()
time_label = Gtk.Template.Child() time_label = Gtk.Template.Child()
history_toggle_button = Gtk.Template.Child()
# History # History
history_revealer = Gtk.Template.Child()
history_listbox = Gtk.Template.Child() history_listbox = Gtk.Template.Child()
hide_history_button = Gtk.Template.Child()
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
@ -100,9 +97,7 @@ class RosterWindow(Adw.ApplicationWindow):
def _create_actions(self): def _create_actions(self):
"""Create window-level actions.""" """Create window-level actions."""
action = Gio.SimpleAction.new("toggle-history", None) pass
action.connect("activate", self.on_toggle_history)
self.add_action(action)
def _setup_method_dropdown(self): def _setup_method_dropdown(self):
"""Populate HTTP method dropdown.""" """Populate HTTP method dropdown."""
@ -409,33 +404,6 @@ class RosterWindow(Adw.ApplicationWindow):
self._show_toast("Request loaded from history") self._show_toast("Request loaded from history")
@Gtk.Template.Callback()
def on_toggle_history(self, *args):
"""Toggle history panel visibility (from menu)."""
current = self.history_revealer.get_reveal_child()
self.history_revealer.set_reveal_child(not current)
# Update toggle button state
self.history_toggle_button.set_active(not current)
# Update hide button icon
if not current:
self.hide_history_button.set_icon_name("go-down-symbolic")
else:
self.hide_history_button.set_icon_name("go-up-symbolic")
@Gtk.Template.Callback()
def on_history_toggle_button_toggled(self, button):
"""Toggle history panel from bottom button."""
active = button.get_active()
self.history_revealer.set_reveal_child(active)
# Update hide button icon
if active:
self.hide_history_button.set_icon_name("go-down-symbolic")
else:
self.hide_history_button.set_icon_name("go-up-symbolic")
def _show_toast(self, message): def _show_toast(self, message):
"""Show a toast notification.""" """Show a toast notification."""
toast = Adw.Toast() toast = Adw.Toast()