Merge pull request #174 from kra-mo/desktop-file-importer

Desktop file importer
This commit is contained in:
kramo
2023-08-25 21:53:26 +02:00
committed by GitHub
13 changed files with 574 additions and 218 deletions

View File

@@ -2,153 +2,159 @@ using Gtk 4.0;
using Adw 1;
template $DetailsWindow : Adw.Window {
default-width: 480; // Same as Nautilus' properties window
default-height: -1;
modal: true;
default-width: 480; // Same as Nautilus' properties window
default-height: -1;
modal: true;
ShortcutController {
Shortcut {
trigger: "Escape";
action: "action(window.close)";
}
ShortcutController {
Shortcut {
trigger: "Escape";
action: "action(window.close)";
}
}
Box {
orientation: vertical;
Adw.HeaderBar HeaderBar {
show-start-title-buttons: false;
show-end-title-buttons: false;
[start]
Button cancel_button {
label: _("Cancel");
action-name: "window.close";
}
[end]
Button apply_button {
styles [
"suggested-action",
]
}
}
Box {
orientation: vertical;
Adw.PreferencesPage {
vexpand: true;
Adw.HeaderBar HeaderBar {
show-start-title-buttons: false;
show-end-title-buttons: false;
Adw.PreferencesGroup cover_group {
Adw.Clamp cover_clamp {
maximum-size: 200;
[start]
Button cancel_button {
label: _("Cancel");
action-name: "window.close";
Overlay {
[overlay]
Spinner spinner {
margin-start: 72;
margin-end: 72;
}
[end]
Button apply_button {
Overlay cover_overlay {
halign: center;
valign: center;
[overlay]
Button cover_button_edit {
icon-name: "document-edit-symbolic";
tooltip-text: _("New Cover");
halign: end;
valign: end;
margin-bottom: 6;
margin-end: 6;
styles [
"suggested-action"
"circular",
"osd",
]
}
[overlay]
Revealer cover_button_delete_revealer {
transition-type: crossfade;
margin-end: 40;
Button cover_button_delete {
icon-name: "user-trash-symbolic";
tooltip-text: _("Delete Cover");
halign: end;
valign: end;
margin-bottom: 6;
margin-end: 6;
styles [
"circular",
"osd",
]
}
}
Picture cover {
width-request: 200;
height-request: 300;
styles [
"card",
]
}
}
}
}
}
Adw.PreferencesGroup {
Adw.EntryRow name {
title: _("Title");
}
Adw.PreferencesPage {
vexpand: true;
Adw.PreferencesGroup cover_group {
Adw.Clamp cover_clamp {
maximum-size: 200;
Overlay {
[overlay]
Spinner spinner {
margin-start: 72;
margin-end: 72;
}
Overlay cover_overlay {
halign: center;
valign: center;
[overlay]
Button cover_button_edit {
icon-name: "document-edit-symbolic";
tooltip-text: _("New Cover");
halign: end;
valign: end;
margin-bottom: 6;
margin-end: 6;
styles [
"circular", "osd"
]
}
[overlay]
Revealer cover_button_delete_revealer {
transition-type: crossfade;
margin-end: 40;
Button cover_button_delete {
icon-name: "user-trash-symbolic";
tooltip-text: _("Delete Cover");
halign: end;
valign: end;
margin-bottom: 6;
margin-end: 6;
styles [
"circular", "osd"
]
}
}
Picture cover {
width-request: 200;
height-request: 300;
styles [
"card"
]
}
}
}
}
}
Adw.PreferencesGroup {
Adw.EntryRow name {
title: _("Title");
}
Adw.EntryRow developer {
title: _("Developer (optional)");
}
}
Adw.PreferencesGroup {
Adw.EntryRow executable {
title: _("Executable");
[suffix]
Gtk.Button file_chooser_button {
valign: center;
icon-name: "document-open-symbolic";
tooltip-text: _("Select File");
styles [
"flat"
]
}
[suffix]
Gtk.MenuButton exec_info_button {
valign: center;
icon-name: "help-about-symbolic";
tooltip-text: _("More Info");
popover: Popover exec_info_popover {
focusable: true;
Label exec_info_label {
use-markup: true;
wrap: true;
max-width-chars: 50;
halign: center;
valign: center;
margin-top: 6;
margin-bottom: 6;
margin-start: 6;
margin-end: 6;
}
};
styles [
"flat"
]
}
}
}
Adw.EntryRow developer {
title: _("Developer (optional)");
}
}
Adw.PreferencesGroup {
Adw.EntryRow executable {
title: _("Executable");
[suffix]
Button file_chooser_button {
valign: center;
icon-name: "document-open-symbolic";
tooltip-text: _("Select File");
styles [
"flat",
]
}
[suffix]
MenuButton exec_info_button {
valign: center;
icon-name: "help-about-symbolic";
tooltip-text: _("More Info");
popover:
Popover exec_info_popover {
focusable: true;
Label exec_info_label {
use-markup: true;
wrap: true;
max-width-chars: 50;
halign: center;
valign: center;
margin-top: 6;
margin-bottom: 6;
margin-start: 6;
margin-end: 6;
}
}
;
styles [
"flat",
]
}
}
}
}
}
}
}

View File

@@ -76,7 +76,6 @@ template $PreferencesWindow : Adw.PreferencesWindow {
]
}
}
}
}
@@ -311,6 +310,35 @@ template $PreferencesWindow : Adw.PreferencesWindow {
}
}
}
Adw.ExpanderRow desktop_expander_row {
title: _("Desktop Entries");
show-enable-switch: true;
Adw.ComboRow desktop_terminal_exec_row {
title: _("Terminal");
subtitle: _("Used only by games that require one to run");
model: StringList {
strings [
_("Custom"),
"xdg-terminal-exec",
"GNOME Console",
"GNOME Terminal",
"Konsole",
"XTerm"
]
};
[suffix]
Revealer desktop_tereminal_custom_exec_revealer {
transition-type: slide_right;
Entry desktop_tereminal_custom_exec {
valign: center;
placeholder-text: _("Executable");
}
}
}
}
}
}

