[gnome-games/wip/exalm/actions: 5/10] ui: Don't store bindings



commit 541d114c6d69837c0c71c0085fd91af1bd2c349e
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Jan 26 21:44:57 2020 +0500

    ui: Don't store bindings
    
    This is unnecessary and just clutters the code.

 src/ui/application-window.vala           | 14 ++++---------
 src/ui/collection-view.vala              | 35 +++++++++++---------------------
 src/ui/display-view.vala                 | 13 ++++--------
 src/ui/preferences-subpage-keyboard.vala |  4 +---
 4 files changed, 21 insertions(+), 45 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index ae12abc8..3f1970da 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -54,9 +54,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
 
        private Settings settings;
 
-       private Binding fullscreen_binding;
-       private Binding loading_notification_binding;
-
        private long window_size_update_timeout;
 
        private uint inhibit_cookie;
@@ -96,14 +93,11 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
                collection_view.game_activated.connect (on_game_activated);
                display_view.back.connect (on_display_back);
 
-               loading_notification_binding = bind_property ("loading-notification",
-                                                             collection_view,
-                                                             "loading-notification",
-                                                             BindingFlags.DEFAULT);
+               bind_property ("loading-notification", collection_view,
+                       "loading-notification", BindingFlags.DEFAULT);
 
-               fullscreen_binding = bind_property ("is-fullscreen", display_view,
-                                                   "is-fullscreen",
-                                                   BindingFlags.BIDIRECTIONAL);
+               bind_property ("is-fullscreen", display_view,
+                              "is-fullscreen", BindingFlags.BIDIRECTIONAL);
 
                window_size_update_timeout = -1;
                inhibit_cookie = 0;
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index ab2f1bb1..82ad90ca 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -39,12 +39,6 @@ private class Games.CollectionView : Object, UiView {
        public bool search_mode { get; set; }
        public bool is_collection_empty { get; set; }
 
-       private Binding loading_notification_binding;
-       private Binding box_search_binding;
-       private Binding box_empty_collection_binding;
-       private Binding header_bar_search_binding;
-       private Binding header_bar_empty_collection_binding;
-
        private KonamiCode konami_code;
        private AdaptiveState adaptive_state;
 
@@ -65,23 +59,18 @@ private class Games.CollectionView : Object, UiView {
                header_bar.viewstack = box.viewstack;
                is_collection_empty = true;
 
-               loading_notification_binding = bind_property ("loading-notification", box,
-                                                             "loading-notification",
-                                                             BindingFlags.DEFAULT);
-
-               box_search_binding = bind_property ("search-mode", box, "search-mode",
-                                                   BindingFlags.BIDIRECTIONAL);
-               header_bar_search_binding = bind_property ("search-mode", header_bar,
-                                                          "search-mode",
-                                                          BindingFlags.BIDIRECTIONAL);
-
-               box_empty_collection_binding = bind_property ("is-collection-empty", box,
-                                                             "is-collection-empty",
-                                                             BindingFlags.BIDIRECTIONAL);
-               header_bar_empty_collection_binding = bind_property ("is-collection-empty",
-                                                                    header_bar,
-                                                                    "is-collection-empty",
-                                                                    BindingFlags.BIDIRECTIONAL);
+               bind_property ("loading-notification", box,
+                              "loading-notification", BindingFlags.DEFAULT);
+
+               bind_property ("search-mode", box,
+                              "search-mode", BindingFlags.BIDIRECTIONAL);
+               bind_property ("search-mode", header_bar,
+                              "search-mode", BindingFlags.BIDIRECTIONAL);
+
+               bind_property ("is-collection-empty", box,
+                              "is-collection-empty", BindingFlags.BIDIRECTIONAL);
+               bind_property ("is-collection-empty", header_bar,
+                              "is-collection-empty", BindingFlags.BIDIRECTIONAL);
 
                konami_code = new KonamiCode (window);
                konami_code.code_performed.connect (on_konami_code_performed);
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index 43b334b1..6adc3e5e 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -42,9 +42,6 @@ private class Games.DisplayView : Object, UiView {
 
        private Settings settings;
 
-       private Binding box_fullscreen_binding;
-       private Binding header_bar_fullscreen_binding;
-
        private Cancellable run_game_cancellable;
        private Cancellable quit_game_cancellable;
 
@@ -71,12 +68,10 @@ private class Games.DisplayView : Object, UiView {
 
                settings = new Settings ("org.gnome.Games");
 
-               // Bind the is_fullscreen property between the header_bar and the box
-               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);
+               bind_property ("is-fullscreen", box,
+                              "is-fullscreen", BindingFlags.BIDIRECTIONAL);
+               bind_property ("is-fullscreen", header_bar,
+                              "is-fullscreen", BindingFlags.BIDIRECTIONAL);
 
                focus_out_timeout_id = -1;
        }
diff --git a/src/ui/preferences-subpage-keyboard.vala b/src/ui/preferences-subpage-keyboard.vala
index 16a243e5..c0f79cad 100644
--- a/src/ui/preferences-subpage-keyboard.vala
+++ b/src/ui/preferences-subpage-keyboard.vala
@@ -117,8 +117,6 @@ private class Games.PreferencesSubpageKeyboard : Gtk.Box, PreferencesSubpage {
        private KeyboardTester tester;
        private KeyboardMappingManager mapping_manager;
 
-       private Binding info_message_binding;
-
        construct {
                mapper = new KeyboardMapper (KEYBOARD_GAMEPAD_VIEW_CONFIGURATION, KEYBOARD_GAMEPAD_INPUTS);
                gamepad_view_stack.add (mapper);
@@ -131,7 +129,7 @@ private class Games.PreferencesSubpageKeyboard : Gtk.Box, PreferencesSubpage {
                        tester.mapping = mapping_manager.mapping;
                });
 
-               info_message_binding = mapper.bind_property ("info-message", info_message, "label", 
BindingFlags.SYNC_CREATE);
+               mapper.bind_property ("info-message", info_message, "label", BindingFlags.SYNC_CREATE);
 
                state = State.TEST;
        }


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