[gnome-applets/wip/segeiger/windowpicker: 10/15] windowpicker: declare variables at top
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/windowpicker: 10/15] windowpicker: declare variables at top
- Date: Sun, 13 Oct 2019 12:18:46 +0000 (UTC)
commit 0029b7158ce70d4d065dfdbd856043c7bb910966
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 | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/windowpicker/src/task-item.c b/windowpicker/src/task-item.c
index fe0ac99ad..a74636bc6 100644
--- a/windowpicker/src/task-item.c
+++ b/windowpicker/src/task-item.c
@@ -213,24 +213,30 @@ task_item_sized_pixbuf_for_window (TaskItem *item,
{
GdkPixbuf *pixbuf;
GdkPixbuf *unscaled_pixbuf;
+ GdkPixbuf *internal;
gint width, height;
+ const gchar *icon_name;
+ GtkIconTheme *icon_theme;
+ gdouble scale;
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))
+ {
+ 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))
+ {
+ 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));
@@ -239,12 +245,13 @@ 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)
+ {
+ 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]