View File

@@ -194,13 +194,19 @@ template $CartridgesWindow : Adw.ApplicationWindow {
action-name: "app.edit_game";
tooltip-text: _("Edit");
styles ["raised", "circular"]
styles [
"raised",
"circular",
]
}
Button details_view_hide_button {
action-name: "app.hide_game";
styles ["raised", "circular"]
styles [
"raised",
"circular",
]
}
Button {
@@ -208,7 +214,10 @@ template $CartridgesWindow : Adw.ApplicationWindow {
action-name: "app.remove_game";
tooltip-text: _("Remove");
styles ["raised", "circular"]
styles [
"raised",
"circular",
]
}
MenuButton {
@@ -216,7 +225,10 @@ template $CartridgesWindow : Adw.ApplicationWindow {
menu-model: search;
tooltip-text: _("Search");
styles ["raised", "circular"]
styles [
"raised",
"circular",
]
}
styles [

View File

@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="cartridges">
<enum id="@APP_ID@.terminals">
<value nick="custom" value="0"/>
<value nick="xdg-terminal-exec" value="1"/>
<value nick="kgx" value="2"/>
<value nick="gnome-terminal" value="3"/>
<value nick="konsole" value="4"/>
<value nick="xterm" value="5"/>
</enum>
<schema id="@APP_ID@" path="@PREFIX@/">
<key name="exit-after-launch" type="b">
<default>false</default>
@@ -76,6 +86,15 @@
<key name="retroarch-location" type="s">
<default>"~/.var/app/org.libretro.RetroArch/config/retroarch/"</default>
</key>
<key name="desktop" type="b">
<default>true</default>
</key>
<key name="desktop-terminal" enum="@APP_ID@.terminals">
<default>"xdg-terminal-exec"</default>
</key>
<key name="desktop-terminal-custom-exec" type="s">
<default>""</default>
</key>
<key name="flatpak" type="b">
<default>true</default>
</key>
@@ -98,6 +117,7 @@
<default>false</default>
</key>
</schema>
<schema id="@APP_ID@.State" path="@PREFIX@/State/">
<key name="width" type="i">
<default>1110</default>
@@ -121,5 +141,8 @@
<key name="steam-limiter-tokens-history" type="s">
<default>"[]"</default>
</key>
<key name="terminal-check-done" type="b">
<default>false</default>
</key>
</schema>
</schemalist>