[gnome-games] retro: Move platform names to their own file



commit 42f6ef47cde348f15ec721e4c58212e9fa4d05cf
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Feb 17 05:43:41 2017 +0100

    retro: Move platform names to their own file

 src/Makefile.am               |    1 +
 src/retro/retro-platform.vala |   74 +++++++++++++++++++++++++++++++++++++++++
 src/retro/retro-runner.vala   |   73 +---------------------------------------
 3 files changed, 76 insertions(+), 72 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 288b6b3..c87572d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -92,6 +92,7 @@ gnome_games_SOURCES = \
        retro/retro-error.vala \
        retro/retro-gamepad.vala \
        retro/retro-input-manager.vala \
+       retro/retro-platform.vala \
        retro/retro-runner.vala \
        \
        tracker/mime-type-tracker-query.vala \
diff --git a/src/retro/retro-platform.vala b/src/retro/retro-platform.vala
new file mode 100644
index 0000000..e3ad3e5
--- /dev/null
+++ b/src/retro/retro-platform.vala
@@ -0,0 +1,74 @@
+// This file is part of GNOME Games. License: GPLv3
+
+namespace Games.RetroPlatform {
+       private string? get_platform_name (string platform) {
+               switch (platform) {
+               case "Atari2600":
+                       return _("Atari 2600");
+               case "Atari5200":
+                       return _("Atari 5200");
+               case "Atari7800":
+                       return _("Atari 7800");
+               case "Dreamcast":
+                       return _("Dreamcast");
+               case "FamicomDiskSystem":
+                       return _("Famicom Disk System");
+               case "GameBoy":
+                       return _("Game Boy");
+               case "GameBoyColor":
+                       return _("Game Boy Color");
+               case "GameBoyAdvance":
+                       return _("Game Boy Advance");
+               case "GameCube":
+                       return _("Nintendo GameCube");
+               case "GameGear":
+                       return _("Game Gear");
+               case "NintendoEntertainmentSystem":
+                       return _("Nintendo Entertainment System");
+               case "Nintendo64":
+                       return _("Nintendo 64");
+               case "NintendoDS":
+                       return _("Nintendo DS");
+               case "Nintendo3DS":
+                       return _("Nintendo 3DS");
+               case "PlayStation":
+                       return _("PlayStation");
+               case "PlayStation2":
+                       return _("PlayStation 2");
+               case "PlayStation3":
+                       return _("PlayStation 3");
+               case "PlayStation4":
+                       return _("PlayStation 4");
+               case "PlayStationPortable":
+                       return _("PlayStation Portable");
+               case "PlayStationVita":
+                       return _("PlayStation Vita");
+               case "Sega32X":
+                       return _("Genesis 32X");
+               case "SegaCD":
+                       return _("Sega CD");
+               case "SegaCD32X":
+                       return _("Sega CD 32X");
+               case "SegaGenesis":
+                       return _("Sega Genesis");
+               case "SegaMasterSystem":
+                       return _("Sega Master System");
+               case "SegaSaturn":
+                       return _("Sega Saturn");
+               case "SG1000":
+                       return _("SG-1000");
+               case "SuperNintendoEntertainmentSystem":
+                       return _("Super Nintendo Entertainment System");
+               case "TurboGrafx16":
+                       return _("TurboGrafx-16");
+               case "TurboGrafxCD":
+                       return _("TurboGrafx-CD");
+               case "Wii":
+                       return _("Wii");
+               case "WiiU":
+                       return _("Wii U");
+               default:
+                       return null;
+               }
+       }
+}
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index a63ae30..6fe2210 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -509,81 +509,10 @@ public class Games.RetroRunner : Object, Runner {
 
        private string get_unsupported_system_message () {
                var platform = core_source.get_platform ();
-               var platform_name = get_platform_name (platform);
+               var platform_name = RetroPlatform.get_platform_name (platform);
                if (platform_name == null)
                        return _("The system isn't supported yet. Full support will come!");
                else
                        return _("The system ā€œ%sā€ isn't supported yet. Full support will come!").printf 
(platform_name);
        }
-
-       private static string? get_platform_name (string platform) {
-               switch (platform) {
-               case "Atari2600":
-                       return _("Atari 2600");
-               case "Atari5200":
-                       return _("Atari 5200");
-               case "Atari7800":
-                       return _("Atari 7800");
-               case "Dreamcast":
-                       return _("Dreamcast");
-               case "FamicomDiskSystem":
-                       return _("Famicom Disk System");
-               case "GameBoy":
-                       return _("Game Boy");
-               case "GameBoyColor":
-                       return _("Game Boy Color");
-               case "GameBoyAdvance":
-                       return _("Game Boy Advance");
-               case "GameCube":
-                       return _("GameCube");
-               case "GameGear":
-                       return _("Game Gear");
-               case "NintendoEntertainmentSystem":
-                       return _("Nintendo Entertainment System");
-               case "Nintendo64":
-                       return _("Nintendo 64");
-               case "NintendoDS":
-                       return _("Nintendo DS");
-               case "Nintendo3DS":
-                       return _("Nintendo 3DS");
-               case "PlayStation":
-                       return _("PlayStation");
-               case "PlayStation2":
-                       return _("PlayStation 2");
-               case "PlayStation3":
-                       return _("PlayStation 3");
-               case "PlayStation4":
-                       return _("PlayStation 4");
-               case "PlayStationPortable":
-                       return _("PlayStation Portable");
-               case "PlayStationVita":
-                       return _("PlayStation Vita");
-               case "Sega32X":
-                       return _("Genesis 32X");
-               case "SegaCD":
-                       return _("Sega CD");
-               case "SegaCD32X":
-                       return _("Sega CD 32X");
-               case "SegaGenesis":
-                       return _("Sega Genesis");
-               case "SegaMasterSystem":
-                       return _("Sega Master System");
-               case "SegaSaturn":
-                       return _("Sega Saturn");
-               case "SG1000":
-                       return _("SG-1000");
-               case "SuperNintendoEntertainmentSystem":
-                       return _("Super Nintendo Entertainment System");
-               case "TurboGrafx16":
-                       return _("TurboGrafx-16");
-               case "TurboGrafxCD":
-                       return _("TurboGrafx-CD");
-               case "Wii":
-                       return _("Wii");
-               case "WiiU":
-                       return _("Wii U");
-               default:
-                       return null;
-               }
-       }
 }


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