[gnome-games/wip/exalm/metadata: 16/21] grilo-rating: Provide empty value
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/metadata: 16/21] grilo-rating: Provide empty value
- Date: Mon, 8 Oct 2018 21:43:09 +0000 (UTC)
commit ed7240bdbc2ab7e46161b2bc8b4176c9f9d521f4
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Oct 9 02:30:40 2018 +0500
grilo-rating: Provide empty value
Return 0 instead of null while it's loading.
src/grilo/grilo-rating.vala | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/grilo/grilo-rating.vala b/src/grilo/grilo-rating.vala
index 73042066..bf0347a2 100644
--- a/src/grilo/grilo-rating.vala
+++ b/src/grilo/grilo-rating.vala
@@ -4,19 +4,21 @@ public class Games.GriloRating : Object, Rating {
private GriloMedia media;
private float rating;
private bool resolving;
+ private bool resolved;
public GriloRating (GriloMedia media) {
this.media = media;
media.resolved.connect (on_media_resolved);
- resolving = false;
+ rating = 0;
}
public float get_rating () {
- if (resolving)
+ if (resolving || resolved)
return rating;
resolving = true;
media.try_resolve_media ();
+
return rating;
}
@@ -36,6 +38,8 @@ public class Games.GriloRating : Object, Rating {
private void load_media_rating (float media_rating) {
rating = media_rating;
+ resolved = true;
+
changed ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]