[gnome-games/wip/exalm/views: 9/17] display-view: Add 'is-fullscreen'



commit 7660b429ea9cc2050c1537e4537bb00930d2cb80
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Oct 4 20:22:02 2018 +0500

    display-view: Add 'is-fullscreen'
    
    Make ApplicationWindow interact with DisplayView instead of its internals.

 src/ui/application-window.vala | 12 ++++--------
 src/ui/display-view.vala       | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 720738df..38a4b944 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -24,8 +24,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
                                display_view.is_view_active = false;
                                collection_view.is_view_active = true;
 
-                               is_fullscreen = false;
-
                                if (display_view.box.runner != null) {
                                        display_view.box.runner.stop ();
                                        display_view.box.runner = null;
@@ -73,8 +71,7 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
 
        private Settings settings;
 
-       private Binding box_fullscreen_binding;
-       private Binding header_bar_fullscreen_binding;
+       private Binding fullscreen_binding;
        private Binding loading_notification_binding;
 
        private Cancellable run_game_cancellable;
@@ -122,10 +119,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
                                                              "loading-notification",
                                                              BindingFlags.DEFAULT);
 
-               box_fullscreen_binding = bind_property ("is-fullscreen", display_view.box, "is-fullscreen",
-                                                       BindingFlags.BIDIRECTIONAL);
-               header_bar_fullscreen_binding = bind_property ("is-fullscreen", display_view._header_bar, 
"is-fullscreen",
-                                                              BindingFlags.BIDIRECTIONAL);
+               fullscreen_binding = bind_property ("is-fullscreen", display_view,
+                                                   "is-fullscreen",
+                                                   BindingFlags.BIDIRECTIONAL);
 
                konami_code = new KonamiCode (this);
                konami_code.code_performed.connect (on_konami_code_performed);
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index 7df74a9c..cf9eee70 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -22,11 +22,27 @@ private class Games.DisplayView: Gtk.Bin, ApplicationView {
                                return;
 
                        _is_view_active = value;
+
+                       if (!is_view_active)
+                               is_fullscreen = false;
                }
        }
 
        public ApplicationWindow window { get; construct set; }
 
+       public bool is_fullscreen { get; set; }
+
+       private Binding box_fullscreen_binding;
+       private Binding header_bar_fullscreen_binding;
+
+       construct {
+               box_fullscreen_binding = bind_property ("is-fullscreen", box, "is-fullscreen",
+                                                       BindingFlags.BIDIRECTIONAL);
+               header_bar_fullscreen_binding = bind_property ("is-fullscreen", _header_bar,
+                                                              "is-fullscreen",
+                                                              BindingFlags.BIDIRECTIONAL);
+       }
+
        public bool on_button_pressed (Gdk.EventButton event) {
                return false;
        }


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