[gnome-games] display-box: Flash the screen when creating a new savestate



commit 2d60bef46ef3c36622b1902f27d320d5f0f673d3
Author: Yetizone <andreii lisita gmail com>
Date:   Fri Aug 16 00:02:18 2019 +0300

    display-box: Flash the screen when creating a new savestate
    
    The flash effect is used as feedback for creating savestates either via the
    shortcut or by using the new savestate row in the menu.

 data/ui/display-box.ui  | 5 +++++
 src/ui/display-box.vala | 7 +++++++
 2 files changed, 12 insertions(+)
---
diff --git a/data/ui/display-box.ui b/data/ui/display-box.ui
index d4b37e72..6435ba2d 100644
--- a/data/ui/display-box.ui
+++ b/data/ui/display-box.ui
@@ -33,6 +33,11 @@
                     <property name="hexpand">True</property>
                   </object>
                 </child>
+                <child type="overlay">
+                  <object class="GamesFlashBox" id="flash_box">
+                    <property name="visible">True</property>
+                  </object>
+                </child>
                 <child type="overlay">
                   <object class="GamesSavestatesList" id="savestates_list">
                     <property name="visible">True</property>
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index e511d317..6f6d134f 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -34,6 +34,9 @@ private class Games.DisplayBox : Gtk.Bin {
        public Runner runner {
                get { return _runner; }
                set {
+                       if (runner != null)
+                               runner.new_savestate_created.disconnect (flash_box.flash);
+
                        stack.visible_child = display_overlay;
 
                        _runner = value;
@@ -47,6 +50,8 @@ private class Games.DisplayBox : Gtk.Bin {
                        set_display (display);
 
                        savestates_list.runner = value;
+
+                       runner.new_savestate_created.connect (flash_box.flash);
                }
        }
 
@@ -63,6 +68,8 @@ private class Games.DisplayBox : Gtk.Bin {
        [GtkChild]
        private DisplayHeaderBar fullscreen_header_bar;
        [GtkChild]
+       private FlashBox flash_box;
+       [GtkChild]
        private SavestatesList savestates_list;
 
        private Binding fullscreen_binding;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]