[gnome-games/wip/exalm/cache2: 37/45] release-date: Add 'has-loaded' property and remove changed()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/cache2: 37/45] release-date: Add 'has-loaded' property and remove changed()
- Date: Mon, 8 Oct 2018 22:37:02 +0000 (UTC)
commit fa61b8b4f519f5f1cd7d07f63d6e035c808a398a
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Oct 2 18:56:50 2018 +0500
release-date: Add 'has-loaded' property and remove changed()
src/core/release-date.vala | 2 +-
src/dummy/dummy-release-date.vala | 2 ++
src/generic/generic-release-date.vala | 6 ++++++
src/grilo/grilo-release-date.vala | 9 ++++-----
4 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/core/release-date.vala b/src/core/release-date.vala
index 6461f2e6..ba00f60e 100644
--- a/src/core/release-date.vala
+++ b/src/core/release-date.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public interface Games.ReleaseDate : Object {
- public signal void changed ();
+ public abstract bool has_loaded { get; protected set; }
public abstract DateTime get_release_date ();
}
diff --git a/src/dummy/dummy-release-date.vala b/src/dummy/dummy-release-date.vala
index 2762e39b..7c9b742b 100644
--- a/src/dummy/dummy-release-date.vala
+++ b/src/dummy/dummy-release-date.vala
@@ -1,6 +1,8 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.DummyReleaseDate : Object, ReleaseDate {
+ public bool has_loaded { get; protected set; }
+
public DateTime get_release_date () {
return null;
}
diff --git a/src/generic/generic-release-date.vala b/src/generic/generic-release-date.vala
index ddf2e89c..81209198 100644
--- a/src/generic/generic-release-date.vala
+++ b/src/generic/generic-release-date.vala
@@ -3,6 +3,12 @@
public class Games.GenericReleaseDate : Object, ReleaseDate {
private DateTime release_date;
+ public bool has_loaded { get; protected set; }
+
+ construct {
+ has_loaded = true;
+ }
+
public GenericReleaseDate (DateTime release_date) {
this.release_date = release_date;
}
diff --git a/src/grilo/grilo-release-date.vala b/src/grilo/grilo-release-date.vala
index d4febe9a..1be39328 100644
--- a/src/grilo/grilo-release-date.vala
+++ b/src/grilo/grilo-release-date.vala
@@ -4,7 +4,8 @@ public class Games.GriloReleaseDate : Object, ReleaseDate {
private GriloMedia media;
private DateTime release_date;
private bool resolving;
- private bool resolved;
+
+ public bool has_loaded { get; protected set; }
public GriloReleaseDate (GriloMedia media) {
this.media = media;
@@ -13,7 +14,7 @@ public class Games.GriloReleaseDate : Object, ReleaseDate {
}
public DateTime get_release_date () {
- if (resolving || resolved)
+ if (resolving || has_loaded)
return release_date;
resolving = true;
@@ -33,8 +34,6 @@ public class Games.GriloReleaseDate : Object, ReleaseDate {
release_date = grl_media.get_publication_date ();
- resolved = true;
-
- changed ();
+ has_loaded = true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]