[libwnck/wip/muktupavels/icons: 12/16] icon-cache: read icons in getters




commit 5062df20b9d0cebfcc4f05ad8f98d15e4eb6396e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Mar 14 19:47:08 2022 +0200

    icon-cache: read icons in getters

 libwnck/wnck-icon-cache.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/libwnck/wnck-icon-cache.c b/libwnck/wnck-icon-cache.c
index aa631d45..82708f0e 100644
--- a/libwnck/wnck-icon-cache.c
+++ b/libwnck/wnck-icon-cache.c
@@ -812,12 +812,40 @@ _wnck_read_icons (WnckIconCache  *icon_cache,
 GdkPixbuf *
 _wnck_icon_cache_get_icon (WnckIconCache *self)
 {
+  GdkPixbuf *icon;
+  GdkPixbuf *mini_icon;
+
+  if (self->icon != NULL)
+    return self->icon;
+
+  icon = NULL;
+  mini_icon = NULL;
+
+  _wnck_read_icons (self, &icon, &mini_icon);
+
+  g_clear_object (&icon);
+  g_clear_object (&mini_icon);
+
   return self->icon;
 }
 
 GdkPixbuf *
 _wnck_icon_cache_get_mini_icon (WnckIconCache *self)
 {
+  GdkPixbuf *icon;
+  GdkPixbuf *mini_icon;
+
+  if (self->mini_icon != NULL)
+    return self->mini_icon;
+
+  icon = NULL;
+  mini_icon = NULL;
+
+  _wnck_read_icons (self, &icon, &mini_icon);
+
+  g_clear_object (&icon);
+  g_clear_object (&mini_icon);
+
   return self->mini_icon;
 }
 


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