[gnome-games/wip/exalm/unified-window: 51/60] ui-view: Make a widget



commit 25b4ff79e7c6dd88fd34ca5dc68d4850c7e200cd
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Apr 10 17:51:05 2020 +0500

    ui-view: Make a widget
    
    Since both CollectionView and DisplayView are now widgets, we can remove
    indirection and require UiView implementations to be widgets.

 src/ui/application-window.vala | 6 +++---
 src/ui/collection-view.vala    | 4 ----
 src/ui/display-view.vala       | 4 ----
 src/ui/ui-view.vala            | 4 +---
 4 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 408b35b0..b3b49fa8 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -16,7 +16,7 @@ private class Games.ApplicationWindow : Hdy.ApplicationWindow {
 
                        _current_view = value;
 
-                       stack.visible_child = current_view.content_box;
+                       stack.visible_child = current_view;
 
                        if (current_view != null)
                                current_view.is_view_active = true;
@@ -82,8 +82,8 @@ private class Games.ApplicationWindow : Hdy.ApplicationWindow {
                collection_view = new CollectionView (this, game_model);
                display_view = new DisplayView (this);
 
-               stack.add (collection_view.content_box);
-               stack.add (display_view.content_box);
+               stack.add (collection_view);
+               stack.add (display_view);
 
                collection_view.game_activated.connect (on_game_activated);
                display_view.back.connect (on_display_back);
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index 8afde162..c39cd795 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -35,10 +35,6 @@ private class Games.CollectionView : Gtk.Box, UiView {
        [GtkChild]
        private Hdy.SwipeGroup swipe_group;
 
-       public Gtk.Widget content_box {
-               get { return this; }
-       }
-
        private bool _is_view_active;
        public bool is_view_active {
                get { return _is_view_active; }
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index d2d9a003..3af0229a 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -23,10 +23,6 @@ private class Games.DisplayView : Gtk.Box, UiView {
        [GtkChild]
        private SnapshotsList snapshots_list;
 
-       public Gtk.Widget content_box {
-               get { return this; }
-       }
-
        private bool _is_view_active;
        public bool is_view_active {
                get { return _is_view_active; }
diff --git a/src/ui/ui-view.vala b/src/ui/ui-view.vala
index 1d20c00c..2f553848 100644
--- a/src/ui/ui-view.vala
+++ b/src/ui/ui-view.vala
@@ -1,8 +1,6 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
-private interface Games.UiView : Object {
-       public abstract Gtk.Widget content_box { get; }
-
+private interface Games.UiView : Gtk.Widget {
        public abstract bool is_view_active { get; set; }
 
        public abstract bool on_button_pressed (Gdk.EventButton event);


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