[gnome-games/wip/exalm/cache2: 34/45] players: 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: 34/45] players: Add 'has-loaded' property and remove changed()
- Date: Mon, 8 Oct 2018 22:36:47 +0000 (UTC)
commit 94f54404fd515228c3bb1c19a38966c65fc93916
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Oct 2 18:56:05 2018 +0500
players: Add 'has-loaded' property and remove changed()
src/core/players.vala | 2 +-
src/dummy/dummy-players.vala | 2 ++
src/generic/generic-players.vala | 6 ++++++
src/grilo/grilo-players.vala | 9 ++++-----
4 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/core/players.vala b/src/core/players.vala
index bcf28555..35905b3d 100644
--- a/src/core/players.vala
+++ b/src/core/players.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public interface Games.Players : Object {
- public signal void changed ();
+ public abstract bool has_loaded { get; protected set; }
public abstract string get_players ();
}
diff --git a/src/dummy/dummy-players.vala b/src/dummy/dummy-players.vala
index 0f015d91..7acb1c7c 100644
--- a/src/dummy/dummy-players.vala
+++ b/src/dummy/dummy-players.vala
@@ -1,6 +1,8 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.DummyPlayers : Object, Players {
+ public bool has_loaded { get; protected set; }
+
public string get_players () {
return "";
}
diff --git a/src/generic/generic-players.vala b/src/generic/generic-players.vala
index 549a865d..917db04c 100644
--- a/src/generic/generic-players.vala
+++ b/src/generic/generic-players.vala
@@ -3,6 +3,12 @@
public class Games.GenericPlayers : Object, Players {
private string players;
+ public bool has_loaded { get; protected set; }
+
+ construct {
+ has_loaded = true;
+ }
+
public GenericPlayers (string players) {
this.players = players;
}
diff --git a/src/grilo/grilo-players.vala b/src/grilo/grilo-players.vala
index 7ab4fddc..0cb69d6e 100644
--- a/src/grilo/grilo-players.vala
+++ b/src/grilo/grilo-players.vala
@@ -4,7 +4,8 @@ public class Games.GriloPlayers : Object, Players {
private GriloMedia media;
private string players;
private bool resolving;
- private bool resolved;
+
+ public bool has_loaded { get; protected set; }
public GriloPlayers (GriloMedia media) {
this.media = media;
@@ -13,7 +14,7 @@ public class Games.GriloPlayers : Object, Players {
}
public string get_players () {
- if (resolving || resolved)
+ if (resolving || has_loaded)
return players;
resolving = true;
@@ -41,8 +42,6 @@ public class Games.GriloPlayers : Object, Players {
else
players = _("Multi-player");
- resolved = true;
-
- changed ();
+ has_loaded = true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]