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



commit ccc4084ba6d9e16aae84c2d6263971aaaf19ca88
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 f4183240..183cb06a 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 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]