[gnome-games] desktop: Replace DesktopGame by GenericGame
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] desktop: Replace DesktopGame by GenericGame
- Date: Thu, 12 May 2016 16:53:09 +0000 (UTC)
commit 1bbf3ae57f5f6e68f99400cdd22b8254a3b2b93e
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu May 12 08:30:20 2016 +0200
desktop: Replace DesktopGame by GenericGame
This is needed to remove custom game types and to simplify the code
base.
plugins/desktop/src/Makefile.am | 1 -
plugins/desktop/src/desktop-game.vala | 34 ------------------------
plugins/desktop/src/desktop-tracker-query.vala | 16 ++++++++++-
3 files changed, 15 insertions(+), 36 deletions(-)
---
diff --git a/plugins/desktop/src/Makefile.am b/plugins/desktop/src/Makefile.am
index a12f0c9..5ee4f45 100644
--- a/plugins/desktop/src/Makefile.am
+++ b/plugins/desktop/src/Makefile.am
@@ -30,7 +30,6 @@ libgames_desktop_plugin_la_DEPENDENCIES = \
libgames_desktop_plugin_la_SOURCES = \
desktop-error.vala \
- desktop-game.vala \
desktop-icon.vala \
desktop-plugin.vala \
desktop-title.vala \
diff --git a/plugins/desktop/src/desktop-tracker-query.vala b/plugins/desktop/src/desktop-tracker-query.vala
index 2fc1e89..7a01307 100644
--- a/plugins/desktop/src/desktop-tracker-query.vala
+++ b/plugins/desktop/src/desktop-tracker-query.vala
@@ -25,7 +25,21 @@ private class Games.DesktopTrackerQuery : Object, TrackerQuery {
var uri = cursor.get_string (0);
check_uri (uri);
- return new DesktopGame (uri);
+ var file = File.new_for_uri (uri);
+ var path = file.get_path ();
+
+ var app_info = new DesktopAppInfo.from_filename (path);
+ var title = new DesktopTitle (app_info);
+ var icon = new DesktopIcon (app_info);
+ var cover = new DummyCover ();
+
+ string[] args;
+ var command = app_info.get_commandline ();
+ if (!Shell.parse_argv (command, out args))
+ throw new CommandError.INVALID_COMMAND ("Invalid command '%s'", command);
+ var runner = new CommandRunner (args, true);
+
+ return new GenericGame (title, icon, cover, runner);
}
private void check_uri (string uri) throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]