Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for collections and requests #18

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions data/cartero.gresource.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/es/danirod/Cartero/">
<file alias="collection_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/collection_pane.ui</file>
<file alias="sidebar.ui" compressed="true" preprocess="xml-stripblanks">ui/sidebar.ui</file>
<file alias="sidebar_row.ui" compressed="true" preprocess="xml-stripblanks">ui/sidebar_row.ui</file>
<file alias="endpoint_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/endpoint_pane.ui</file>
<file alias="key_value_row.ui" compressed="true" preprocess="xml-stripblanks">ui/key_value_row.ui</file>
<file alias="key_value_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/key_value_pane.ui</file>
<file alias="new_collection_window.ui" compressed="true" preprocess="xml-stripblanks">ui/new_collection_window.ui</file>
<file alias="main_window.ui" compressed="true" preprocess="xml-stripblanks">ui/main_window.ui</file>
<file alias="response_headers.ui" compressed="true" preprocess="xml-stripblanks">ui/response_headers.ui</file>
<file alias="response_panel.ui" compressed="true" preprocess="xml-stripblanks">ui/response_panel.ui</file>
Expand Down
12 changes: 12 additions & 0 deletions data/es.danirod.Cartero.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,17 @@
<default>500</default>
<summary>The position of the split between two windows</summary>
</key>
<key name="open-collections" type="as">
<default>[]</default>
<summary>The collections that will be visible in the sidebar</summary>
</key>
<key name="last-directory-new-collection" type="ms">
<default>nothing</default>
<summary>The default directory to present when creating a new collection</summary>
</key>
<key name="last-directory-open-collection" type="ms">
<default>nothing</default>
<summary>The default directory to present when opening a new collection</summary>
</key>
</schema>
</schemalist>
4 changes: 4 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
subdir('icons')

blueprint_files = [
'ui/collection_pane.blp',
'ui/endpoint_pane.blp',
'ui/main_window.blp',
'ui/key_value_pane.blp',
'ui/key_value_row.blp',
'ui/response_headers.blp',
'ui/response_panel.blp',
'ui/new_collection_window.blp',
'ui/sidebar.blp',
'ui/sidebar_row.blp',
]

blueprint_targets = []
Expand Down
56 changes: 56 additions & 0 deletions data/ui/collection_pane.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2024 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;

template $CarteroCollectionPane: Gtk.Box {
orientation: vertical;

Box {
orientation: horizontal;
spacing: 10;

Entry collection_name {
placeholder-text: _("Collection name");
hexpand: true;
}

Button {
label: _("Save");
clicked => $on_save() swapped;

styles [
'suggested-action'
]
}
}

Notebook {
NotebookPage {
tab: Label {
label: _("Variables");
};

child: ScrolledWindow {
hexpand: true;
vexpand: true;

$CarteroKeyValuePane variables {}
};
}
}
}
90 changes: 38 additions & 52 deletions data/ui/main_window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -22,74 +22,60 @@ template $CarteroWindow: Adw.ApplicationWindow {
title: "Cartero";

[content]
Box {
orientation: vertical;

Adw.HeaderBar {
title-widget: Adw.WindowTitle window_title {
title: 'Cartero';
};

[start]
Box {
spacing: 5;

Adw.OverlaySplitView {
sidebar: Adw.ToolbarView {
[top]
Adw.HeaderBar {
title-widget: Adw.WindowTitle window_title {
title: 'Cartero';
};

[start]
Button {
action-name: "win.new";
icon-name: 'tab-new-symbolic';
tooltip-text: _("New");
action-name: "win.new-collection";
icon-name: "tab-new-symbolic";
tooltip-text: _("New collection");
}

Separator {}

Button open_dialog {
styles [
"flat"
]

action-name: "win.open";
tooltip-text: _("Open");
[end]
MenuButton {
icon-name: "open-menu-symbolic";
primary: true;
menu-model: main_menu;
}
}

[child]
Box {
spacing: 5;
$CarteroSidebar collections {}
};

Image {
icon-name: 'document-open-symbolic';
}
content: Adw.ToolbarView {
[top]
Gtk.Box {
orientation: vertical;

Label {
label: _("Open");
}
}
Adw.HeaderBar {
[title]
Label main_label {}
}

Button save_dialog {
action-name: "win.save";
icon-name: 'document-save-symbolic';
tooltip-text: _("Save");
Adw.TabBar tabs {
view: tabview;
}
}

[end]
MenuButton {
icon-name: "open-menu-symbolic";
primary: true;
menu-model: main_menu;
Adw.ToastOverlay toaster {
Adw.TabView tabview {}
}
}

Adw.TabBar tabs {
view: tabview;
}

Adw.ToastOverlay toaster {
Adw.TabView tabview {}
}
};
}
}

menu main_menu {
item {
label: _("Open collection...");
action: "win.open-collection";
}

section {
submenu {
label: _("Body appearance");
Expand Down
118 changes: 118 additions & 0 deletions data/ui/new_collection_window.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Copyright 2024 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 $CarteroNewCollectionWindow: Adw.Dialog {
width-request: 640;
title: _("Create Collection");

Adw.ToolbarView {
[top]
Adw.HeaderBar {}

Adw.Clamp {
margin-top: 30;
margin-bottom: 30;
maximum-size: 500;

Box {
orientation: vertical;
spacing: 20;

ListBox {
selection-mode: none;

styles [
"boxed-list",
]

Adw.EntryRow collection_location {
title: _("Location");
changed => $on_collection_location_changed() swapped;

[suffix]
Button {
styles [
"flat"
]

valign: center;
icon-name: "folder-symbolic";
clicked => $on_location_clicked() swapped;
}
}

Adw.EntryRow collection_name {
title: _("Collection name");
changed => $on_collection_name_changed() swapped;

[suffix]
Image parent_directory_does_not_exist {
visible: false;
margin-start: 9;
margin-end: 9;
icon-name: "dialog-error-symbolic";
tooltip-text: "The collection location does not exist";
}

[suffix]
Image file_taken {
visible: false;
margin-start: 9;
margin-end: 9;
icon-name: "dialog-error-symbolic";
tooltip-text: "The given collection is not valid";
}
}
}

Label {
styles [
"dim-label"
]

wrap: true;
label: _("A folder will be created in the given location with the requested name to store the requests and subfolders you add to this collection.");
}

Box {
orientation: horizontal;
halign: end;

Button create_button {
styles [
"suggested-action"
]

label: _("Create");
halign: end;
hexpand: false;
clicked => $on_create_collection() swapped;
}
}
}
}
}
}

FileDialog file_dialog {
accept-label: _("Select");
title: _("Collection location");
modal: true;
}
43 changes: 43 additions & 0 deletions data/ui/sidebar.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2024 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 $CarteroSidebar: Adw.Bin {
Gtk.ListView list_view {
styles [
'navigation-sidebar'
]

model: selection_model;

factory: Gtk.SignalListItemFactory {
setup => $on_factory_setup();
bind => $on_factory_bind();
unbind => $on_factory_unbind();
teardown => $on_factory_teardown();
};

activate => $on_activate();
}
}

Gtk.SingleSelection selection_model {
can-unselect: false;
autoselect: false;
}
Loading