1
0
mirror of https://github.com/lutris/lutris synced 2024-07-05 16:38:42 +00:00

Show the log-in notification only with the splash, not if you have games or if you have games, but they are filtered away.

This commit is contained in:
Daniel Johnson 2024-03-07 16:59:07 -05:00 committed by Mathieu Comandon
parent 4975ce4030
commit e0c81d7024

View File

@ -46,8 +46,7 @@ from lutris.util.system import update_desktop_icons
@GtkTemplate(ui=os.path.join(datapath.get(), "ui", "lutris-window.ui"))
class LutrisWindow(Gtk.ApplicationWindow, DialogLaunchUIDelegate,
DialogInstallUIDelegate): # pylint: disable=too-many-public-methods
class LutrisWindow(Gtk.ApplicationWindow, DialogLaunchUIDelegate, DialogInstallUIDelegate): # pylint: disable=too-many-public-methods
"""Handler class for main window signals."""
default_view_type = "grid"
@ -234,6 +233,7 @@ class LutrisWindow(Gtk.ApplicationWindow, DialogLaunchUIDelegate,
action.connect("change-state", value.callback)
self.actions[name] = action
if value.enabled:
def updater(action=action, value=value):
action.props.enabled = value.enabled()
@ -569,6 +569,8 @@ class LutrisWindow(Gtk.ApplicationWindow, DialogLaunchUIDelegate,
else:
self.show_label(_("No games found"))
self.update_notification()
def update_store(self, *_args, **_kwargs):
service_id = self.filters.get("service")
service = self.service
@ -678,8 +680,16 @@ class LutrisWindow(Gtk.ApplicationWindow, DialogLaunchUIDelegate,
splash_box = Gtk.HBox(visible=True, margin_top=24)
splash_box.pack_start(side_splash, False, False, 12)
splash_box.set_center_widget(center_splash)
splash_box.is_splash = True
self.show_overlay(splash_box, Gtk.Align.FILL, Gtk.Align.FILL)
def is_showing_splash(self):
if self.blank_overlay.get_visible():
for ch in self.blank_overlay.get_children():
if hasattr(ch, "is_splash"):
return True
return False
def show_spinner(self):
# This is inconsistent, but we can't use the blank overlay for the spinner- it
# won't reliably start as a child of blank_overlay. It seems like it fails if
@ -825,8 +835,8 @@ class LutrisWindow(Gtk.ApplicationWindow, DialogLaunchUIDelegate,
self.filters["installed"] = filter_installed
def update_notification(self):
logged_in = bool(read_user_info())
self.notification_revealer.set_reveal_child(not logged_in)
show_notification = not read_user_info() and self.is_showing_splash()
self.notification_revealer.set_reveal_child(show_notification)
@GtkTemplate.Callback
def on_lutris_log_in_button_clicked(self, _button):