[gnome-games/wip/exalm/cache2: 31/45] cooperative: Add 'has-loaded' property and remove changed()



commit bdbadd691d554eb9487f9241f127081cc0945bc4
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Oct 2 18:54:47 2018 +0500

    cooperative: Add 'has-loaded' property and remove changed()

 src/core/cooperative.vala            | 2 +-
 src/dummy/dummy-cooperative.vala     | 2 ++
 src/generic/generic-cooperative.vala | 6 ++++++
 src/grilo/grilo-cooperative.vala     | 9 ++++-----
 4 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/core/cooperative.vala b/src/core/cooperative.vala
index 40945b3d..ffc62fbf 100644
--- a/src/core/cooperative.vala
+++ b/src/core/cooperative.vala
@@ -1,7 +1,7 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public interface Games.Cooperative : Object {
-       public signal void changed ();
+       public abstract bool has_loaded { get; protected set; }
 
        public abstract bool get_cooperative ();
 }
diff --git a/src/dummy/dummy-cooperative.vala b/src/dummy/dummy-cooperative.vala
index a5aff939..b0e4b7d7 100644
--- a/src/dummy/dummy-cooperative.vala
+++ b/src/dummy/dummy-cooperative.vala
@@ -1,6 +1,8 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public class Games.DummyCooperative : Object, Cooperative {
+       public bool has_loaded { get; protected set; }
+
        public bool get_cooperative () {
                return false;
        }
diff --git a/src/generic/generic-cooperative.vala b/src/generic/generic-cooperative.vala
index 8073a25e..a3e4a918 100644
--- a/src/generic/generic-cooperative.vala
+++ b/src/generic/generic-cooperative.vala
@@ -3,6 +3,12 @@
 public class Games.GenericCooperative : Object, Cooperative {
        private bool cooperative;
 
+       public bool has_loaded { get; protected set; }
+
+       construct {
+               has_loaded = true;
+       }
+
        public GenericCooperative (bool cooperative) {
                this.cooperative = cooperative;
        }
diff --git a/src/grilo/grilo-cooperative.vala b/src/grilo/grilo-cooperative.vala
index 3cafcef0..07393b10 100644
--- a/src/grilo/grilo-cooperative.vala
+++ b/src/grilo/grilo-cooperative.vala
@@ -4,7 +4,8 @@ public class Games.GriloCooperative : Object, Cooperative {
        private GriloMedia media;
        private bool cooperative;
        private bool resolving;
-       private bool resolved;
+
+       public bool has_loaded { get; protected set; }
 
        public GriloCooperative (GriloMedia media) {
                this.media = media;
@@ -13,7 +14,7 @@ public class Games.GriloCooperative : Object, Cooperative {
        }
 
        public bool get_cooperative () {
-               if (resolving || resolved)
+               if (resolving || has_loaded)
                        return cooperative;
 
                resolving = true;
@@ -36,8 +37,6 @@ public class Games.GriloCooperative : Object, Cooperative {
 
                cooperative = grl_media.get_boolean (metadata_key);
 
-               resolved = true;
-
-               changed ();
+               has_loaded = true;
        }
 }


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