Skip to content

Commit 9b7a68b

Browse files
authored
Make Settings a NavigationSplitView window (#267)
The settings window used to be an AdwPreferenceDialog; now it's a standard AdwWindow that presents a NavigationSplitView. Reasons: 1. It has to happen anyway in order to move to multiple windows (#258, #266). The new window actually uses the proposed system: there is a Shell and it gets added to an anonymous window. 2. More options will be added soon, so more space will be needed anyway (#190, #136, #265, #268). I don't feel comfortable adding more PreferencePages, so there's that.
1 parent 8977c99 commit 9b7a68b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3304
-1976
lines changed

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ path = [
8181
"data/icons/scalable/actions/share-symbolic.svg",
8282
"data/icons/scalable/actions/tab-new-symbolic.svg",
8383
"data/icons/scalable/emblems/eye-not-looking-symbolic.svg",
84+
"data/icons/scalable/emblems/code-symbolic.svg",
8485
"website/assets/adwaita-icons/branch-symbolic.svg",
8586
"website/assets/adwaita-icons/bug-symbolic.svg",
8687
"website/assets/adwaita-icons/bug-symbolic.svg",

data/cartero.gresource.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,23 @@
2424
<file alias="response_headers.ui" compressed="true" preprocess="xml-stripblanks">ui/response_headers.ui</file>
2525
<file alias="response_panel.ui" compressed="true" preprocess="xml-stripblanks">ui/response_panel.ui</file>
2626
<file alias="search_box.ui" compressed="true" preprocess="xml-stripblanks">ui/search_box.ui</file>
27-
<file alias="settings_dialog.ui" compressed="true" preprocess="xml-stripblanks">ui/settings_dialog.ui</file>
2827
<file alias="urlencoded_body_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/urlencoded_body_pane.ui</file>
2928
<file alias="multipart_body_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/multipart_body_pane.ui</file>
3029
<file alias="raw_body_pane.ui" compressed="true" preprocess="xml-stripblanks">ui/raw_body_pane.ui</file>
30+
<file alias="settings/pill.ui" compressed="true" preprocess="xml-stripblanks">ui/settings/pill.ui</file>
31+
<file alias="settings/shell.ui" compressed="true" preprocess="xml-stripblanks">ui/settings/shell.ui</file>
32+
<file alias="settings/page_application.ui" compressed="true" preprocess="xml-stripblanks">ui/settings/page_application.ui</file>
33+
<file alias="settings/page_appearance.ui" compressed="true" preprocess="xml-stripblanks">ui/settings/page_appearance.ui</file>
34+
<file alias="settings/page_code_editor.ui" compressed="true" preprocess="xml-stripblanks">ui/settings/page_code_editor.ui</file>
35+
<file alias="settings/page_http_client.ui" compressed="true" preprocess="xml-stripblanks">ui/settings/page_http_client.ui</file>
3136
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/horizontal-arrows-symbolic.svg</file>
3237
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/tab-new-symbolic.svg</file>
3338
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/share-symbolic.svg</file>
3439
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/encode-symbolic.svg</file>
3540
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/apps/es.danirod.Cartero.Devel.svg</file>
3641
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/apps/es.danirod.Cartero.svg</file>
3742
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/emblems/eye-not-looking-symbolic.svg</file>
43+
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/emblems/code-symbolic.svg</file>
3844
<file compressed="true" preprocess="xml-stripblanks">icons/symbolic/apps/es.danirod.Cartero-symbolic.svg</file>
3945
</gresource>
4046
</gresources>
Lines changed: 2 additions & 0 deletions
Loading

data/meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ blueprint_files = [
3838
'ui/response_headers.blp',
3939
'ui/response_panel.blp',
4040
'ui/search_box.blp',
41-
'ui/settings_dialog.blp',
4241
'ui/raw_body_pane.blp',
4342
'ui/multipart_body_pane.blp',
4443
'ui/urlencoded_body_pane.blp',
44+
'ui/settings/pill.blp',
45+
'ui/settings/shell.blp',
46+
'ui/settings/page_application.blp',
47+
'ui/settings/page_appearance.blp',
48+
'ui/settings/page_code_editor.blp',
49+
'ui/settings/page_http_client.blp',
4550
]
4651

4752
blueprint_targets = []

data/ui/main_window.blp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -218,63 +218,6 @@ menu main_menu {
218218
label: _("Settings");
219219
action: "app.preferences";
220220
}
221-
222-
submenu {
223-
label: _("Body appearance");
224-
225-
section {
226-
item {
227-
label: _("Wrap content");
228-
action: "win.body-wrap";
229-
}
230-
231-
item {
232-
label: _("Show line numbers");
233-
action: "win.show-line-numbers";
234-
}
235-
}
236-
237-
section {
238-
item {
239-
label: _("Automatic indentation");
240-
action: "win.auto-indent";
241-
}
242-
243-
item {
244-
label: _("Indent with spaces");
245-
action: "win.indent-style";
246-
target: "spaces";
247-
}
248-
249-
item {
250-
label: _("Indent with tabs");
251-
action: "win.indent-style";
252-
target: "tabs";
253-
}
254-
255-
submenu {
256-
label: _("Spaces per tab");
257-
258-
item {
259-
label: _("2");
260-
action: "win.tab-width";
261-
target: "2";
262-
}
263-
264-
item {
265-
label: _("4");
266-
action: "win.tab-width";
267-
target: "4";
268-
}
269-
270-
item {
271-
label: _("8");
272-
action: "win.tab-width";
273-
target: "8";
274-
}
275-
}
276-
}
277-
}
278221
}
279222

280223
section {

data/ui/main_window_no_csd.blp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -220,63 +220,6 @@ menu main_menu {
220220
label: _("Settings");
221221
action: "app.preferences";
222222
}
223-
224-
submenu {
225-
label: _("Body appearance");
226-
227-
section {
228-
item {
229-
label: _("Wrap content");
230-
action: "win.body-wrap";
231-
}
232-
233-
item {
234-
label: _("Show line numbers");
235-
action: "win.show-line-numbers";
236-
}
237-
}
238-
239-
section {
240-
item {
241-
label: _("Automatic indentation");
242-
action: "win.auto-indent";
243-
}
244-
245-
item {
246-
label: _("Indent with spaces");
247-
action: "win.indent-style";
248-
target: "spaces";
249-
}
250-
251-
item {
252-
label: _("Indent with tabs");
253-
action: "win.indent-style";
254-
target: "tabs";
255-
}
256-
257-
submenu {
258-
label: _("Spaces per tab");
259-
260-
item {
261-
label: _("2");
262-
action: "win.tab-width";
263-
target: "2";
264-
}
265-
266-
item {
267-
label: _("4");
268-
action: "win.tab-width";
269-
target: "4";
270-
}
271-
272-
item {
273-
label: _("8");
274-
action: "win.tab-width";
275-
target: "8";
276-
}
277-
}
278-
}
279-
}
280223
}
281224

282225
section {
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2024-2025 the Cartero authors
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// This program is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
//
16+
// SPDX-License-Identifier: GPL-3.0-or-later
17+
using Gtk 4.0;
18+
using Adw 1;
19+
20+
template $CarteroSettingsPageAppearance: Adw.PreferencesPage {
21+
name: "appearance";
22+
title: _("Appearance");
23+
icon-name: "preferences-desktop-appearance-symbolic";
24+
25+
Adw.PreferencesGroup {
26+
Adw.ComboRow option_theme {
27+
title: _("Application style");
28+
29+
model: Gtk.StringList {
30+
strings [
31+
_("Follow system settings"),
32+
_("Light mode"),
33+
_("Dark mode"),
34+
]
35+
};
36+
}
37+
}
38+
39+
Adw.PreferencesGroup {
40+
Adw.SwitchRow option_use_system_font {
41+
title: _("Use system font");
42+
}
43+
44+
Adw.ActionRow {
45+
title: _("Custom font");
46+
47+
Gtk.FontDialogButton option_custom_font {
48+
styles [
49+
"flat",
50+
]
51+
52+
tooltip-text: _("Click to select a font");
53+
dialog: font_dialog;
54+
vexpand: false;
55+
valign: center;
56+
}
57+
}
58+
}
59+
}
60+
61+
Gtk.FontDialog font_dialog {}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright 2024-2025 the Cartero authors
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// This program is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
//
16+
// SPDX-License-Identifier: GPL-3.0-or-later
17+
using Gtk 4.0;
18+
using Adw 1;
19+
20+
template $CarteroSettingsPageApplication: Adw.PreferencesPage {
21+
name: "application";
22+
title: _("Application");
23+
icon-name: "applications-system-symbolic";
24+
25+
Adw.PreferencesGroup {
26+
title: _("Language");
27+
28+
Adw.ComboRow option_locale {
29+
styles [
30+
"property",
31+
]
32+
33+
title: _("Language");
34+
use-subtitle: true;
35+
}
36+
37+
Gtk.Revealer locale_changed {
38+
transition-type: slide_down;
39+
40+
Gtk.Label {
41+
margin-top: 12;
42+
justify: center;
43+
label: _("You need to restart the program for the new locale to be used.");
44+
wrap: true;
45+
}
46+
}
47+
}
48+
49+
Adw.PreferencesGroup {
50+
title: _("File settings");
51+
52+
Adw.SwitchRow option_create_backups {
53+
title: _("Create backup files");
54+
subtitle: _("You might not want to enable this if you are already using a version control such as Git");
55+
}
56+
}
57+
58+
Adw.PreferencesGroup group_updates {
59+
visible: false;
60+
title: _("Software updates");
61+
62+
Adw.ActionRow version_id {
63+
styles [
64+
"property",
65+
]
66+
67+
title: _("Current version");
68+
subtitle-selectable: true;
69+
70+
Gtk.Button {
71+
valign: center;
72+
label: _("Check for updates");
73+
action-name: "app.check-updates";
74+
}
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)