Use Libadwaita widgets for details window

This commit is contained in:
kramo
2023-08-08 13:44:27 +02:00
parent 675359ee58
commit 70d8d91b53
2 changed files with 17 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ using Gtk 4.0;
using Adw 1;
template $DetailsWindow : Adw.Window {
default-width: 500;
default-width: 480; // Same as Nautilus' properties window
default-height: -1;
modal: true;
@@ -97,34 +97,20 @@ template $DetailsWindow : Adw.Window {
}
}
Adw.PreferencesGroup title_group {
title: _("Title");
description: _("The title of the game");
Entry name {
accessibility {
label: _("Title");
}
Adw.PreferencesGroup {
Adw.EntryRow name {
title: _("Title");
}
Adw.EntryRow developer {
title: _("Developer (optional)");
}
}
Adw.PreferencesGroup {
Adw.EntryRow executable {
title: _("Executable");
Adw.PreferencesGroup developer_group {
title: _("Developer");
description: _("The developer or publisher (optional)");
Entry developer {
accessibility {
label: _("Developer");
}
}
}
Adw.PreferencesGroup exec_group {
title: _("Executable");
description: _("File to open or command to run when launching the game");
[header-suffix]
Gtk.MenuButton exec_info_button {
[suffix]
Gtk.MenuButton exec_info_button {
valign: center;
icon-name: "help-about-symbolic";
tooltip-text: _("More Info");
@@ -150,10 +136,6 @@ template $DetailsWindow : Adw.Window {
]
}
Entry executable {
accessibility {
label: _("Executable");
}
}
}
}

View File

@@ -64,7 +64,7 @@ class DetailsWindow(Adw.Window):
self.set_transient_for(self.win)
if self.game:
self.set_title(_("Edit Game Details"))
self.set_title(_("Game Details"))
self.name.set_text(self.game.name)
if self.game.developer:
self.developer.set_text(self.game.developer)
@@ -76,7 +76,7 @@ class DetailsWindow(Adw.Window):
self.cover_button_delete_revealer.set_reveal_child(True)
else:
self.set_title(_("Add New Game"))
self.apply_button.set_label(_("Confirm"))
self.apply_button.set_label(_("Add"))
image_filter = Gtk.FileFilter(name=_("Images"))
for extension in Image.registered_extensions():
@@ -123,9 +123,9 @@ class DetailsWindow(Adw.Window):
self.cover_button_edit.connect("clicked", self.choose_cover)
self.apply_button.connect("clicked", self.apply_preferences)
self.name.connect("activate", self.focus_executable)
self.developer.connect("activate", self.focus_executable)
self.executable.connect("activate", self.apply_preferences)
self.name.connect("entry-activated", self.focus_executable)
self.developer.connect("entry-activated", self.focus_executable)
self.executable.connect("entry-activated", self.apply_preferences)
self.set_focus(self.name)
self.present()