Skip to content

Commit

Permalink
Only match files when importing emulated games (#258)
Browse files Browse the repository at this point in the history
Do not try to show merged games when merging is disabled (#259)
  • Loading branch information
tkashkin committed Jun 21, 2019
1 parent 4f32825 commit b126539
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/ui/dialogs/ImportEmulatedGamesDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ namespace GameHub.UI.Dialogs
foreach(var file_path in files)
{
var file = FSUtils.file(file_path);
if(file.query_file_type(FileQueryInfoFlags.NONE) == FileType.DIRECTORY) continue;

var dir = file.get_parent();
var name = file.get_basename();

Expand Down Expand Up @@ -390,6 +392,8 @@ namespace GameHub.UI.Dialogs
foreach(var file_path in files)
{
var file = FSUtils.file(file_path);
if(file.query_file_type(FileQueryInfoFlags.NONE) == FileType.DIRECTORY) continue;

var dir = file.get_parent();
var name = file.get_basename();

Expand Down
12 changes: 8 additions & 4 deletions src/ui/views/GamesView/GameCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ namespace GameHub.UI.Views.GamesView
}

_game = new_game;
merges = Tables.Merges.get(_game);

if(Settings.UI.Behavior.instance.merge_games)
{
merges = Tables.Merges.get(_game);
}

if(adapter != null)
{
Expand All @@ -255,7 +259,7 @@ namespace GameHub.UI.Views.GamesView

private void update_source(GameSource? source=null)
{
if(source == null || source == _game.source || merges == null || merges.size == 0)
if(!Settings.UI.Behavior.instance.merge_games || source == null || source == _game.source || merges == null || merges.size == 0)
{
update(_game);
return;
Expand Down Expand Up @@ -289,7 +293,7 @@ namespace GameHub.UI.Views.GamesView
{
add_src_icon(_game.source.icon);
}
if(merges != null && merges.size > 0)
if(Settings.UI.Behavior.instance.merge_games && merges != null && merges.size > 0)
{
foreach(var g in merges)
{
Expand All @@ -308,7 +312,7 @@ namespace GameHub.UI.Views.GamesView
platforms += p;
}
}
if(adapter.filter_source == null && merges != null && merges.size > 0)
if(Settings.UI.Behavior.instance.merge_games && adapter.filter_source == null && merges != null && merges.size > 0)
{
foreach(var g in merges)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/GamesView/GameContextMenu.vala
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace GameHub.UI.Views.GamesView

if(!(game is Sources.GOG.GOGGame.DLC))
{
if(!is_merge_submenu)
if(Settings.UI.Behavior.instance.merge_games && !is_merge_submenu)
{
var merges = DB.Tables.Merges.get(game);
var primary = DB.Tables.Merges.get_primary(game);
Expand Down
7 changes: 5 additions & 2 deletions src/ui/views/GamesView/GameListRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ namespace GameHub.UI.Views.GamesView
}

_game = new_game;
merges = Tables.Merges.get(_game);
if(Settings.UI.Behavior.instance.merge_games)
{
merges = Tables.Merges.get(_game);
}

if(adapter != null)
{
Expand All @@ -164,7 +167,7 @@ namespace GameHub.UI.Views.GamesView

private void update_source(GameSource? source=null)
{
if(source == null || source == _game.source || merges == null || merges.size == 0)
if(!Settings.UI.Behavior.instance.merge_games || source == null || source == _game.source || merges == null || merges.size == 0)
{
update(_game);
return;
Expand Down

0 comments on commit b126539

Please sign in to comment.