[gnome-games/wip/exalm/covers: 1/5] game-thumbnail: Only have a single 'game' property
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/covers: 1/5] game-thumbnail: Only have a single 'game' property
- Date: Sun, 17 Nov 2019 11:59:40 +0000 (UTC)
commit 34e8270fc51547a65a933d6d5d5ed62fc7a20931
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Nov 17 16:51:21 2019 +0500
game-thumbnail: Only have a single 'game' property
Instead of having separate uid, icon and cover, just set the game once.
src/ui/game-icon-view.vala | 4 +---
src/ui/game-thumbnail.vala | 51 +++++++++++++++-------------------------------
2 files changed, 17 insertions(+), 38 deletions(-)
---
diff --git a/src/ui/game-icon-view.vala b/src/ui/game-icon-view.vala
index afad2058..26c1f362 100644
--- a/src/ui/game-icon-view.vala
+++ b/src/ui/game-icon-view.vala
@@ -10,9 +10,7 @@ private class Games.GameIconView : Gtk.Box {
public Game game { get; construct; }
construct {
- thumbnail.uid = game.get_uid ();
- thumbnail.icon = game.get_icon ();
- thumbnail.cover = game.get_cover ();
+ thumbnail.game = game;
title.label = game.name;
}
diff --git a/src/ui/game-thumbnail.vala b/src/ui/game-thumbnail.vala
index 12009012..af6cea85 100644
--- a/src/ui/game-thumbnail.vala
+++ b/src/ui/game-thumbnail.vala
@@ -7,47 +7,28 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
private const double EMBLEM_SCALE = 0.125;
private const double ICON_SCALE = 0.75;
- private Uid _uid;
- public Uid uid {
- get { return _uid; }
- set {
- if (_uid == value)
- return;
-
- _uid = value;
-
- queue_draw ();
- }
- }
-
- private Icon _icon;
- public Icon icon {
- get { return _icon; }
- set {
- if (_icon == value)
- return;
-
- _icon = value;
-
- queue_draw ();
- }
- }
-
private ulong cover_changed_id;
- private Cover _cover;
- public Cover cover {
- get { return _cover; }
+ private Uid uid;
+ private Icon icon;
+ private Cover cover;
+
+ private Game _game;
+ public Game game {
+ get { return _game; }
set {
- if (_cover == value)
+ if (_game == value)
return;
- if (_cover != null)
- _cover.disconnect (cover_changed_id);
+ if (cover != null)
+ cover.disconnect (cover_changed_id);
- _cover = value;
+ _game = value;
+ uid = game.get_uid ();
+ icon = game.get_icon ();
+ cover = game.get_cover ();
- if (_cover != null)
- cover_changed_id = _cover.changed.connect (invalidate_cover);
+ if (cover != null)
+ cover_changed_id = cover.changed.connect (invalidate_cover);
invalidate_cover ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]