game-details: Rename edit-done to apply
This commit is contained in:
committed by
Laura Kramolis
parent
fe8e41ecb7
commit
fdf4d6d788
@@ -256,19 +256,19 @@ template $GameDetails: Adw.NavigationPage {
|
||||
Adw.PreferencesGroup {
|
||||
Adw.EntryRow name_entry {
|
||||
title: _("Title");
|
||||
entry-activated => $_activate_edit_done();
|
||||
entry-activated => $_activate_apply();
|
||||
}
|
||||
|
||||
Adw.EntryRow developer_entry {
|
||||
title: _("Developer (optional)");
|
||||
entry-activated => $_activate_edit_done();
|
||||
entry-activated => $_activate_apply();
|
||||
}
|
||||
}
|
||||
|
||||
Adw.PreferencesGroup {
|
||||
Adw.EntryRow executable_entry {
|
||||
title: _("Executable");
|
||||
entry-activated => $_activate_edit_done();
|
||||
entry-activated => $_activate_apply();
|
||||
|
||||
[suffix]
|
||||
MenuButton {
|
||||
@@ -297,7 +297,7 @@ template $GameDetails: Adw.NavigationPage {
|
||||
}
|
||||
|
||||
Button {
|
||||
action-name: "details.edit-done";
|
||||
action-name: "details.apply";
|
||||
label: bind $_if_else(template.game as <$Game>.added, _("Apply"), _("Add")) as <string>;
|
||||
halign: center;
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ class GameDetails(Adw.NavigationPage):
|
||||
),
|
||||
))
|
||||
|
||||
group.add_action(edit_done := Gio.SimpleAction.new("edit-done"))
|
||||
edit_done.connect("activate", lambda *_: self._edit_done())
|
||||
group.add_action(apply := Gio.SimpleAction.new("apply"))
|
||||
apply.connect("activate", lambda *_: self._apply())
|
||||
|
||||
entries = tuple(
|
||||
Gtk.PropertyExpression.new(
|
||||
@@ -75,7 +75,7 @@ class GameDetails(Adw.NavigationPage):
|
||||
for prop in _REQUIRED_PROPERTIES
|
||||
)
|
||||
valid = Gtk.ClosureExpression.new(bool, lambda _, *values: all(values), entries)
|
||||
valid.bind(edit_done, "enabled")
|
||||
valid.bind(apply, "enabled")
|
||||
|
||||
def edit(self):
|
||||
"""Enter edit mode."""
|
||||
@@ -87,7 +87,7 @@ class GameDetails(Adw.NavigationPage):
|
||||
self.stack.props.visible_child_name = "edit"
|
||||
self.name_entry.grab_focus()
|
||||
|
||||
def _edit_done(self):
|
||||
def _apply(self):
|
||||
for prop in _EDITABLE_PROPERTIES:
|
||||
entry = getattr(self, f"{prop}_entry")
|
||||
value = entry.props.text
|
||||
@@ -109,8 +109,8 @@ class GameDetails(Adw.NavigationPage):
|
||||
self.stack.props.visible_child_name = "details"
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def _activate_edit_done(self, _entry):
|
||||
self.activate_action("details.edit-done")
|
||||
def _activate_apply(self, _entry):
|
||||
self.activate_action("details.apply")
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def _or(self, _obj, first: _T, second: _T) -> _T:
|
||||
|
||||
Reference in New Issue
Block a user