[gnome-games] game-thumbnail: Prevent multiple disk checks of covers



commit 0b76258e0e23b783c3ae36166beb0c11a539e0fe
Author: theawless <theawless gmail com>
Date:   Mon Aug 27 02:51:47 2018 +0530

    game-thumbnail: Prevent multiple disk checks of covers

 src/ui/game-thumbnail.vala | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/ui/game-thumbnail.vala b/src/ui/game-thumbnail.vala
index c2ab3415..f72d8902 100644
--- a/src/ui/game-thumbnail.vala
+++ b/src/ui/game-thumbnail.vala
@@ -53,6 +53,7 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
                }
        }
 
+       private bool tried_loading_cover;
        private Gdk.Pixbuf? cover_cache;
        private int previous_cover_width;
        private int previous_cover_height;
@@ -189,11 +190,13 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
                if (previous_cover_width != context.width) {
                        previous_cover_width = context.width;
                        cover_cache = null;
+                       tried_loading_cover = false;
                }
 
                if (previous_cover_height != context.height) {
                        previous_cover_height = context.height;
                        cover_cache = null;
+                       tried_loading_cover = false;
                }
 
                if (cover_cache != null)
@@ -225,6 +228,11 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
        }
 
        private void load_cover_cache_from_disk (DrawingContext context, int size) {
+               if (tried_loading_cover)
+                       return;
+
+               tried_loading_cover = true;
+
                string cover_cache_path;
                try {
                        cover_cache_path = get_cover_cache_path (size);
@@ -276,6 +284,7 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
 
        private void invalidate_cover () {
                cover_cache = null;
+               tried_loading_cover = false;
                queue_draw ();
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]