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



commit 41f1a395309b17f4b10ed7e8d2db43f250d41305
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 c418b01b..866d9b55 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;
@@ -76,8 +74,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;
@@ -130,10 +127,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 3d0f8855..6534ef1c 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -21,11 +21,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]