[gnome-games/wip/exalm/cache2: 33/45] genre: 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: 33/45] genre: Add 'has-loaded' property and remove changed()
- Date: Mon, 8 Oct 2018 22:36:42 +0000 (UTC)
commit b2fdce30316c62420d60c2ed5584079d02d1e23e
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Oct 2 18:55:49 2018 +0500
genre: Add 'has-loaded' property and remove changed()
src/core/genre.vala | 2 +-
src/dummy/dummy-genre.vala | 2 ++
src/generic/generic-genre.vala | 6 ++++++
src/grilo/grilo-genre.vala | 9 ++++-----
4 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/core/genre.vala b/src/core/genre.vala
index 8411d214..84a0be86 100644
--- a/src/core/genre.vala
+++ b/src/core/genre.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public interface Games.Genre : Object {
- public signal void changed ();
+ public abstract bool has_loaded { get; protected set; }
public abstract unowned string[] get_genre ();
}
diff --git a/src/dummy/dummy-genre.vala b/src/dummy/dummy-genre.vala
index b23b6c0f..97ba1bf4 100644
--- a/src/dummy/dummy-genre.vala
+++ b/src/dummy/dummy-genre.vala
@@ -4,6 +4,8 @@ public class Games.DummyGenre : Object, Genre {
// This is needed because get_genre() can't transfer ownership of the list.
private string[] genres;
+ public bool has_loaded { get; protected set; }
+
construct {
genres = {};
}
diff --git a/src/generic/generic-genre.vala b/src/generic/generic-genre.vala
index 3ffd7b2c..d66fa0a6 100644
--- a/src/generic/generic-genre.vala
+++ b/src/generic/generic-genre.vala
@@ -3,6 +3,12 @@
public class Games.GenericGenre : Object, Genre {
private string[] genre;
+ public bool has_loaded { get; protected set; }
+
+ construct {
+ has_loaded = true;
+ }
+
public GenericGenre (string[] genre) {
this.genre = genre.copy ();
}
diff --git a/src/grilo/grilo-genre.vala b/src/grilo/grilo-genre.vala
index b221dcb1..2aa3e24b 100644
--- a/src/grilo/grilo-genre.vala
+++ b/src/grilo/grilo-genre.vala
@@ -4,7 +4,8 @@ public class Games.GriloGenre : Object, Genre {
private GriloMedia media;
private string[] genre;
private bool resolving;
- private bool resolved;
+
+ public bool has_loaded { get; protected set; }
public GriloGenre (GriloMedia media) {
this.media = media;
@@ -13,7 +14,7 @@ public class Games.GriloGenre : Object, Genre {
}
public unowned string[] get_genre () {
- if (resolving || resolved)
+ if (resolving || has_loaded)
return genre;
resolving = true;
@@ -36,8 +37,6 @@ public class Games.GriloGenre : Object, Genre {
for (uint index = 0; index < genre_count; index++)
genre += grl_media.get_genre_nth (index);
- resolved = true;
-
- changed ();
+ has_loaded = true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]