Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/cartero.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<file alias="urlencoded_body_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/urlencoded_body_pane.ui</file>
<file alias="multipart_body_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/multipart_body_pane.ui</file>
<file alias="raw_body_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/raw_body_pane.ui</file>
<file alias="standalone/shell.ui" compressed="true" preprocess="xml-stripblanks">ui/standalone/shell.ui</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/horizontal-arrows-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/tab-new-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/share-symbolic.svg</file>
Expand Down
1 change: 1 addition & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ blueprint_files = [
'ui/raw_body_pane.blp',
'ui/multipart_body_pane.blp',
'ui/urlencoded_body_pane.blp',
'ui/standalone/shell.blp',
]

blueprint_targets = []
Expand Down
188 changes: 188 additions & 0 deletions data/ui/standalone/shell.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
// Copyright 2024-2025 the Cartero authors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-3.0-or-later
using Gtk 4.0;
using Adw 1;

template $CarteroStandaloneShell: Adw.BreakpointBin {
width-request: 100;
height-request: 100;

Adw.Breakpoint {
condition ("max-width: 500sp")

setters {
header_bar_start.visible: false;
}
}

Adw.ToolbarView {
top-bar-style: raised;

[top]
// An ID is assigned so that I can set the use-native-controls property
// dynamically when Adw is 1.8 or greater. This has to be done in code
// to keep the template compiling for Adw 1.5.
Adw.HeaderBar header_bar {
title-widget: window_title;

[start]
Gtk.Box header_bar_start {
spacing: 5;
orientation: horizontal;

Button {
action-name: "win.new-endpoint";
icon-name: "tab-new-symbolic";
tooltip-text: _("New");
}

Button {
action-name: "win.open-tab";
tooltip-text: _("Open");

Adw.ButtonContent {
icon-name: "document-open-symbolic";
label: _("Open");
}
}

Button {
action-name: "win.save-tab";
icon-name: "document-save-symbolic";
tooltip-text: _("Save");
}
}

[end]
Gtk.Box {
spacing: 5;
orientation: horizontal;

MenuButton export_request {
tooltip-text: _("Export request");
icon-name: "share-symbolic";
menu-model: export_request_menu;
}

MenuButton {
tooltip-text: _("Menu");
icon-name: "open-menu-symbolic";
primary: true;
menu-model: main_menu;
}
}
}

[top]
Adw.TabBar {
view: tabview;
}

Adw.TabView tabview {
notify::selected-page => $on_page_change() swapped;
create-window => $on_window_create_request();
}
}
}

// The title widget is detached so that it can be added or removed from the
// HeaderBar when no tab is attached to the TabView, in order to let the
// AdwHeaderBar present the default window title.
Adw.WindowTitle window_title {}

menu export_request_menu {
section {
item {
label: _("Export request as cURL…");
action: "win.export-request";
target: "curl";
}

item {
label: _("Export request as Jetbrains HTTP…");
action: "win.export-request";
target: "jetbrains-http";
}
}

section {
item {
label: _("Export response body…");
action: "win.export-response-body";
}
}
}

menu main_menu {
section {
item {
label: _("New endpoint");
action: "win.new-endpoint";
}

item {
label: _("New window");
action: "app.new-window";
}
}

section {
item {
label: _("Open request…");
action: "win.open-tab";
}

item {
label: _("Save request");
action: "win.save-tab";
}

item {
label: _("Save request as…");
action: "win.save-tab-as";
}

item {
label: _("Close tab");
action: "win.close-tab";
}
}

section {
item {
label: _("Settings");
action: "app.preferences";
}
}

section {
item {
label: _("Keyboard shortcuts");
action: "win.show-help-overlay";
}

item {
label: _("About Cartero");
action: "win.about";
}

item {
label: _("Quit");
action: "app.quit";
}
}
}
Loading
Loading