From e0c81d70247c04a5361bce4942d52b188cce4dc0 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Thu, 7 Mar 2024 16:59:07 -0500 Subject: [PATCH] Show the log-in notification only with the splash, not if you have games or if you have games, but they are filtered away. --- lutris/gui/lutriswindow.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py index 349b39c57..3e917867d 100644 --- a/lutris/gui/lutriswindow.py +++ b/lutris/gui/lutriswindow.py @@ -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):