Commit 3fd5970f authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko Committed by Alexander Mikhaylenko

core: Remove Developer

Since the developers view doesn't exist anymore, it's unused.
parent 37bb1ffd
......@@ -39,7 +39,6 @@ private class Games.DreamcastPlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -51,7 +50,6 @@ private class Games.DreamcastPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -39,7 +39,6 @@ private class Games.GameCubePlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -51,7 +50,6 @@ private class Games.GameCubePlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -27,7 +27,6 @@ private class Games.MameGameUriAdapter : GameUriAdapter, Object {
var title = new GenericTitle (title_string);
var cover = new LocalCover (uri);
var developer = new GenericDeveloper (info.company);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -42,7 +41,6 @@ private class Games.MameGameUriAdapter : GameUriAdapter, Object {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -28,7 +28,6 @@ private class Games.MsDosPlugin : Object, Plugin {
var uid = new FingerprintUid (uri, PLATFORM_UID_PREFIX);
var title = new FilenameTitle (uri);
var media = new GriloMedia (title, MIME_TYPE);
var developer = new GriloDeveloper (media);
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
......@@ -46,7 +45,6 @@ private class Games.MsDosPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -33,7 +33,6 @@ private class Games.NintendoDsPlugin : Object, Plugin {
var title = new FilenameTitle (uri);
var icon = new NintendoDsIcon (uri);
var media = new GriloMedia (title, MIME_TYPE);
var developer = new GriloDeveloper (media);
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
......@@ -49,7 +48,6 @@ private class Games.NintendoDsPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_icon (icon);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -142,7 +142,6 @@ public class Games.PlayStationGameFactory : Object, UriGameFactory {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var input_capabilities = new GameinfoDiscIdInputCapabilities (gameinfo, disc_set_id);
var core_source = new RetroCoreSource (platform);
......@@ -156,7 +155,6 @@ public class Games.PlayStationGameFactory : Object, UriGameFactory {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -80,7 +80,6 @@ private class Games.SegaCDPlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -92,7 +91,6 @@ private class Games.SegaCDPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -63,7 +63,6 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -75,7 +74,6 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -42,7 +42,6 @@ private class Games.TurboGrafxCDPlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -54,7 +53,6 @@ private class Games.TurboGrafxCDPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -40,7 +40,6 @@ private class Games.VirtualBoyPlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -52,7 +51,6 @@ private class Games.VirtualBoyPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
......@@ -39,7 +39,6 @@ private class Games.WiiPlugin : Object, Plugin {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -51,7 +50,6 @@ private class Games.WiiPlugin : Object, Plugin {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
// This file is part of GNOME Games. License: GPL-3.0+.
public interface Games.Developer : Object {
public signal void changed ();
public abstract string get_developer ();
public static uint hash (Developer developer) {
return str_hash (developer.get_developer ());
}
public static bool equal (Developer a, Developer b) {
return str_equal (a.get_developer (), b.get_developer ());
}
public static int compare (Developer a, Developer b) {
return strcmp (a.get_developer (), b.get_developer ());
}
}
......@@ -6,7 +6,6 @@ public interface Games.Game : Object {
public abstract Uid get_uid ();
public abstract Icon get_icon ();
public abstract Cover get_cover ();
public abstract Developer get_developer ();
public abstract Platform get_platform ();
public abstract Runner get_runner () throws Error;
......
// This file is part of GNOME Games. License: GPL-3.0+.
private class Games.DatabaseDeveloper : Object, Developer {
private const string LOAD_DEVELOPER_QUERY = """
SELECT developer FROM game_metadata WHERE uid=$UID;
""";
private const string SAVE_DEVELOPER_QUERY = """
UPDATE game_metadata SET developer=$DEVELOPER WHERE uid=$UID;
""";
private Developer developer;
private Uid uid;
private Sqlite.Statement load_statement;
private Sqlite.Statement save_statement;
private string loaded;
public DatabaseDeveloper (Sqlite.Database database, Developer developer, Uid uid) {
this.developer = developer;
this.uid = uid;
developer.changed.connect (() => changed ());
try {
load_statement = Database.prepare (database, LOAD_DEVELOPER_QUERY);
save_statement = Database.prepare (database, SAVE_DEVELOPER_QUERY);
}
catch (Error e) {
warning (e.message);
}
}
public string get_developer () {
try {
if (loaded == null)
load_developer ();
if (loaded != "")
return loaded;
else
save_developer ();
}
catch (Error e) {
warning (e.message);
}
return developer.get_developer ();
}
private void load_developer () throws Error {
if (load_statement == null)
return;
Database.bind_text (load_statement, "$UID", uid.get_uid ());
if (load_statement.step () == Sqlite.ROW)
loaded = load_statement.column_text (0) ?? "";
else
warning ("Execution failed.");
}
private void save_developer () throws Error {
if (save_statement == null)
return;
loaded = developer.get_developer ();
if (loaded == "")
return;
Database.bind_text (save_statement, "$UID", uid.get_uid ());
Database.bind_text (save_statement, "$DEVELOPER", loaded);
if (save_statement.step () != Sqlite.DONE)
warning ("Execution failed.");
}
}
......@@ -25,10 +25,6 @@ private class Games.DatabaseGame : Object, Game {
return game.get_cover ();
}
public Developer get_developer () {
return database.get_developer (game.get_developer (), get_uid ());
}
public Platform get_platform () {
return game.get_platform ();
}
......
......@@ -67,10 +67,6 @@ private class Games.Database : Object {
return new DatabaseUid (database, uid);
}
public DatabaseDeveloper get_developer (Developer developer, Uid uid) {
return new DatabaseDeveloper (database, developer, uid);
}
private void create_tables () throws Error {
exec (CREATE_RESOURCES_TABLE_QUERY, null);
exec (CREATE_METADATA_TABLE_QUERY, null);
......
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.DummyDeveloper : Object, Developer {
public string get_developer () {
return "";
}
}
......@@ -30,10 +30,6 @@ private class Games.DummyGame : Object, Game {
return new DummyCover ();
}
public Developer get_developer () {
return new DummyDeveloper ();
}
public Platform get_platform () {
return new DummyPlatform ();
}
......
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.GenericDeveloper : Object, Developer {
private string developer;
public GenericDeveloper (string developer) {
this.developer = developer;
}
public string get_developer () {
return developer;
}
}
......@@ -21,7 +21,6 @@ public class Games.GenericGame : Object, Game {
private Uid game_uid;
private Title game_title;
private Icon game_icon;
private Developer game_developer;
private Cover game_cover;
private Platform game_platform;
private Runner game_runner;
......@@ -59,17 +58,6 @@ public class Games.GenericGame : Object, Game {
game_cover = cover;
}
public Developer get_developer () {
if (game_developer == null)
game_developer = new DummyDeveloper ();
return game_developer;
}
public void set_developer (Developer developer) {
game_developer = developer;
}
public Platform get_platform () {
return game_platform;
}
......
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.GriloDeveloper : Object, Developer {
private GriloMedia media;
private string developer;
private bool resolving;
private bool resolved;
public GriloDeveloper (GriloMedia media) {
this.media = media;
media.resolved.connect (on_media_resolved);
developer = "";
}
public string get_developer () {
if (resolving || resolved)
return developer;
resolving = true;
media.try_resolve_media ();
return developer;
}
private void on_media_resolved () {
var grl_media = media.get_media ();
if (grl_media == null)
return;
var registry = Grl.Registry.get_default ();
var metadata_key = registry.lookup_metadata_key ("developer");
if (grl_media.length (metadata_key) == 0)
return;
developer = grl_media.get_string (metadata_key);
resolved = true;
changed ();
}
}
......@@ -15,7 +15,6 @@ vala_sources = [
'command/command-runner.vala',
'core/cover.vala',
'core/developer.vala',
'core/game.vala',
'core/game-callback.vala',
'core/game-collection.vala',
......@@ -43,7 +42,6 @@ vala_sources = [
'core/uri-source.vala',
'database/database.vala',
'database/database-developer.vala',
'database/database-error.vala',
'database/database-game.vala',
'database/database-uid.vala',
......@@ -51,7 +49,6 @@ vala_sources = [
'database/database-uri-source.vala',
'dummy/dummy-cover.vala',
'dummy/dummy-developer.vala',
'dummy/dummy-game.vala',
'dummy/dummy-icon.vala',
'dummy/dummy-platform.vala',
......@@ -68,7 +65,6 @@ vala_sources = [
'gamepad/gamepad-input.vala',
'gamepad/gamepad-mapping-builder.vala',
'generic/generic-developer.vala',
'generic/generic-game.vala',
'generic/generic-game-uri-adapter.vala',
'generic/generic-platform.vala',
......@@ -77,7 +73,6 @@ vala_sources = [
'generic/generic-uri-game-factory.vala',
'grilo/grilo-cover.vala',
'grilo/grilo-developer.vala',
'grilo/grilo-media.vala',
'keyboard/keyboard-mapping-builder.vala',
......
......@@ -19,7 +19,6 @@ private class Games.RetroSimpleGameUriAdapter : GameUriAdapter, Object {
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var developer = new GriloDeveloper (media);
var core_source = new RetroCoreSource (platform);
var builder = new RetroRunnerBuilder ();
......@@ -31,7 +30,6 @@ private class Games.RetroSimpleGameUriAdapter : GameUriAdapter, Object {
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_developer (developer);
return game;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment