changeset 1299:ead95abdf9bc trunk

[svn] - downsize images larger than 150px
author nenolod
date Sun, 18 Jun 2006 22:14:56 -0700
parents 61b576d80cbb
children a5c4e748d557
files ChangeLog audacious/ui_fileinfo.c
diffstat 2 files changed, 37 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 18 21:52:46 2006 -0700
+++ b/ChangeLog	Sun Jun 18 22:14:56 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-19 04:52:46 +0000  Derek Pomery <nemo@m8y.org>
+  revision [1508]
+  nitpicks, whee! just so I can see the popup when snapped against screen edge.
+  
+
+  Changes:        Modified:
+  +5 -2           trunk/audacious/ui_fileinfo.c  
+
+
 2006-06-19 04:45:20 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1506]
   - la la la, resize
--- a/audacious/ui_fileinfo.c	Sun Jun 18 21:52:46 2006 -0700
+++ b/audacious/ui_fileinfo.c	Sun Jun 18 22:14:56 2006 -0700
@@ -101,11 +101,24 @@
 {
 	GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml");
 	GtkWidget *widget = glade_xml_get_widget(xml, entry);
+	GdkPixbuf *pixbuf;
 
 	if (xml == NULL || widget == NULL)
 		return;
 
-	gtk_image_set_from_file(GTK_IMAGE(widget), text);
+	pixbuf = gdk_pixbuf_new_from_file(text, NULL);
+
+	if (pixbuf == NULL)
+		return;
+
+	if (gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)) > 150)
+	{
+		GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), 150, 150, GDK_INTERP_BILINEAR);
+		g_object_unref(G_OBJECT(pixbuf));
+		pixbuf = pixbuf2;
+	}
+
+	gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf));
 }
 
 static void
@@ -125,11 +138,24 @@
 {
 	GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml");
 	GtkWidget *widget = glade_xml_get_widget(xml, entry);
+	GdkPixbuf *pixbuf;
 
 	if (xml == NULL || widget == NULL)
 		return;
 
-	gtk_image_set_from_file(GTK_IMAGE(widget), text);
+	pixbuf = gdk_pixbuf_new_from_file(text, NULL);
+
+	if (pixbuf == NULL)
+		return;
+
+	if (gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)) > 150)
+	{
+		GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), 150, 150, GDK_INTERP_BILINEAR);
+		g_object_unref(G_OBJECT(pixbuf));
+		pixbuf = pixbuf2;
+	}
+
+	gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf));
 }
 
 static void