[gnome-games/wip/exalm/cleanups: 6/9] Use 'as' to cast wherever possible



commit 9a2a56b342a35778ed202d2998b6d515015062f7
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Sep 11 15:06:04 2018 +0500

    Use 'as' to cast wherever possible
    
    Follow the coding style described in CodingStyle.txt

 src/ui/gamepad-configurer.vala     | 2 +-
 src/ui/keyboard-configurer.vala    | 2 +-
 src/ui/media-selector.vala         | 2 +-
 src/ui/preferences-page-video.vala | 2 +-
 src/ui/preferences-window.vala     | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/gamepad-configurer.vala b/src/ui/gamepad-configurer.vala
index 627d0d6b..42abced4 100644
--- a/src/ui/gamepad-configurer.vala
+++ b/src/ui/gamepad-configurer.vala
@@ -160,7 +160,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
 
        private void reset_mapping () {
                var message_dialog = new ResetControllerMappingDialog ();
-               message_dialog.transient_for = (Gtk.Window) get_toplevel ();
+               message_dialog.transient_for = get_toplevel () as Gtk.Window;
                message_dialog.response.connect ((response) => {
                        switch (response) {
                                case Gtk.ResponseType.ACCEPT:
diff --git a/src/ui/keyboard-configurer.vala b/src/ui/keyboard-configurer.vala
index e9a34692..c14c9f52 100644
--- a/src/ui/keyboard-configurer.vala
+++ b/src/ui/keyboard-configurer.vala
@@ -153,7 +153,7 @@ private class Games.KeyboardConfigurer : Gtk.Box {
 
        private void reset_mapping () {
                var message_dialog = new ResetControllerMappingDialog ();
-               message_dialog.transient_for = (Gtk.Window) get_toplevel ();
+               message_dialog.transient_for = get_toplevel () as Gtk.Window;
                message_dialog.response.connect ((response) => {
                        switch (response) {
                                case Gtk.ResponseType.ACCEPT:
diff --git a/src/ui/media-selector.vala b/src/ui/media-selector.vala
index 812d4895..48bbd01e 100644
--- a/src/ui/media-selector.vala
+++ b/src/ui/media-selector.vala
@@ -68,7 +68,7 @@ private class Games.MediaSelector : Gtk.Popover {
                var i = 0;
                var row = list_box.get_row_at_index (i);
                while (row != null) {
-                       var checkmark_item = (CheckmarkItem) row.get_child ();
+                       var checkmark_item = row.get_child () as CheckmarkItem;
                        checkmark_item.checkmark_visible = (i == media_number);
 
                        row = list_box.get_row_at_index (++i);
diff --git a/src/ui/preferences-page-video.vala b/src/ui/preferences-page-video.vala
index 25eb532a..3ef3638e 100644
--- a/src/ui/preferences-page-video.vala
+++ b/src/ui/preferences-page-video.vala
@@ -19,7 +19,7 @@ private class Games.PreferencesPageVideo: Gtk.Bin, PreferencesPage {
                set {
                        for (var i = 0; i < filter_names.length; i++) {
                                var row_item = filter_list_box.get_row_at_index (i);
-                               var checkmark_item = (CheckmarkItem) row_item.get_child ();
+                               var checkmark_item = row_item.get_child () as CheckmarkItem;
                                checkmark_item.checkmark_visible = (value == filter_names[i]);
                        }
                        _filter_active = value;
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 94177222..28d4e16e 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -49,7 +49,7 @@ private class Games.PreferencesWindow : Gtk.Window {
 
        public PreferencesWindow () {
                stack.foreach ((child) => {
-                       var page = (PreferencesPage) child;
+                       var page = child as PreferencesPage;
                        stack.notify["visible-child-name"].connect (page.visible_page_changed);
                });
                stack.notify["visible-child-name"].connect (visible_child_changed);
@@ -57,7 +57,7 @@ private class Games.PreferencesWindow : Gtk.Window {
        }
 
        private void visible_child_changed () {
-               var page = (PreferencesPage) stack.visible_child;
+               var page = stack.visible_child as PreferencesPage;
                if (page == null) {
                        right_header_bar = null;
 


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