[gnome-games] utils: Add CompositeCover
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] utils: Add CompositeCover
- Date: Fri, 12 Aug 2016 10:29:49 +0000 (UTC)
commit d128771ce2e19fde76dd25fdddf82d4c40736ee6
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Aug 10 16:55:03 2016 +0200
utils: Add CompositeCover
This will be used in the next commit to get covers from multiple
sources.
https://bugzilla.gnome.org/show_bug.cgi?id=769676
src/Makefile.am | 1 +
src/utils/composite-cover.vala | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 25412ad..2bf0703 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -106,6 +106,7 @@ gnome_games_SOURCES = \
ui/search-bar.vala \
ui/ui-state.vala \
\
+ utils/composite-cover.vala \
utils/cue-sheet/cue-sheet.vala \
utils/cue-sheet/cue-sheet-error.vala \
utils/cue-sheet/cue-sheet-file-format.vala \
diff --git a/src/utils/composite-cover.vala b/src/utils/composite-cover.vala
new file mode 100644
index 0000000..538d801
--- /dev/null
+++ b/src/utils/composite-cover.vala
@@ -0,0 +1,25 @@
+// This file is part of GNOME Games. License: GPLv3
+
+public class Games.CompositeCover : Object, Cover {
+ private Cover[] covers;
+
+ public CompositeCover (Cover[] covers) {
+ this.covers = covers;
+ foreach (var cover in covers)
+ cover.changed.connect (on_cover_changed);
+ }
+
+ public GLib.Icon? get_cover () {
+ foreach (var cover in covers) {
+ var result_cover = cover.get_cover ();
+ if (result_cover != null)
+ return result_cover;
+ }
+
+ return null;
+ }
+
+ private void on_cover_changed () {
+ changed ();
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]