[libwnck/wip/muktupavels/icons: 2/8] icon-cache: read icons in getters




commit c8e9941957528276295e0c47dae17b27e3245d07
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 d89e8965..9b4f1f90 100644
--- a/libwnck/wnck-icon-cache.c
+++ b/libwnck/wnck-icon-cache.c
@@ -802,12 +802,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]