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



commit 3e8a2d44cfbd3cb38deac1a17c6fc6ada6fff1c4
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Oct 2 18:55:32 2018 +0500

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

 src/core/description.vala            | 2 +-
 src/dummy/dummy-description.vala     | 2 ++
 src/generic/generic-description.vala | 6 ++++++
 src/grilo/grilo-description.vala     | 9 ++++-----
 4 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/core/description.vala b/src/core/description.vala
index 69058c8a..b4d771de 100644
--- a/src/core/description.vala
+++ b/src/core/description.vala
@@ -1,7 +1,7 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public interface Games.Description : Object {
-       public signal void changed ();
+       public abstract bool has_loaded { get; protected set; }
 
        public abstract string get_description ();
 }
diff --git a/src/dummy/dummy-description.vala b/src/dummy/dummy-description.vala
index 53a40650..07571457 100644
--- a/src/dummy/dummy-description.vala
+++ b/src/dummy/dummy-description.vala
@@ -1,6 +1,8 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public class Games.DummyDescription : Object, Description {
+       public bool has_loaded { get; protected set; }
+
        public string get_description () {
                return "";
        }
diff --git a/src/generic/generic-description.vala b/src/generic/generic-description.vala
index fa08666f..41ba950c 100644
--- a/src/generic/generic-description.vala
+++ b/src/generic/generic-description.vala
@@ -3,6 +3,12 @@
 public class Games.GenericDescription : Object, Description {
        private string description;
 
+       public bool has_loaded { get; protected set; }
+
+       construct {
+               has_loaded = true;
+       }
+
        public GenericDescription (string description) {
                this.description = description;
        }
diff --git a/src/grilo/grilo-description.vala b/src/grilo/grilo-description.vala
index 7a9d824d..5b97f02b 100644
--- a/src/grilo/grilo-description.vala
+++ b/src/grilo/grilo-description.vala
@@ -4,7 +4,8 @@ public class Games.GriloDescription : Object, Description {
        private GriloMedia media;
        private string description;
        private bool resolving;
-       private bool resolved;
+
+       public bool has_loaded { get; protected set; }
 
        public GriloDescription (GriloMedia media) {
                this.media = media;
@@ -13,7 +14,7 @@ public class Games.GriloDescription : Object, Description {
        }
 
        public string get_description () {
-               if (resolving || resolved)
+               if (resolving || has_loaded)
                        return description;
 
                resolving = true;
@@ -33,8 +34,6 @@ public class Games.GriloDescription : Object, Description {
 
                description = grl_media.get_description ();
 
-               resolved = true;
-
-               changed ();
+               has_loaded = true;
        }
 }


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