Replace collapsible history panel with resizable vertical pane
This commit is contained in:
parent
df100319f4
commit
f2b35b79d6
@ -72,10 +72,21 @@
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<!-- 3-Column Layout: Sidebar | Request | Response -->
|
||||
<!-- Vertical Paned: Main Content | History Panel -->
|
||||
<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="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="position">250</property>
|
||||
<property name="shrink-start-child">False</property>
|
||||
@ -220,15 +231,6 @@
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
</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>
|
||||
</child>
|
||||
</object>
|
||||
@ -236,18 +238,12 @@
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</property>
|
||||
|
||||
<!-- History Panel (Collapsible) -->
|
||||
<child>
|
||||
<object class="GtkRevealer" id="history_revealer">
|
||||
<property name="reveal-child">False</property>
|
||||
<property name="transition-type">slide-up</property>
|
||||
|
||||
<child>
|
||||
<!-- END: History Panel -->
|
||||
<property name="end-child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="height-request">200</property>
|
||||
|
||||
<!-- History Header -->
|
||||
<child>
|
||||
@ -268,14 +264,6 @@
|
||||
</style>
|
||||
</object>
|
||||
</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>
|
||||
</child>
|
||||
|
||||
@ -283,6 +271,7 @@
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="vexpand">True</property>
|
||||
<property name="min-content-height">150</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBox" id="history_listbox">
|
||||
@ -294,7 +283,7 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -304,12 +293,6 @@
|
||||
</template>
|
||||
|
||||
<menu id="primary_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Toggle History</attribute>
|
||||
<attribute name="action">win.toggle-history</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
|
||||
@ -55,12 +55,9 @@ class RosterWindow(Adw.ApplicationWindow):
|
||||
# Status bar
|
||||
status_label = Gtk.Template.Child()
|
||||
time_label = Gtk.Template.Child()
|
||||
history_toggle_button = Gtk.Template.Child()
|
||||
|
||||
# History
|
||||
history_revealer = Gtk.Template.Child()
|
||||
history_listbox = Gtk.Template.Child()
|
||||
hide_history_button = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
@ -100,9 +97,7 @@ class RosterWindow(Adw.ApplicationWindow):
|
||||
|
||||
def _create_actions(self):
|
||||
"""Create window-level actions."""
|
||||
action = Gio.SimpleAction.new("toggle-history", None)
|
||||
action.connect("activate", self.on_toggle_history)
|
||||
self.add_action(action)
|
||||
pass
|
||||
|
||||
def _setup_method_dropdown(self):
|
||||
"""Populate HTTP method dropdown."""
|
||||
@ -409,33 +404,6 @@ class RosterWindow(Adw.ApplicationWindow):
|
||||
|
||||
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):
|
||||
"""Show a toast notification."""
|
||||
toast = Adw.Toast()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user