[gnome-games/wip/exalm/uid: 9/18] sega-saturn: Remove SegaSaturnUid



commit 23b1bb84847e4d4a1deeb78e5af6f010dae5b6f9
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Feb 21 16:28:43 2020 +0500

    sega-saturn: Remove SegaSaturnUid
    
    Replace it with GenericUid and a simple function.

 plugins/sega-saturn/src/meson.build             |  1 -
 plugins/sega-saturn/src/sega-saturn-plugin.vala |  9 ++++++++-
 plugins/sega-saturn/src/sega-saturn-uid.vala    | 21 ---------------------
 3 files changed, 8 insertions(+), 23 deletions(-)
---
diff --git a/plugins/sega-saturn/src/meson.build b/plugins/sega-saturn/src/meson.build
index 5bb3efa9..7d39aca4 100644
--- a/plugins/sega-saturn/src/meson.build
+++ b/plugins/sega-saturn/src/meson.build
@@ -2,7 +2,6 @@ vala_sources = [
   'sega-saturn-error.vala',
   'sega-saturn-header.vala',
   'sega-saturn-plugin.vala',
-  'sega-saturn-uid.vala',
 ]
 
 c_args = [
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index fe79b1d7..b510ec9c 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -40,6 +40,13 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
                return { factory };
        }
 
+       private static string get_uid (SegaSaturnHeader 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 file_info = file.query_info (FileAttribute.STANDARD_CONTENT_TYPE, 
FileQueryInfoFlags.NONE);
@@ -63,7 +70,7 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
                var header = new SegaSaturnHeader (bin_file);
                header.check_validity ();
 
-               var uid = new SegaSaturnUid (header);
+               var uid = new GenericUid (get_uid (header));
                var title = new FilenameTitle (uri);
                var media = new GriloMedia (title, SEGA_SATURN_MIME_TYPE);
                var cover = new CompositeCover ({


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