[gnome-games/wip/exalm/cache2: 14/22] rating: Add 'has-loaded' property and remove changed()



commit abf349d814761857be50fad385b9307ec336156b
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Oct 2 18:56:38 2018 +0500

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

 src/core/rating.vala            | 2 +-
 src/dummy/dummy-rating.vala     | 2 ++
 src/generic/generic-rating.vala | 6 ++++++
 src/grilo/grilo-rating.vala     | 4 +++-
 4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/core/rating.vala b/src/core/rating.vala
index 88313378..b2bc2f23 100644
--- a/src/core/rating.vala
+++ b/src/core/rating.vala
@@ -1,7 +1,7 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public interface Games.Rating : Object {
-       public signal void changed ();
+       public abstract bool has_loaded { get; protected set; }
 
        public abstract float get_rating ();
 }
diff --git a/src/dummy/dummy-rating.vala b/src/dummy/dummy-rating.vala
index 216bd42c..9d53c77f 100644
--- a/src/dummy/dummy-rating.vala
+++ b/src/dummy/dummy-rating.vala
@@ -1,6 +1,8 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public class Games.DummyRating : Object, Rating {
+       public bool has_loaded { get; protected set; }
+
        public float get_rating () {
                return 0;
        }
diff --git a/src/generic/generic-rating.vala b/src/generic/generic-rating.vala
index 315240c8..62d8d0aa 100644
--- a/src/generic/generic-rating.vala
+++ b/src/generic/generic-rating.vala
@@ -3,6 +3,12 @@
 public class Games.GenericRating : Object, Rating {
        private float rating;
 
+       public bool has_loaded { get; protected set; }
+
+       construct {
+               has_loaded = true;
+       }
+
        public GenericRating (float rating) {
                this.rating = rating;
        }
diff --git a/src/grilo/grilo-rating.vala b/src/grilo/grilo-rating.vala
index 73042066..8edc301c 100644
--- a/src/grilo/grilo-rating.vala
+++ b/src/grilo/grilo-rating.vala
@@ -5,6 +5,8 @@ public class Games.GriloRating : Object, Rating {
        private float rating;
        private bool resolving;
 
+       public bool has_loaded { get; protected set; }
+
        public GriloRating (GriloMedia media) {
                this.media = media;
                media.resolved.connect (on_media_resolved);
@@ -36,6 +38,6 @@ public class Games.GriloRating : Object, Rating {
        private void load_media_rating (float media_rating) {
                rating = media_rating;
 
-               changed ();
+               has_loaded = true;
        }
 }


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