...
  View open merge request
Commits (2)
......@@ -33,17 +33,29 @@
border-right: none;
}
flowboxchild {
padding: 0;
}
gamesgamethumbnail {
background-color: mix (@theme_base_color, @theme_bg_color, 0.5);
background-color: shade(@theme_base_color, 0.5);
border-width: 1px;
border-style: solid;
border-radius: 2px;
border-color: @theme_bg_color;
color: @theme_fg_color;
border-color: black;/*@theme_bg_color;*/
color: alpha(@theme_fg_color, 0.25);
}
.game-title {
color: white;
background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
text-shadow: 0 1px 2px black;
font-weight: bold;
padding-top: 28px;
padding-bottom: 6px;
}
gamescollectioniconview flowboxchild {
min-width: 128px;
min-width: 180px;
}
gamescollectioniconview.large flowboxchild {
......
......@@ -20,13 +20,7 @@
<property name="can-focus">True</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="margin-start">28</property>
<property name="margin-end">28</property>
<property name="margin-top">21</property>
<property name="margin-bottom">21</property>
<property name="homogeneous">True</property>
<property name="column-spacing">14</property>
<property name="row-spacing">14</property>
<property name="selection-mode">single</property>
<signal name="child-activated" handler="on_child_activated"/>
</object>
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.24"/>
<template class="GamesGameIconView" parent="GtkBox">
<template class="GamesGameIconView" parent="GtkBin">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GamesGameThumbnail" id="thumbnail">
<object class="GtkOverlay">
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="ellipsize">middle</property>
<property name="justify">center</property>
<property name="lines">2</property>
<property name="max-width-chars">0</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<child>
<object class="GamesGameThumbnail" id="thumbnail">
<property name="visible">True</property>
</object>
</child>
<child type="overlay">
<object class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="valign">end</property>
<property name="ellipsize">middle</property>
<property name="justify">center</property>
<property name="lines">2</property>
<property name="max-width-chars">0</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<style>
<class name="game-title"/>
</style>
</object>
</child>
</object>
</child>
</template>
......
......@@ -2,7 +2,7 @@
public class Games.SteamCover : Object, Cover {
private string game_id;
private GLib.Icon icon;
private Gdk.Pixbuf? pixbuf;
private bool resolving;
public SteamCover (string game_id) {
......@@ -10,16 +10,22 @@ public class Games.SteamCover : Object, Cover {
resolving = false;
}
public GLib.Icon? get_cover () {
public Gdk.Pixbuf? get_cover () {
if (resolving)
return icon;
return pixbuf;
if (icon != null)
return icon;
if (pixbuf != null)
return pixbuf;
load_cover ();
if (icon != null)
return icon;
try {
load_cover ();
}
catch (Error e) {
warning (e.message);
}
if (pixbuf != null)
return pixbuf;
resolving = true;
......@@ -60,14 +66,13 @@ public class Games.SteamCover : Object, Cover {
});
}
private void load_cover () {
private void load_cover () throws Error {
var cover_path = get_cover_path ();
if (!FileUtils.test (cover_path, FileTest.EXISTS))
return;
var file = File.new_for_path (cover_path);
icon = new FileIcon (file);
pixbuf = new Gdk.Pixbuf.from_file (cover_path);
changed ();
}
......
......@@ -3,5 +3,5 @@
public interface Games.Cover : Object {
public signal void changed ();
public abstract GLib.Icon? get_cover ();
public abstract Gdk.Pixbuf? get_cover ();
}
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.DummyCover : Object, Cover {
public GLib.Icon? get_cover () {
public Gdk.Pixbuf? get_cover () {
return null;
}
}
......@@ -3,7 +3,7 @@
public class Games.GriloCover : Object, Cover {
private GriloMedia media;
private Uid uid;
private GLib.Icon icon;
private Gdk.Pixbuf pixbuf;
private bool resolving;
private string cover_path;
......@@ -14,12 +14,12 @@ public class Games.GriloCover : Object, Cover {
resolving = false;
}
public GLib.Icon? get_cover () {
public Gdk.Pixbuf? get_cover () {
if (resolving)
return icon;
return pixbuf;
if (icon != null)
return icon;
if (pixbuf != null)
return pixbuf;
try {
load_cover ();
......@@ -27,17 +27,17 @@ public class Games.GriloCover : Object, Cover {
catch (Error e) {
warning (e.message);
return icon;
return pixbuf;
}
if (icon != null)
return icon;
if (pixbuf != null)
return pixbuf;
resolving = true;
media.try_resolve_media ();
return icon;
return pixbuf;
}
private void on_media_resolved () {
......@@ -106,8 +106,7 @@ public class Games.GriloCover : Object, Cover {
if (!FileUtils.test (cover_path, FileTest.EXISTS))
return;
var file = File.new_for_path (cover_path);
icon = new FileIcon (file);
pixbuf = new Gdk.Pixbuf.from_file (cover_path);
changed ();
}
......
// This file is part of GNOME Games. License: GPL-3.0+.
[GtkTemplate (ui = "/org/gnome/Games/ui/game-icon-view.ui")]
private class Games.GameIconView : Gtk.Box {
private class Games.GameIconView : Gtk.Bin {
private Game _game;
public Game game {
get { return _game; }
......
......@@ -4,7 +4,7 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
private const Gtk.CornerType[] right_corners = { Gtk.CornerType.TOP_RIGHT, Gtk.CornerType.BOTTOM_RIGHT };
private const Gtk.CornerType[] bottom_corners = { Gtk.CornerType.BOTTOM_LEFT, Gtk.CornerType.BOTTOM_RIGHT };
private const double EMBLEM_SCALE = 0.125;
private const double EMBLEM_SCALE = 0.5;
private const double ICON_SCALE = 0.75;
private Uid _uid;
......@@ -222,21 +222,9 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
if (cover_cache != null)
return cover_cache;
var g_icon = cover.get_cover ();
if (g_icon == null)
return null;
var theme = Gtk.IconTheme.get_default ();
var lookup_flags = Gtk.IconLookupFlags.FORCE_SIZE | Gtk.IconLookupFlags.FORCE_REGULAR;
var icon_info = theme.lookup_by_gicon (g_icon, (int) size, lookup_flags);
cover_cache = cover.get_cover ();
try {
cover_cache = icon_info.load_icon ();
save_cover_cache_to_disk (size);
}
catch (Error e) {
warning (@"Couldn’t load the icon: $(e.message)\n");
}
save_cover_cache_to_disk (size);
return cover_cache;
}
......
......@@ -9,7 +9,7 @@ public class Games.CompositeCover : Object, Cover {
cover.changed.connect (on_cover_changed);
}
public GLib.Icon? get_cover () {
public Gdk.Pixbuf? get_cover () {
foreach (var cover in covers) {
var result_cover = cover.get_cover ();
if (result_cover != null)
......
......@@ -3,15 +3,15 @@
public class Games.LocalCover : Object, Cover {
private Uri uri;
private bool resolved;
private GLib.Icon? icon;
private Gdk.Pixbuf? pixbuf;
public LocalCover (Uri uri) {
this.uri = uri;
}
public GLib.Icon? get_cover () {
public Gdk.Pixbuf? get_cover () {
if (resolved)
return icon;
return pixbuf;
resolved = true;
......@@ -28,10 +28,14 @@ public class Games.LocalCover : Object, Cover {
if (cover_path == null)
return null;
var file = File.new_for_path (cover_path);
icon = new FileIcon (file);
try {
pixbuf = new Gdk.Pixbuf.from_file (cover_path);
}
catch (Error e) {
warning (e.message);
}
return icon;
return pixbuf;
}
private string? get_cover_path () throws Error {
......