Skip to content

Commit

Permalink
Fixes for CompatTools
Browse files Browse the repository at this point in the history
Former-commit-id: 24600df
  • Loading branch information
tkashkin committed Sep 23, 2018
1 parent 62e131d commit a526ed7
Show file tree
Hide file tree
Showing 23 changed files with 166 additions and 69 deletions.
2 changes: 1 addition & 1 deletion appimage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ build_deb()
set -e
echo "[appimage/build.sh] Building deb package"
cd "$_ROOT"
export DEB_BUILD_OPTIONS="nostrip,nocheck"
export DEB_BUILD_OPTIONS="nostrip nocheck"
dpkg-buildpackage -b -us -uc
mkdir -p "build/$_BUILD_IMAGE"
mv ../*.deb "build/$_BUILD_IMAGE/GameHub-$_VERSION-amd64.deb"
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.11.1-{build}-{branch}
version: 0.11.2-{build}-{branch}

pull_requests:
do_not_increment_build_number: true
Expand Down
13 changes: 13 additions & 0 deletions data/GameHub.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ list.installers-list
background: transparent;
}


GtkListBox.installers-list .list-row,
list.installers-list row
{
border-radius: 2px;
}

GtkListBox.downloads-list .list-row,
list.downloads-list row
{
Expand Down Expand Up @@ -302,6 +309,7 @@ list.tags-list row
outline: none;
padding: 0;
margin: 0;
border-radius: 2px;
}
GtkListBox.tags-list .list-row:last-child,
list.tags-list row:last-child
Expand Down Expand Up @@ -333,3 +341,8 @@ list.tags-list row:hover
{
padding: 2px 0;
}

.link, .link label
{
padding: 0;
}
5 changes: 5 additions & 0 deletions data/com.github.tkashkin.gamehub.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
</screenshots>

<releases>
<release type="development" version="0.11.2" date="2018-09-23">
<description>
<p>Fixes for CompatTools</p>
</description>
</release>
<release type="development" version="0.11.1" date="2018-09-19">
<description>
<p>Updated pt_BR localization</p>
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
com.github.tkashkin.gamehub (0.11.2) xenial; urgency=low

* Fixes for CompatTools

-- tkashkin <[email protected]> Sun, 23 Sep 2018 08:55:24 +0300

com.github.tkashkin.gamehub (0.11.1) xenial; urgency=low

* Updated pt_BR localization
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.11.1')
project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.11.2')

i18n = import('i18n')
gnome = import('gnome')
Expand Down
40 changes: 40 additions & 0 deletions po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ msgctxt "tag"
msgid "Installed"
msgstr "Установленные"

msgctxt "tag"
msgid "Not installed"
msgstr "Не установленные"

#: src/data/db/tables/Tags.vala:150
msgctxt "tag"
msgid "Hidden"
Expand Down Expand Up @@ -719,3 +723,39 @@ msgstr "Избранные"
#: src/ui/widgets/CompatToolPicker.vala:32
msgid "Compatibility layer:"
msgstr "Слой совместимости:"

msgctxt "status_header"
msgid "Installing"
msgstr "Установка"

msgctxt "status_header"
msgid "Not installed"
msgstr "Не установленные"

msgctxt "status_header"
msgid "Installed"
msgstr "Установленные"

msgctxt "status_header"
msgid "Downloading"
msgstr "Загрузка"

msgctxt "status"
msgid "Installing"
msgstr "Установка"

msgctxt "status"
msgid "Not installed"
msgstr "Не установлена"

msgctxt "status"
msgid "Installed"
msgstr "Установлена"

msgctxt "status"
msgid "Downloading"
msgstr "Загрузка"

msgctxt "status"
msgid "Download started"
msgstr "Загрузка начата"
4 changes: 2 additions & 2 deletions src/data/Game.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace GameHub.Data
{
tags.add(tag);
}
if(tag != Tables.Tags.BUILTIN_INSTALLED)
if(!(tag in Tables.Tags.DYNAMIC_TAGS))
{
Tables.Games.add(this);
status_change(_status);
Expand All @@ -70,7 +70,7 @@ namespace GameHub.Data
{
tags.remove(tag);
}
if(tag != Tables.Tags.BUILTIN_INSTALLED)
if(!(tag in Tables.Tags.DYNAMIC_TAGS))
{
Tables.Games.add(this);
status_change(_status);
Expand Down
21 changes: 8 additions & 13 deletions src/data/compat/DOSBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,9 @@ namespace GameHub.Data.Compat
id = @"dosbox";
name = @"DOSBox";
icon = "tool-dosbox-symbolic";
installed = false;

var which = Utils.run({"which", binary}).strip();

if("not found" in which)
{
installed = false;
}
else
{
executable = FSUtils.file(which);
installed = executable.query_exists();
}
executable = Utils.find_executable(binary);
installed = executable != null && executable.query_exists();

conf_windowed = FSUtils.file(ProjectConfig.DATADIR + "/" + ProjectConfig.PROJECT_NAME, "compat/dosbox/windowed.conf");
if(conf_windowed.query_exists())
Expand All @@ -43,10 +33,15 @@ namespace GameHub.Data.Compat
}
}

private static ArrayList<string> find_configs(File dir)
private static ArrayList<string> find_configs(File? dir)
{
var configs = new ArrayList<string>();

if(dir == null || !dir.query_exists())
{
return configs;
}

try
{
FileInfo? finfo = null;
Expand Down
16 changes: 3 additions & 13 deletions src/data/compat/Innoextract.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,9 @@ namespace GameHub.Data.Compat
id = @"innoextract";
name = @"Innoextract";
icon = "package-x-generic-symbolic";
installed = false;

var which = Utils.run({"which", binary}).strip();

if("not found" in which)
{
installed = false;
}
else
{
executable = FSUtils.file(which);
installed = executable.query_exists();
}

executable = Utils.find_executable(binary);
installed = executable != null && executable.query_exists();
}

public override bool can_install(Game game)
Expand Down
2 changes: 1 addition & 1 deletion src/data/compat/Proton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace GameHub.Data.Compat

public Proton(string appid)
{
Object(appid: appid, binary: "proton");
Object(appid: appid, binary: "");
}

construct
Expand Down
19 changes: 4 additions & 15 deletions src/data/compat/Wine.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace GameHub.Data.Compat
{
public class Wine: CompatTool
{
public string binary { get; construct; default = "wine"; }
public File wine_binary { get; protected set; }
public string? binary { get; construct; default = "wine"; }
public File? wine_binary { get; protected set; }

public Wine(string binary="wine")
{
Expand All @@ -19,20 +19,9 @@ namespace GameHub.Data.Compat
id = @"wine_$(binary)";
name = @"Wine ($(binary))";
icon = "tool-wine-symbolic";
installed = false;

var which = Utils.run({"which", binary}).strip();

if("not found" in which)
{
installed = false;
}
else
{
executable = FSUtils.file(which);
installed = executable.query_exists();
wine_binary = executable;
}
executable = wine_binary = Utils.find_executable(binary);
installed = executable != null && executable.query_exists();

install_options = {
new CompatTool.Option("/SILENT", _("Silent installation"), false),
Expand Down
33 changes: 22 additions & 11 deletions src/data/db/tables/Tags.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ namespace GameHub.Data.DB.Tables
public static Table.Field SELECTED;

public static ArrayList<Tag> TAGS;
public static ArrayList<Tag> DYNAMIC_TAGS;

public static Tag BUILTIN_FAVORITES;
public static Tag BUILTIN_UNINSTALLED;
public static Tag BUILTIN_INSTALLED;
public static Tag BUILTIN_HIDDEN;

Expand All @@ -36,6 +38,7 @@ namespace GameHub.Data.DB.Tables
SELECTED = f(3);

TAGS = new ArrayList<Tag>(Tag.is_equal);
DYNAMIC_TAGS = new ArrayList<Tag>(Tag.is_equal);
}

public override void migrate(Sqlite.Database db, int version)
Expand Down Expand Up @@ -66,22 +69,27 @@ namespace GameHub.Data.DB.Tables
if(!TAGS.contains(tag)) TAGS.add(tag);

if(BUILTIN_FAVORITES == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.FAVORITES.id()) BUILTIN_FAVORITES = tag;
if(BUILTIN_UNINSTALLED == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.UNINSTALLED.id()) BUILTIN_UNINSTALLED = tag;
if(BUILTIN_INSTALLED == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.INSTALLED.id()) BUILTIN_INSTALLED = tag;
if(BUILTIN_HIDDEN == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.HIDDEN.id()) BUILTIN_HIDDEN = tag;
}

Tag.Builtin[] builtin = { Tag.Builtin.FAVORITES, Tag.Builtin.INSTALLED, Tag.Builtin.HIDDEN };
Tag.Builtin[] builtin = { Tag.Builtin.FAVORITES, Tag.Builtin.UNINSTALLED, Tag.Builtin.INSTALLED, Tag.Builtin.HIDDEN };

foreach(var bt in builtin)
{
var tag = new Tag.from_builtin(bt);
Tags.add(tag);

if(BUILTIN_FAVORITES == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.FAVORITES.id()) BUILTIN_FAVORITES = tag;
if(BUILTIN_UNINSTALLED == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.UNINSTALLED.id()) BUILTIN_UNINSTALLED = tag;
if(BUILTIN_INSTALLED == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.INSTALLED.id()) BUILTIN_INSTALLED = tag;
if(BUILTIN_HIDDEN == null && tag.id == Tag.BUILTIN_PREFIX + Tag.Builtin.HIDDEN.id()) BUILTIN_HIDDEN = tag;
}

DYNAMIC_TAGS.add(BUILTIN_UNINSTALLED);
DYNAMIC_TAGS.add(BUILTIN_INSTALLED);

tags_updated();
}

Expand Down Expand Up @@ -128,15 +136,16 @@ namespace GameHub.Data.DB.Tables

public enum Builtin
{
FAVORITES, INSTALLED, HIDDEN;
FAVORITES, UNINSTALLED, INSTALLED, HIDDEN;

public string id()
{
switch(this)
{
case Builtin.FAVORITES: return "favorites";
case Builtin.INSTALLED: return "installed";
case Builtin.HIDDEN: return "hidden";
case Builtin.FAVORITES: return "favorites";
case Builtin.UNINSTALLED: return "uninstalled";
case Builtin.INSTALLED: return "installed";
case Builtin.HIDDEN: return "hidden";
}
assert_not_reached();
}
Expand All @@ -145,9 +154,10 @@ namespace GameHub.Data.DB.Tables
{
switch(this)
{
case Builtin.FAVORITES: return C_("tag", "Favorites");
case Builtin.INSTALLED: return C_("tag", "Installed");
case Builtin.HIDDEN: return C_("tag", "Hidden");
case Builtin.FAVORITES: return C_("tag", "Favorites");
case Builtin.UNINSTALLED: return C_("tag", "Not installed");
case Builtin.INSTALLED: return C_("tag", "Installed");
case Builtin.HIDDEN: return C_("tag", "Hidden");
}
assert_not_reached();
}
Expand All @@ -156,9 +166,10 @@ namespace GameHub.Data.DB.Tables
{
switch(this)
{
case Builtin.FAVORITES: return "gh-tag-favorites-symbolic";
case Builtin.INSTALLED: return "gh-tag-symbolic";
case Builtin.HIDDEN: return "gh-tag-hidden-symbolic";
case Builtin.FAVORITES: return "gh-tag-favorites-symbolic";
case Builtin.UNINSTALLED: return "gh-tag-symbolic";
case Builtin.INSTALLED: return "gh-tag-symbolic";
case Builtin.HIDDEN: return "gh-tag-hidden-symbolic";
}
assert_not_reached();
}
Expand Down
2 changes: 2 additions & 0 deletions src/data/sources/gog/GOGGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,12 @@ namespace GameHub.Data.Sources.GOG
status = new Game.Status(state);
if(state == Game.State.INSTALLED)
{
remove_tag(Tables.Tags.BUILTIN_UNINSTALLED);
add_tag(Tables.Tags.BUILTIN_INSTALLED);
}
else
{
add_tag(Tables.Tags.BUILTIN_UNINSTALLED);
remove_tag(Tables.Tags.BUILTIN_INSTALLED);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/data/sources/humble/HumbleGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ namespace GameHub.Data.Sources.Humble
status = new Game.Status(executable.query_exists() ? Game.State.INSTALLED : Game.State.UNINSTALLED);
if(status.state == Game.State.INSTALLED)
{
remove_tag(Tables.Tags.BUILTIN_UNINSTALLED);
add_tag(Tables.Tags.BUILTIN_INSTALLED);
}
else
{
add_tag(Tables.Tags.BUILTIN_UNINSTALLED);
remove_tag(Tables.Tags.BUILTIN_INSTALLED);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/data/sources/steam/SteamGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ namespace GameHub.Data.Sources.Steam
status = new Game.Status(Steam.is_app_installed(id) ? Game.State.INSTALLED : Game.State.UNINSTALLED);
if(status.state == Game.State.INSTALLED)
{
remove_tag(Tables.Tags.BUILTIN_UNINSTALLED);
add_tag(Tables.Tags.BUILTIN_INSTALLED);
}
else
{
add_tag(Tables.Tags.BUILTIN_UNINSTALLED);
remove_tag(Tables.Tags.BUILTIN_INSTALLED);
}
}
Expand Down
Loading

0 comments on commit a526ed7

Please sign in to comment.