[Xfce4-commits] <xfdesktop:master> Keep the image width to something sensible for xfdesktop-settings. (Bug 7086)
Eric Koegel
noreply at xfce.org
Thu Mar 29 18:34:03 CEST 2012
Updating branch refs/heads/master
to 3121ebe327165669b741719eaca03385e47407eb (commit)
from 17bad9881764e06bd73da3cd11bb22a72935519e (commit)
commit 3121ebe327165669b741719eaca03385e47407eb
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Mon Mar 12 11:30:07 2012 +0300
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,
More information about the Xfce4-commits
mailing list