Name the specific game or runner in the search options

It's less good that the title bar, but better than nothing.
This commit is contained in:
Daniel Johnson 2023-07-22 10:17:16 -04:00 committed by Mathieu Comandon
parent a9a1078270
commit d7df34b3fc
3 changed files with 15 additions and 2 deletions

View file

@ -114,15 +114,21 @@ class GameDialogCommon(SavableModelessDialog, DialogInstallUIDelegate):
show_search = current_page_index in self.searchable_page_indices
self.set_search_entry_visibility(show_search)
def set_search_entry_visibility(self, show_search, placeholder_text=_("Search options")):
def set_search_entry_visibility(self, show_search, placeholder_text=None):
"""Explicitly shows or hides the search entry; can also update the placeholder text."""
header_bar = self.get_header_bar()
if show_search and self.search_entry:
header_bar.set_custom_title(self.search_entry)
self.search_entry.set_placeholder_text(placeholder_text)
self.search_entry.set_placeholder_text(placeholder_text or self.get_search_entry_placeholder())
else:
header_bar.set_custom_title(None)
def get_search_entry_placeholder(self):
if self.game and self.game.name:
return _("Search %s options") % self.game.name
return _("Search options")
def _build_info_tab(self):
info_box = Gtk.VBox()

View file

@ -95,6 +95,9 @@ class PreferencesDialog(GameDialogCommon):
self.get_header_bar().set_show_close_button(not show_actions)
self.stack.set_visible_child_name(row.get_children()[0].stack_id)
def get_search_entry_placeholder(self):
return _("Search global options")
def get_sidebar_button(self, stack_id, text, icon_name):
hbox = Gtk.HBox(visible=True)
hbox.stack_id = stack_id

View file

@ -2,6 +2,7 @@ from gettext import gettext as _
from lutris.config import LutrisConfig
from lutris.gui.config.common import GameDialogCommon
from lutris.runners import get_runner_human_name
class RunnerConfigDialog(GameDialogCommon):
@ -16,6 +17,9 @@ class RunnerConfigDialog(GameDialogCommon):
self.build_tabs("runner")
self.show_all()
def get_search_entry_placeholder(self):
return _("Search %s options") % get_runner_human_name(self.runner_name)
def on_save(self, wigdet, data=None):
self.lutris_config.save()
self.destroy()