[libwnck/wip/muktupavels/icons: 9/21] icon-cache: remove size parameters from read_icons




commit d724d6af289e2abf24bf50f242bad9818e08e194
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Mar 14 14:34:15 2022 +0200

    icon-cache: remove size parameters from read_icons
    
    We can get icon sizes from WnckHandle inside function.

 libwnck/application.c             | 15 ++-------------
 libwnck/window.c                  | 15 ++-------------
 libwnck/wnck-icon-cache-private.h |  4 +---
 libwnck/wnck-icon-cache.c         | 11 ++++++++---
 4 files changed, 13 insertions(+), 32 deletions(-)
---
diff --git a/libwnck/application.c b/libwnck/application.c
index 2988600f..c6d24507 100644
--- a/libwnck/application.c
+++ b/libwnck/application.c
@@ -309,24 +309,13 @@ wnck_application_get_pid (WnckApplication *app)
 static void
 get_icons (WnckApplication *app)
 {
-  WnckHandle *handle;
   GdkPixbuf *icon;
   GdkPixbuf *mini_icon;
-  gsize normal_size;
-  gsize mini_size;
-
-  handle = wnck_screen_get_handle (app->priv->screen);
 
   icon = NULL;
   mini_icon = NULL;
-  normal_size = _wnck_handle_get_default_icon_size (handle);
-  mini_size = _wnck_handle_get_default_mini_icon_size (handle);
-
-  if (_wnck_read_icons (app->priv->icon_cache,
-                        &icon,
-                        normal_size,
-                        &mini_icon,
-                        mini_size))
+
+  if (_wnck_read_icons (app->priv->icon_cache, &icon, &mini_icon))
     {
       app->priv->need_emit_icon_changed = TRUE;
 
diff --git a/libwnck/window.c b/libwnck/window.c
index 566d93e6..95ec2591 100644
--- a/libwnck/window.c
+++ b/libwnck/window.c
@@ -2109,24 +2109,13 @@ wnck_window_transient_is_most_recently_activated (WnckWindow *window)
 static void
 get_icons (WnckWindow *window)
 {
-  WnckHandle *handle;
   GdkPixbuf *icon;
   GdkPixbuf *mini_icon;
-  gsize normal_size;
-  gsize mini_size;
-
-  handle = wnck_screen_get_handle (window->priv->screen);
 
   icon = NULL;
   mini_icon = NULL;
-  normal_size = _wnck_handle_get_default_icon_size (handle);
-  mini_size = _wnck_handle_get_default_mini_icon_size (handle);
-
-  if (_wnck_read_icons (window->priv->icon_cache,
-                        &icon,
-                        normal_size,
-                        &mini_icon,
-                        mini_size))
+
+  if (_wnck_read_icons (window->priv->icon_cache, &icon, &mini_icon))
     {
       window->priv->need_emit_icon_changed = TRUE;
 
diff --git a/libwnck/wnck-icon-cache-private.h b/libwnck/wnck-icon-cache-private.h
index f40c0b78..57a95700 100644
--- a/libwnck/wnck-icon-cache-private.h
+++ b/libwnck/wnck-icon-cache-private.h
@@ -41,9 +41,7 @@ gboolean       _wnck_icon_cache_get_is_fallback      (WnckIconCache  *icon_cache
 
 gboolean       _wnck_read_icons                      (WnckIconCache  *icon_cache,
                                                       GdkPixbuf     **iconp,
-                                                      int             ideal_size,
-                                                      GdkPixbuf     **mini_iconp,
-                                                      int             ideal_mini_size);
+                                                      GdkPixbuf     **mini_iconp);
 
 void           _wnck_icon_cache_invalidate           (WnckIconCache  *self);
 
diff --git a/libwnck/wnck-icon-cache.c b/libwnck/wnck-icon-cache.c
index 5338a8f9..5b8ab519 100644
--- a/libwnck/wnck-icon-cache.c
+++ b/libwnck/wnck-icon-cache.c
@@ -533,12 +533,13 @@ _wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache)
 gboolean
 _wnck_read_icons (WnckIconCache  *icon_cache,
                   GdkPixbuf     **iconp,
-                  int             ideal_size,
-                  GdkPixbuf     **mini_iconp,
-                  int             ideal_mini_size)
+                  GdkPixbuf     **mini_iconp)
 {
   Screen *xscreen;
   Display *display;
+  WnckHandle *handle;
+  int ideal_size;
+  int ideal_mini_size;
   guchar *pixdata;
   int w, h;
   guchar *mini_pixdata;
@@ -560,6 +561,10 @@ _wnck_read_icons (WnckIconCache  *icon_cache,
   if (!_wnck_icon_cache_get_icon_invalidated (icon_cache))
     return FALSE; /* we have no new info to use */
 
+  handle = wnck_screen_get_handle (icon_cache->screen);
+  ideal_size = _wnck_handle_get_default_icon_size (handle);
+  ideal_mini_size = _wnck_handle_get_default_mini_icon_size (handle);
+
   pixdata = NULL;
 
   /* Our algorithm here assumes that we can't have for example origin


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