[gnome-games/wip/exalm/cleanups: 4/10] ui: Place functions after properties



commit 4ea2fa019fb60a8963eacba25dbd76a6d0e11d76
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Feb 25 14:58:21 2019 +0500

    ui: Place functions after properties

 src/ui/input-mode-switcher.vala | 26 ++++++++---------
 src/ui/sidebar-view.vala        | 64 ++++++++++++++++++++---------------------
 2 files changed, 45 insertions(+), 45 deletions(-)
---
diff --git a/src/ui/input-mode-switcher.vala b/src/ui/input-mode-switcher.vala
index 68e31091..5e4651ac 100644
--- a/src/ui/input-mode-switcher.vala
+++ b/src/ui/input-mode-switcher.vala
@@ -19,19 +19,6 @@ private class Games.InputModeSwitcher : Gtk.Box {
                }
        }
 
-       private void on_input_mode_changed () {
-               switch (runner.input_mode) {
-               case InputMode.GAMEPAD:
-                       gamepad_mode.active = true;
-
-                       break;
-               case InputMode.KEYBOARD:
-                       keyboard_mode.active = true;
-
-                       break;
-               }
-       }
-
        [GtkChild]
        private Gtk.RadioButton keyboard_mode;
        [GtkChild]
@@ -48,4 +35,17 @@ private class Games.InputModeSwitcher : Gtk.Box {
                if (gamepad_mode.active)
                        runner.input_mode = InputMode.GAMEPAD;
        }
+
+       private void on_input_mode_changed () {
+               switch (runner.input_mode) {
+               case InputMode.GAMEPAD:
+                       gamepad_mode.active = true;
+
+                       break;
+               case InputMode.KEYBOARD:
+                       keyboard_mode.active = true;
+
+                       break;
+               }
+       }
 }
diff --git a/src/ui/sidebar-view.vala b/src/ui/sidebar-view.vala
index 465ec069..cf14eb24 100644
--- a/src/ui/sidebar-view.vala
+++ b/src/ui/sidebar-view.vala
@@ -4,6 +4,8 @@
 private abstract class Games.SidebarView : Gtk.Box {
        public signal void game_activated (Game game);
 
+       private ulong model_items_changed_id;
+
        private string[] filtering_terms;
        public string filtering_text {
                set {
@@ -16,38 +18,6 @@ private abstract class Games.SidebarView : Gtk.Box {
                }
        }
 
-       private void hide_empty_sidebar_items () {
-               // Create an array of all the games which fit the search text entered
-               // in the top search bar
-               Game[] visible_games = {};
-
-               for (int i = 0; i < model.get_n_items (); i++) {
-                       var game = model.get_item (i) as Game;
-
-                       if (game.matches_search_terms (filtering_terms))
-                               visible_games += game;
-               }
-
-               foreach (var row in list_box.get_children ()) {
-                       var sidebar_item = row as SidebarListItem;
-                       // Assume row doesn't have any games to show
-                       var is_row_visible = false;
-
-                       foreach (var game in visible_games) {
-                               if (sidebar_item.has_game (game)) {
-                                       is_row_visible = true;
-                                       break;
-                               }
-                       }
-
-                       row.visible = is_row_visible;
-               }
-
-               select_default_row ();
-       }
-
-       private ulong model_items_changed_id;
-
        private ListModel _model;
        public ListModel model {
                get { return _model; }
@@ -242,4 +212,34 @@ private abstract class Games.SidebarView : Gtk.Box {
                        }
                }
        }
+
+       private void hide_empty_sidebar_items () {
+               // Create an array of all the games which fit the search text entered
+               // in the top search bar
+               Game[] visible_games = {};
+
+               for (int i = 0; i < model.get_n_items (); i++) {
+                       var game = model.get_item (i) as Game;
+
+                       if (game.matches_search_terms (filtering_terms))
+                               visible_games += game;
+               }
+
+               foreach (var row in list_box.get_children ()) {
+                       var sidebar_item = row as SidebarListItem;
+                       // Assume row doesn't have any games to show
+                       var is_row_visible = false;
+
+                       foreach (var game in visible_games) {
+                               if (sidebar_item.has_game (game)) {
+                                       is_row_visible = true;
+                                       break;
+                               }
+                       }
+
+                       row.visible = is_row_visible;
+               }
+
+               select_default_row ();
+       }
 }


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