Commit 8ac1f270 authored by tkashkin's avatar tkashkin 🤔

Prioritize user games over installed games over uninstalled games when all sources are shown (#282)

Fix some merging bugs
parent de841823
......@@ -57,7 +57,10 @@
opacity: 1;
}
.gamecard.downloading GtkLabel.status, .gamecard.downloading label.status
.gamecard.downloading GtkLabel.status, .gamecard.downloading label.status,
.gamecard.downloading.hover GtkLabel.status, .gamecard.downloading.hover label.status,
.games-grid flowboxchild:focus .gamecard.downloading GtkLabel.status, .games-grid flowboxchild:focus .gamecard.downloading label.status,
.games-grid flowboxchild:selected .gamecard.downloading GtkLabel.status, .games-grid flowboxchild:selected .gamecard.downloading label.status
{
margin-bottom: 8px;
opacity: 1;
......@@ -324,9 +327,10 @@ list:not(:backdrop) row:selected:focus label.category-label
.dl-progress-type-icon
{
padding: 4px;
background-color: #ddd;
background-color: shade(@theme_bg_color, 0.95);
border-radius: 50%;
border: 1px #aaa solid;
border: 1px shade(@theme_bg_color, 0.75) solid;
color: @theme_fg_color;
}
GtkListBox.gameinfo-content-list,
......
......@@ -135,7 +135,7 @@ namespace GameHub.Data.DB.Tables
Statement s;
int res = db.prepare_v2("SELECT * FROM `merges` WHERE `merge` LIKE ? LIMIT 1", -1, out s);
int res = db.prepare_v2("SELECT * FROM `merges` WHERE `merge` LIKE ?", -1, out s);
if(res != Sqlite.OK)
{
......
......@@ -43,7 +43,10 @@ namespace GameHub.UI.Dialogs
var content = get_content_area();
content.set_size_request(560, -1);
content.add(new GameHub.UI.Views.GameDetailsView.GameDetailsView(game));
var details_view = new GameHub.UI.Views.GameDetailsView.GameDetailsView(game);
details_view.preferred_source = game.source;
content.add(details_view);
response.connect((source, response_id) => {
switch(response_id)
......
......@@ -138,8 +138,8 @@ namespace GameHub.UI.Views.GameDetailsView
selected_games_view = new MultipleGamesDetailsView();
root_stack.add(selected_games_view);
root_stack.add(game_box);
root_stack.add(selected_games_view);
root_stack.visible_child = game_box;
......@@ -219,13 +219,18 @@ namespace GameHub.UI.Views.GameDetailsView
stack_tabs.visible = merged || primary != null;
add_page(g);
if(primary != null)
{
add_page(primary);
if(!Game.is_equal(g, primary))
{
add_page(primary);
}
merges = Tables.Merges.get(primary);
merged = merges != null && merges.size > 0;
}
add_page(g);
if(merged)
{
foreach(var m in merges)
......
......@@ -53,6 +53,7 @@ namespace GameHub.UI.Views.GamesView
hbox.margin = 8;
var hbox_inner = new Box(Orientation.HORIZONTAL, 8);
var hbox_actions = new Box(Orientation.HORIZONTAL, 0);
hbox_actions.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
hbox_actions.vexpand = false;
hbox_actions.valign = Align.CENTER;
......
......@@ -256,23 +256,35 @@ namespace GameHub.UI.Views.GamesView
private void update_source(GameSource? source=null)
{
if(!Settings.UI.Behavior.instance.merge_games || source == null || source == _game.source || merges == null || merges.size == 0)
if(!Settings.UI.Behavior.instance.merge_games || merges == null || merges.size == 0)
{
update(_game);
return;
}
var vg = _game;
if(merges != null && merges.size > 0)
{
foreach(var g in merges)
{
if(g.source == source)
if(vg is Sources.User.UserGame) break;
if(source == null)
{
if(g.status.state > vg.status.state || g is Sources.User.UserGame)
{
vg = g;
}
}
else if(g.source == source)
{
update(g);
vg = g;
break;
}
}
}
update(vg);
}
private void update(Game? vg)
......
......@@ -100,6 +100,7 @@ namespace GameHub.UI.Views.GamesView
if(primary != null)
{
add_merged_game_submenu(primary);
merges = DB.Tables.Merges.get(primary);
}
if(merges != null)
{
......
......@@ -211,23 +211,35 @@ namespace GameHub.UI.Views.GamesView
private void update_source(GameSource? source=null)
{
if(!Settings.UI.Behavior.instance.merge_games || source == null || source == _game.source || merges == null || merges.size == 0)
if(!Settings.UI.Behavior.instance.merge_games || merges == null || merges.size == 0)
{
update(_game);
return;
}
var vg = _game;
if(merges != null && merges.size > 0)
{
foreach(var g in merges)
{
if(g.source == source)
if(vg is Sources.User.UserGame) break;
if(source == null)
{
if(g.status.state > vg.status.state || g is Sources.User.UserGame)
{
vg = g;
}
}
else if(g.source == source)
{
update(g);
vg = g;
break;
}
}
}
update(vg);
}
private void update(Game? vg)
......
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