[gnome-games/wip/exalm/uid: 5/18] dreamcast: Remove DreamcastUid



commit bb142e9a74d32dc8989d8bced98148885ec948ea
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Feb 21 16:14:09 2020 +0500

    dreamcast: Remove DreamcastUid
    
    Replace it with GenericUid and a simple function.

 plugins/dreamcast/src/dreamcast-plugin.vala |  9 ++++++++-
 plugins/dreamcast/src/dreamcast-uid.vala    | 21 ---------------------
 plugins/dreamcast/src/meson.build           |  1 -
 3 files changed, 8 insertions(+), 23 deletions(-)
---
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index 0229c113..526012bf 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -34,12 +34,19 @@ private class Games.DreamcastPlugin : Object, Plugin {
                return { factory };
        }
 
+       private static string get_uid (DreamcastHeader header) throws Error {
+               var product_number = header.get_product_number ();
+               var areas = header.get_areas ();
+
+               return @"$PLATFORM_UID_PREFIX-$product_number-$areas".down ();
+       }
+
        private static Game game_for_uri (Uri uri) throws Error {
                var file = uri.to_file ();
                var header = new DreamcastHeader (file);
                header.check_validity ();
 
-               var uid = new DreamcastUid (header);
+               var uid = new GenericUid (get_uid (header));
                var title = new FilenameTitle (uri);
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new CompositeCover ({
diff --git a/plugins/dreamcast/src/meson.build b/plugins/dreamcast/src/meson.build
index c3e9d2e1..c5bd577f 100644
--- a/plugins/dreamcast/src/meson.build
+++ b/plugins/dreamcast/src/meson.build
@@ -1,7 +1,6 @@
 vala_sources = [
   'dreamcast-header.vala',
   'dreamcast-plugin.vala',
-  'dreamcast-uid.vala',
 ]
 
 c_args = [


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