[gnome-games/wip/exalm/tnum: 4/24] collection: Introduce DummyAddCollection




commit a5c3aae5d3ac0a06509dad5f44fb10b1514e8404
Author: Neville <nevilleantony98 gmail com>
Date:   Thu Aug 6 22:28:43 2020 +0530

    collection: Introduce DummyAddCollection
    
    This collection can be added to the collection-model to provide an
    inline widget in a flowbox or listbox to create a collection.

 src/collection/dummy-add-collection.vala | 45 ++++++++++++++++++++++++++++++++
 src/meson.build                          |  1 +
 src/ui/collections-main-page.vala        |  3 ++-
 3 files changed, 48 insertions(+), 1 deletion(-)
---
diff --git a/src/collection/dummy-add-collection.vala b/src/collection/dummy-add-collection.vala
new file mode 100644
index 000000000..926c49d80
--- /dev/null
+++ b/src/collection/dummy-add-collection.vala
@@ -0,0 +1,45 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.DummyAddCollection : Object, Collection {
+       public bool is_empty {
+               get { return true; }
+       }
+
+       public string get_id () {
+               return "Add Collection";
+       }
+
+       public string get_title () {
+               return _("Add Collection");
+       }
+
+       public GameModel get_game_model () {
+               return new GameModel ();
+       }
+
+       public bool get_hide_stars () {
+               return true;
+       }
+
+       public CollectionType get_collection_type () {
+               return PLACEHOLDER;
+       }
+
+       public void load () {
+       }
+
+       public void add_games (Game[] games) {
+       }
+
+       public void remove_games (Game[] games) {
+       }
+
+       public void on_game_added (Game game) {
+       }
+
+       public void on_game_removed (Game game) {
+       }
+
+       public void on_game_replaced (Game game, Game prev_game) {
+       }
+}
diff --git a/src/meson.build b/src/meson.build
index d02037f70..d0fa1f49e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -14,6 +14,7 @@ vala_sources = [
   'collection/collection.vala',
   'collection/collection-manager.vala',
   'collection/collection-model.vala',
+  'collection/dummy-add-collection.vala',
   'collection/favorites-collection.vala',
   'collection/recently-played-collection.vala',
 
diff --git a/src/ui/collections-main-page.vala b/src/ui/collections-main-page.vala
index a178f00d8..b277f5769 100644
--- a/src/ui/collections-main-page.vala
+++ b/src/ui/collections-main-page.vala
@@ -107,7 +107,8 @@ private class Games.CollectionsMainPage : Gtk.Bin {
                if (collection_icon_view == null)
                        return false;
 
-               return !collection_icon_view.collection.is_empty;
+               return collection_icon_view.collection.get_collection_type () != AUTO ||
+                      !collection_icon_view.collection.is_empty;
        }
 
        [GtkCallback]


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