[gnome-games/wip/exalm/cache2: 12/23] genre: Add 'has-loaded' property and remove changed()



commit a04ee7cb5d732aea25708a2266efa9c9bd077b6d
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     | 4 +++-
 4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/core/genre.vala b/src/core/genre.vala
index 6c7237eb..a806e1cd 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 List<string> get_genre ();
 }
diff --git a/src/dummy/dummy-genre.vala b/src/dummy/dummy-genre.vala
index 19379f80..37f8bd1f 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 List<string> genres;
 
+       public bool has_loaded { get; protected set; }
+
        construct {
                genres = new List<string> ();
        }
diff --git a/src/generic/generic-genre.vala b/src/generic/generic-genre.vala
index 3603cab8..41ce46f2 100644
--- a/src/generic/generic-genre.vala
+++ b/src/generic/generic-genre.vala
@@ -3,6 +3,12 @@
 public class Games.GenericGenre : Object, Genre {
        private List<string> genre;
 
+       public bool has_loaded { get; protected set; }
+
+       construct {
+               has_loaded = true;
+       }
+
        public GenericGenre (List<string> genre) {
                this.genre = genre.copy ();
        }
diff --git a/src/grilo/grilo-genre.vala b/src/grilo/grilo-genre.vala
index 129fb1ee..0894e11c 100644
--- a/src/grilo/grilo-genre.vala
+++ b/src/grilo/grilo-genre.vala
@@ -5,6 +5,8 @@ public class Games.GriloGenre : Object, Genre {
        private List<string> genre;
        private bool resolving;
 
+       public bool has_loaded { get; protected set; }
+
        public GriloGenre (GriloMedia media) {
                this.media = media;
                media.resolved.connect (on_media_resolved);
@@ -46,6 +48,6 @@ public class Games.GriloGenre : Object, Genre {
        private void load_media_genre (List<string> genre_list) {
                genre = genre_list.copy ();
 
-               changed ();
+               has_loaded = true;
        }
 }


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