[gnome-games/wip/aplazas/781334-refactor-game-sources: 2/9] generic: Make GenericUriGameFactory handle schemes



commit d481d8ef6428278d9d6c80602eff730b69a7aece
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sat May 6 11:16:01 2017 +0200

    generic: Make GenericUriGameFactory handle schemes
    
    Add get_schemes() and add_scheme() to GenericUriGameFactory to allow its
    users to declare the kind of URI schemes they accept.

 src/generic/generic-uri-game-factory.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/generic/generic-uri-game-factory.vala b/src/generic/generic-uri-game-factory.vala
index 31077b5..08519d3 100644
--- a/src/generic/generic-uri-game-factory.vala
+++ b/src/generic/generic-uri-game-factory.vala
@@ -6,11 +6,13 @@ public class Games.GenericUriGameFactory : Object, UriGameFactory {
        private GameUriAdapter game_uri_adapter;
        private HashTable<Uri, Game> game_for_uri;
        private string[] mime_types;
+       private string[] schemes;
 
        public GenericUriGameFactory (GameUriAdapter game_uri_adapter) {
                this.game_uri_adapter = game_uri_adapter;
                game_for_uri = new HashTable<Uri, Game> (Uri.hash, Uri.equal);
                mime_types = {};
+               schemes = {};
        }
 
        public string[] get_mime_types () {
@@ -21,6 +23,14 @@ public class Games.GenericUriGameFactory : Object, UriGameFactory {
                mime_types += mime_type;
        }
 
+       public string[] get_schemes () {
+               return schemes;
+       }
+
+       public void add_scheme (string scheme) {
+               schemes += scheme;
+       }
+
        public async void add_uri (Uri uri) {
                Idle.add (this.add_uri.callback);
                yield;


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