roster/src/main-window.ui

272 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="Adw" version="1.0"/>
<menu id="sidebar_menu">
<section>
<item>
<attribute name="label">Add Project</attribute>
<attribute name="action">win.add-project</attribute>
</item>
</section>
<section>
<item>
<attribute name="label">Import from OpenAPI / Swagger</attribute>
<attribute name="action">win.import-openapi</attribute>
</item>
<item>
<attribute name="label">Import from WSDL</attribute>
<attribute name="action">win.import-wsdl</attribute>
</item>
<item>
<attribute name="label">Import from .http File</attribute>
<attribute name="action">win.import-http-file</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Roster</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<template class="RosterWindow" parent="AdwApplicationWindow">
<property name="default-width">1200</property>
<property name="default-height">800</property>
<property name="width-request">470</property>
<property name="content">
<object class="AdwToastOverlay" id="toast_overlay">
<property name="child">
<object class="AdwOverlaySplitView" id="split_view">
<property name="min-sidebar-width">200</property>
<property name="max-sidebar-width">320</property>
<!-- LEFT: Sidebar Panel with AdwToolbarView -->
<property name="sidebar">
<object class="AdwToolbarView">
<!-- Sidebar Header Bar -->
<child type="top">
<object class="AdwHeaderBar">
<property name="show-end-title-buttons">False</property>
<property name="show-start-title-buttons">False</property>
<property name="title-widget">
<object class="GtkLabel">
<property name="label">Projects</property>
<style>
<class name="title"/>
</style>
</object>
</property>
<child type="start">
<object class="GtkWindowControls">
<property name="side">start</property>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="sidebar_hamburger_button">
<property name="primary">True</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="tooltip-text">Menu</property>
<property name="menu-model">sidebar_menu</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object>
</child>
<!-- Sidebar Content -->
<property name="content">
<object class="GtkBox">
<property name="orientation">vertical</property>
<!-- Projects List -->
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">True</property>
<child>
<object class="GtkListBox" id="projects_listbox">
<style>
<class name="navigation-sidebar"/>
</style>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
<!-- RIGHT: Main Content Panel with AdwToolbarView -->
<property name="content">
<object class="AdwToolbarView">
<!-- Main Header Bar -->
<child type="top">
<object class="AdwHeaderBar">
<property name="show-title">False</property>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<!-- Sidebar toggle (only visible when collapsed) -->
<child type="start">
<object class="GtkToggleButton" id="sidebar_toggle_button">
<property name="icon-name">dock-left-symbolic</property>
<property name="tooltip-text">Show Sidebar</property>
<style>
<class name="flat"/>
</style>
<binding name="visible">
<lookup name="collapsed">split_view</lookup>
</binding>
</object>
</child>
<!-- Left side buttons -->
<child type="start">
<object class="GtkButton" id="save_request_button">
<property name="icon-name">document-save-symbolic</property>
<property name="tooltip-text">Save Current Request (Ctrl+S)</property>
<signal name="clicked" handler="on_save_request_clicked"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child type="start">
<object class="GtkButton" id="export_request_button">
<property name="icon-name">export-symbolic</property>
<property name="tooltip-text">Export as cURL</property>
<signal name="clicked" handler="on_export_request_clicked"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
<!-- Window controls: separate end child so it's always rightmost -->
<child type="end">
<object class="GtkWindowControls">
<property name="side">end</property>
</object>
</child>
<!-- Right side buttons -->
<child type="end">
<object class="GtkButton" id="new_request_button">
<property name="icon-name">list-add-symbolic</property>
<property name="tooltip-text">New Request (Ctrl+T)</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object>
</child>
<!-- Tab Bar as separate top bar -->
<child type="top">
<object class="AdwTabBar" id="tab_bar">
<property name="view">tab_view</property>
<property name="autohide">False</property>
<property name="expand-tabs">False</property>
</object>
</child>
<!-- Main Content: Vertical Paned with Tab View and History Panel -->
<property name="content">
<object class="GtkPaned">
<property name="orientation">vertical</property>
<property name="position">600</property>
<property name="shrink-start-child">False</property>
<!-- Don't allow history panel to shrink below its minimum size -->
<property name="shrink-end-child">False</property>
<property name="resize-start-child">True</property>
<property name="resize-end-child">True</property>
<!-- AdwTabView as main content area -->
<property name="start-child">
<object class="AdwTabView" id="tab_view">
<property name="vexpand">True</property>
</object>
</property>
<!-- History Panel -->
<property name="end-child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<!-- Set minimum height to ensure header is always visible -->
<property name="height-request">50</property>
<!-- History Header -->
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">6</property>
<child>
<object class="GtkLabel">
<property name="label">Request History</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
</object>
</child>
<!-- History List -->
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">True</property>
<property name="min-content-height">50</property>
<child>
<object class="GtkListBox" id="history_listbox">
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</property>
<!-- Collapse sidebar when window is narrow -->
<child>
<object class="AdwBreakpoint">
<condition>max-width: 700sp</condition>
<setter object="split_view" property="collapsed">True</setter>
</object>
</child>
</template>
</interface>