[gnome-games/wip/aplazas/781334-refactor-game-sources: 22/27] playstation: Build PlayStationUid from disc ID



commit 934ef25dce40551ce60a7c842e9c681c1d2cef8c
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri May 5 14:35:36 2017 +0200

    playstation: Build PlayStationUid from disc ID
    
    Give more plexibility when building a PlayStationUid as the disc ID
    doesn't have to come from a disc header.
    
    This is needed to build UIDs from disc set IDs coming from the
    PlayStation game database.

 .../playstation/src/playstation-game-factory.vala  |    2 +-
 plugins/playstation/src/playstation-uid.vala       |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/plugins/playstation/src/playstation-game-factory.vala 
b/plugins/playstation/src/playstation-game-factory.vala
index 75026b0..489739b 100644
--- a/plugins/playstation/src/playstation-game-factory.vala
+++ b/plugins/playstation/src/playstation-game-factory.vala
@@ -149,7 +149,7 @@ public class Games.PlayStationGameFactory : Object, UriGameFactory {
                header.check_validity ();
 
                var gameinfo = get_gameinfo ();
-               var uid = new PlayStationUid (header);
+               var uid = new PlayStationUid (header.disc_id);
                var title = new CompositeTitle ({
                        new GameinfoDiscIdGameTitle (gameinfo, header.disc_id),
                        new FilenameTitle (uri)
diff --git a/plugins/playstation/src/playstation-uid.vala b/plugins/playstation/src/playstation-uid.vala
index b4aa489..279349c 100644
--- a/plugins/playstation/src/playstation-uid.vala
+++ b/plugins/playstation/src/playstation-uid.vala
@@ -1,19 +1,18 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 private class Games.PlayStationUid: Object, Uid {
-       private PlayStationHeader header;
+       private string disc_set_id;
        private string uid;
 
-       public PlayStationUid (PlayStationHeader header) {
-               this.header = header;
+       public PlayStationUid (string disc_set_id) {
+               this.disc_set_id = disc_set_id;
        }
 
        public string get_uid () throws Error {
                if (uid != null)
                        return uid;
 
-               var disc_id = header.disc_id;
-               uid = @"playstation-$disc_id".down ();
+               uid = @"playstation-$disc_set_id".down ();
 
                return uid;
        }


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