summaryrefslogtreecommitdiff
path: root/src/file-manager/fm-list-model.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2003-03-27 15:45:44 +0000
committerAlexander Larsson <alexl@src.gnome.org>2003-03-27 15:45:44 +0000
commit0a2a89e54d76e3f4e2e4d42656e0a1179df1ec9a (patch)
treea9cbd24261c6d12b99c8b7c371c345fc6504dd44 /src/file-manager/fm-list-model.c
parentaae8a34f30231dbf2a3d269587e55bfb53316ad1 (diff)
downloadnautilus-0a2a89e54d76e3f4e2e4d42656e0a1179df1ec9a.tar.gz
Scale icons to fit in row-height.
2003-03-27 Alexander Larsson <alexl@redhat.com> * src/file-manager/fm-list-model.c (fm_list_model_get_value): Scale icons to fit in row-height.
Diffstat (limited to 'src/file-manager/fm-list-model.c')
-rw-r--r--src/file-manager/fm-list-model.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c
index ae6bd22eb..290ddc5e3 100644
--- a/src/file-manager/fm-list-model.c
+++ b/src/file-manager/fm-list-model.c
@@ -191,9 +191,10 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
FMListModel *model;
NautilusFile *file;
char *str;
- GdkPixbuf *icon;
+ GdkPixbuf *icon, *tmp;
int icon_size;
NautilusZoomLevel zoom_level;
+ int width, height;
model = (FMListModel *)tree_model;
@@ -225,6 +226,15 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
zoom_level = fm_list_model_get_zoom_level_from_column_id (column);
icon_size = nautilus_get_icon_size_for_zoom_level (zoom_level);
icon = nautilus_icon_factory_get_pixbuf_for_file (file, NULL, icon_size);
+
+ height = gdk_pixbuf_get_height (icon);
+ if (height > icon_size) {
+ width = gdk_pixbuf_get_width (icon) * icon_size / height;
+ height = icon_size;
+ tmp = gdk_pixbuf_scale_simple (icon, width, height, GDK_INTERP_BILINEAR);
+ g_object_unref (icon);
+ icon = tmp;
+ }
g_value_set_object (value, icon);
g_object_unref (icon);
break;