Sneaky property EXPOSED\!\!

This commit is contained in:
Mathieu Comandon 2024-02-17 20:46:17 -08:00
parent e9a6f6a273
commit b982dc1588

View file

@ -365,13 +365,11 @@ class GameRemovalRow(Gtk.ListBoxRow):
hbox.pack_start(label, False, False, 0)
self.remove_from_library_checkbox = Gtk.CheckButton(
"Remove from Library", active=False, halign=Gtk.Align.START
_("Remove from Library"), halign=Gtk.Align.START
)
self.remove_from_library_checkbox.set_sensitive(game.is_installed)
self.remove_from_library_checkbox.set_active(True)
self.remove_from_library_checkbox.connect(
"toggled", self.on_checkbox_toggled
)
self.remove_from_library_checkbox.connect("toggled", self.on_checkbox_toggled)
hbox.pack_end(self.remove_from_library_checkbox, False, False, 0)
if game.is_installed and self.game.directory:
@ -429,7 +427,7 @@ class GameRemovalRow(Gtk.ListBoxRow):
self.folder_size_spinner.hide()
@property
def delete_files(self) -> bool:
def delete_files_property(self) -> bool:
"""True if the game files should be deleted."""
return bool(
self.game.is_installed
@ -438,35 +436,35 @@ class GameRemovalRow(Gtk.ListBoxRow):
and self.delete_files_checkbox.get_active()
)
@delete_files.setter
def delete_files(self, active: bool) -> None:
@delete_files_property.setter
def delete_files_property(self, active: bool) -> None:
self.delete_files_checkbox.set_active(active)
@property
def can_delete_files(self):
def can_delete_files_property(self):
return self._can_delete_files
@can_delete_files.setter
def can_delete_files(self, can_delete):
@can_delete_files_property.setter
def can_delete_files_property(self, can_delete):
if self._can_delete_files != can_delete and self.delete_files_checkbox:
self._can_delete_files = can_delete
self.delete_files_checkbox.set_sensitive(can_delete)
self.delete_files_checkbox.set_active(can_delete)
@property
def delete_game(self) -> bool:
def delete_game_property(self) -> bool:
"""True if the game should be rmoved from the database."""
if not self.game.is_installed:
return True
return bool(self.remove_from_library_checkbox.get_active())
@delete_game.setter
def delete_game(self, active: bool) -> None:
@delete_game_property.setter
def delete_game_property(self, active: bool) -> None:
self.remove_from_library_checkbox.set_active(active)
@property
def has_game_remove_warning(self) -> bool:
def has_game_remove_warning_property(self) -> bool:
"""True if the game should not provoke a warning before you delete its files."""
return not self.game.has_runner or not hasattr(
self.game.runner, "no_game_remove_warning"
@ -477,10 +475,10 @@ class GameRemovalRow(Gtk.ListBoxRow):
# We uninstall installed games, and delete games where self.delete_game is true;
# but we must be careful to fire the game-removed single only once.
if self.game.is_installed:
if self.delete_game:
self.game.uninstall(delete_files=self.delete_files, no_signal=True)
if self.delete_game_property:
self.game.uninstall(delete_files=self.delete_files_property, no_signal=True)
self.game.delete()
else:
self.game.uninstall(delete_files=self.delete_files)
elif self.delete_game:
self.game.uninstall(delete_files=self.delete_files_property)
elif self.delete_game_property:
self.game.delete()