[gnome-games/ricotz/vala] Don't declare CollectionType as nested type to allow build with older valac




commit 4c6f7a97d6f0ef63885e9c90f348a48a4be838be
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Aug 29 22:32:30 2020 +0200

    Don't declare CollectionType as nested type to allow build with older valac

 src/collection/collection.vala       | 14 +++++++-------
 src/ui/collection-action-window.vala |  6 +++---
 src/ui/collection-thumbnail.vala     |  2 +-
 src/ui/collections-main-page.vala    | 12 ++++++------
 src/ui/collections-page.vala         |  4 ++--
 5 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/collection/collection.vala b/src/collection/collection.vala
index ba9ffa64..661da503 100644
--- a/src/collection/collection.vala
+++ b/src/collection/collection.vala
@@ -1,13 +1,13 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
-private interface Games.Collection : Object {
-       // Collection types are in decreasing order of precedence while comparing between them.
-       public enum CollectionType {
-               AUTO,
-               USER,
-               PLACEHOLDER
-       }
+// Collection types are in decreasing order of precedence while comparing between them.
+private enum Games.CollectionType {
+       AUTO,
+       USER,
+       PLACEHOLDER
+}
 
+private interface Games.Collection : Object {
        public signal void games_changed ();
 
        public abstract bool is_empty { get; }
diff --git a/src/ui/collection-action-window.vala b/src/ui/collection-action-window.vala
index 75d37112..00b31b28 100644
--- a/src/ui/collection-action-window.vala
+++ b/src/ui/collection-action-window.vala
@@ -106,7 +106,7 @@ private class Games.CollectionActionWindow : Hdy.Window {
 
        private Gtk.Widget add_collection_row (Object object) {
                var collection = object as Collection;
-               if (collection.get_collection_type () == Collection.CollectionType.PLACEHOLDER)
+               if (collection.get_collection_type () == CollectionType.PLACEHOLDER)
                        return add_row;
 
                var row = new CollectionListItem (collection);
@@ -124,7 +124,7 @@ private class Games.CollectionActionWindow : Hdy.Window {
                        var collection = list_item.collection;
                        var type = collection.get_collection_type ();
 
-                       show_row = (type == Collection.CollectionType.USER) &&
+                       show_row = (type == CollectionType.USER) &&
                                       ((is_search_mode && collection.matches_search_terms (filtering_terms)) 
||
                                        (!is_search_mode));
                }
@@ -140,7 +140,7 @@ private class Games.CollectionActionWindow : Hdy.Window {
 
                foreach (var child in list_box.get_children ()) {
                        var row = child as CollectionListItem;
-                       if (row == null || row.collection.get_collection_type () != 
Collection.CollectionType.USER)
+                       if (row == null || row.collection.get_collection_type () != CollectionType.USER)
                                continue;
 
                        var check_button = row.activatable_widget as Gtk.CheckButton;
diff --git a/src/ui/collection-thumbnail.vala b/src/ui/collection-thumbnail.vala
index 887e4f56..41ca8149 100644
--- a/src/ui/collection-thumbnail.vala
+++ b/src/ui/collection-thumbnail.vala
@@ -24,7 +24,7 @@ private class Games.CollectionThumbnail : Gtk.Bin {
 
                        _collection = value;
 
-                       if (collection.get_collection_type () == Collection.CollectionType.PLACEHOLDER) {
+                       if (collection.get_collection_type () == CollectionType.PLACEHOLDER) {
                                thumbnail_stack.visible_child = new_collection_image;
                                return;
                        }
diff --git a/src/ui/collections-main-page.vala b/src/ui/collections-main-page.vala
index 0bffe68d..2b36f433 100644
--- a/src/ui/collections-main-page.vala
+++ b/src/ui/collections-main-page.vala
@@ -178,8 +178,8 @@ private class Games.CollectionsMainPage : Gtk.Bin {
                        var collection = collection_model.get_item (i) as Collection;
                        var type = collection.get_collection_type ();
 
-                       if (type == Collection.CollectionType.PLACEHOLDER ||
-                          (type == Collection.CollectionType.AUTO && collection.is_empty))
+                       if (type == CollectionType.PLACEHOLDER ||
+                          (type == CollectionType.AUTO && collection.is_empty))
                                continue;
 
                        if (collection.matches_search_terms (filtering_terms)) {
@@ -205,18 +205,18 @@ private class Games.CollectionsMainPage : Gtk.Bin {
 
                if (is_search_mode && filtering_terms.length != 0) {
                        switch (type) {
-                       case Collection.CollectionType.AUTO:
+                       case CollectionType.AUTO:
                                return !collection.is_empty && filter_collection (collection);
 
-                       case Collection.CollectionType.USER:
+                       case CollectionType.USER:
                                return filter_collection (collection);
 
-                       case Collection.CollectionType.PLACEHOLDER:
+                       case CollectionType.PLACEHOLDER:
                                return false;
                        }
                }
 
-               return !collection_icon_view.collection.is_empty || type != Collection.CollectionType.AUTO;
+               return !collection_icon_view.collection.is_empty || type != CollectionType.AUTO;
        }
 
        [GtkCallback]
diff --git a/src/ui/collections-page.vala b/src/ui/collections-page.vala
index 7b3f86fe..b11a1b5c 100644
--- a/src/ui/collections-page.vala
+++ b/src/ui/collections-page.vala
@@ -47,7 +47,7 @@ private class Games.CollectionsPage : Gtk.Bin {
 
                        is_showing_user_collection = current_collection != null &&
                                                     current_collection.get_collection_type () ==
-                                                    Collection.CollectionType.USER;
+                                                    CollectionType.USER;
                }
        }
 
@@ -212,7 +212,7 @@ private class Games.CollectionsPage : Gtk.Bin {
        [GtkCallback]
        private void on_collection_activated (Collection collection) {
                if (collection.get_collection_type () ==
-                   Collection.CollectionType.PLACEHOLDER) {
+                   CollectionType.PLACEHOLDER) {
                                // Finalize any pending removal of collection and dismiss undo notification 
if shown.
                                finalize_collection_removal ();
 


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