mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-11-05 04:13:58 +00:00
5edbd1f96c
## Global description This improves UX by allowing users to close through dialogs by pressing Esc. I added mnemonics for the file picker, and set `save` as the default response. ## Changelog - Allow Esc shortcut to close dialogs - Add mnemonics for dialogs - Set `save` as default response Signed-off-by: 0xMRTT <0xMRTT@proton.me> Co-authored-by: tfuxu <73042332+tfuxu@users.noreply.github.com> Co-authored-by: 0xMRTT <0xMRTT@proton.me>
177 lines
4.8 KiB
Text
177 lines
4.8 KiB
Text
using Gtk 4.0;
|
|
using Adw 1;
|
|
|
|
template GradiencePresetWindow : Adw.Window {
|
|
title: _("Presets");
|
|
default-width: 700;
|
|
default-height: 550;
|
|
|
|
ShortcutController {
|
|
Shortcut {
|
|
trigger: "Escape";
|
|
action: "action(window.close)";
|
|
}
|
|
}
|
|
|
|
Adw.ToastOverlay toast_overlay {
|
|
Adw.Leaflet leaflet {
|
|
can-navigate-back: true;
|
|
can-unfold: false;
|
|
|
|
Gtk.Box main_view {
|
|
orientation: vertical;
|
|
|
|
Adw.HeaderBar titlebar {
|
|
centering-policy: strict;
|
|
|
|
Button import_button {
|
|
styles ["suggested-action"]
|
|
label: _("Import");
|
|
tooltip-text: _("Import a Preset File");
|
|
clicked => on_import_button_clicked();
|
|
}
|
|
|
|
Button remove_button {
|
|
styles ["danger"]
|
|
label: _("Delete");
|
|
visible: false;
|
|
}
|
|
|
|
[title]
|
|
Adw.ViewSwitcherTitle title {
|
|
stack: view_stack;
|
|
}
|
|
|
|
[end]
|
|
Button file_manager_button {
|
|
tooltip-text: _("Open in File Manager");
|
|
clicked => on_file_manager_button_clicked();
|
|
Adw.ButtonContent {
|
|
icon-name: "folder-symbolic";
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
Gtk.Box {
|
|
orientation: vertical;
|
|
|
|
Adw.ViewStack view_stack {
|
|
vexpand: true;
|
|
hexpand: true;
|
|
|
|
Adw.ViewStackPage {
|
|
name: "installed";
|
|
title: _("Installed");
|
|
icon-name: "larger-brush-symbolic";
|
|
|
|
child: Adw.PreferencesPage installed { };
|
|
|
|
}
|
|
|
|
Adw.ViewStackPage {
|
|
name: "explore";
|
|
title: _("Explore");
|
|
icon-name: "web-browser-symbolic";
|
|
|
|
child: Gtk.ScrolledWindow {
|
|
Adw.StatusPage {
|
|
title: _("Search for presets");
|
|
description: _("Enter a keyword to search on <a href=\"https://gradienceteam.github.io/presets\">GradienceTeam/Community</a>.");
|
|
valign: start;
|
|
Adw.Clamp {
|
|
styles ["clamp"]
|
|
|
|
Gtk.Box {
|
|
orientation: vertical;
|
|
|
|
Gtk.Box {
|
|
styles ["linked"]
|
|
|
|
Gtk.SearchEntry search_entry {
|
|
hexpand: true;
|
|
placeholder-text: _("e.g. \"Pretty Purple\"");
|
|
}
|
|
|
|
Gtk.DropDown search_dropdown {
|
|
model: StringList search_string_list {
|
|
strings [_("All")]
|
|
};
|
|
}
|
|
}
|
|
|
|
Gtk.Stack search_stack {
|
|
Gtk.StackPage {
|
|
name: "page_spinner";
|
|
child: Gtk.Spinner search_spinner {
|
|
valign: start;
|
|
halign: center;
|
|
spinning: true;
|
|
};
|
|
}
|
|
|
|
Gtk.StackPage {
|
|
name: "page_results";
|
|
child: Gtk.ListBox search_results {
|
|
styles ["boxed-list"]
|
|
valign: start;
|
|
selection-mode: none;
|
|
};
|
|
}
|
|
|
|
Gtk.StackPage {
|
|
name: "page_empty";
|
|
child: Adw.StatusPage {
|
|
icon-name: "system-search-symbolic";
|
|
title: _("No Results Found");
|
|
};
|
|
}
|
|
|
|
Gtk.StackPage {
|
|
name: "page_offline";
|
|
child: Adw.StatusPage {
|
|
icon-name: "network-wireless-offline-symbolic";
|
|
title: _("Offline");
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
Adw.ViewStackPage {
|
|
name: "repos";
|
|
title: _("Repositories");
|
|
icon-name: "folder-symbolic";
|
|
|
|
child: Adw.PreferencesPage repos { };
|
|
|
|
}
|
|
}
|
|
|
|
Adw.ViewSwitcherBar {
|
|
stack: view_stack;
|
|
reveal: bind title.title-visible;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Gtk.FileChooserNative import_file_chooser {
|
|
title: _("Import a Preset File (*.json)");
|
|
modal: true;
|
|
}
|
|
|
|
Gtk.FileFilter all_filter {
|
|
name: _("All files");
|
|
mime-types ["application/octet-stream"]
|
|
}
|
|
|
|
Gtk.FileFilter json_filter {
|
|
name: _("JSON file (*.json)");
|
|
mime-types ["application/json"]
|
|
}
|