[gnome-games/wip/exalm/cache2: 15/28] players: Add 'has-loaded' property and remove changed()



commit c12dec13bf4c55f3e5ecd92ceb5588e61b3a901b
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     | 4 +++-
 4 files changed, 12 insertions(+), 2 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 d32e5db8..825f9cd8 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 _("Not available");
        }
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 e31f0943..dd9b33e8 100644
--- a/src/grilo/grilo-players.vala
+++ b/src/grilo/grilo-players.vala
@@ -5,6 +5,8 @@ public class Games.GriloPlayers : Object, Players {
        private string players;
        private bool resolving;
 
+       public bool has_loaded { get; protected set; }
+
        public GriloPlayers (GriloMedia media) {
                this.media = media;
                media.resolved.connect (on_media_resolved);
@@ -49,6 +51,6 @@ public class Games.GriloPlayers : Object, Players {
        private void load_media_players (string player) {
                players = player;
 
-               changed ();
+               has_loaded = true;
        }
 }


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