[gnome-applets/wip/segeiger/windowpicker: 10/17] windowpicker: declare variables at top



commit f55fd47fa2f4a57752747949be5ddee59ff97576
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sat Oct 12 15:16:46 2019 +0200

    windowpicker: declare variables at top

 windowpicker/src/task-item.c | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/windowpicker/src/task-item.c b/windowpicker/src/task-item.c
index 2b9dcbc57..68be68c2c 100644
--- a/windowpicker/src/task-item.c
+++ b/windowpicker/src/task-item.c
@@ -216,20 +216,27 @@ task_item_sized_pixbuf_for_window (TaskItem   *item,
 
     pixbuf = NULL;
     g_return_val_if_fail (WNCK_IS_WINDOW (window), NULL);
-    if (wnck_window_has_icon_name (window)) {
-        const gchar *icon_name = wnck_window_get_icon_name (window);
-        GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
-        if (gtk_icon_theme_has_icon (icon_theme, icon_name)) {
-            GdkPixbuf *internal = gtk_icon_theme_load_icon (icon_theme,
-                icon_name,
-                size,
-                GTK_ICON_LOOKUP_FORCE_SIZE,
-                NULL
-            );
+
+    if (wnck_window_has_icon_name (window))
+      {
+        const gchar *icon_name;
+        GtkIconTheme *icon_theme;
+
+        icon_name = wnck_window_get_icon_name (window);
+        icon_theme = gtk_icon_theme_get_default ();
+
+        if (gtk_icon_theme_has_icon (icon_theme, icon_name))
+          {
+            GdkPixbuf *internal;
+
+            internal = gtk_icon_theme_load_icon (icon_theme, icon_name, size,
+                                                 GTK_ICON_LOOKUP_FORCE_SIZE,
+                                                 NULL);
             pixbuf = gdk_pixbuf_copy (internal);
             g_object_unref (internal);
-        }
-    }
+          }
+      }
+
     if (!pixbuf)
       {
         pixbuf = gdk_pixbuf_copy (wnck_window_get_icon (item->window));
@@ -238,14 +245,16 @@ task_item_sized_pixbuf_for_window (TaskItem   *item,
     width = gdk_pixbuf_get_width (pixbuf);
     height = gdk_pixbuf_get_height (pixbuf);
 
-    if (MAX (width, height) != size) {
-        gdouble scale = (gdouble) size / (gdouble) MAX (width, height);
+    if (MAX (width, height) != size)
+      {
         GdkPixbuf *unscaled_pixbuf;
+        gdouble scale;
 
+        scale = (gdouble) size / (gdouble) MAX (width, height);
         unscaled_pixbuf = pixbuf;
         pixbuf = gdk_pixbuf_scale_simple (unscaled_pixbuf, (gint) (width * scale), (gint) (height * scale), 
GDK_INTERP_HYPER);
         g_object_unref (unscaled_pixbuf);
-    }
+      }
 
     return pixbuf;
 }


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