From cfa0bf9d26178757c84a35fe48596708ddf0b2b7 Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Mon, 12 Mar 2012 11:30:07 +0300 Subject: [PATCH] Keep the image width to something sensible for xfdesktop-settings. (Bug 7086) The width of images in the xfdesktop-setting treeview can get very large if the aspect ratio is a high number. This patch adds a max aspect ratio of 3.0f to keep the image preview column from expanding excessively. --- settings/main.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/settings/main.c b/settings/main.c index c6fbaad..74e7172 100644 --- a/settings/main.c +++ b/settings/main.c @@ -53,6 +53,7 @@ #include "xfdesktop-settings-appearance-frame-ui.h" #define PREVIEW_HEIGHT 48 +#define MAX_ASPECT_RATIO 3.0f #define SHOW_DESKTOP_MENU_PROP "/desktop-menu/show" #define DESKTOP_MENU_SHOW_ICONS_PROP "/desktop-menu/show-icons" @@ -166,6 +167,12 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model, name, width, height); aspect = (gdouble)width / height; + + /* Keep the aspect ratio sensible otherwise the treeview looks bad */ + if(aspect > MAX_ASPECT_RATIO) { + aspect = MAX_ASPECT_RATIO; + } + width = PREVIEW_HEIGHT * aspect; height = PREVIEW_HEIGHT; pix_scaled = gdk_pixbuf_scale_simple(pix, width, height, -- 1.7.5.4