changeset 13221:cc85a78191cc

[gaim-migrate @ 15585] SF Patch #1428104 from Sadrul Fixes SF Bug #1424843 "This resizes an icon for display when the appropriate flags are set." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 11 Feb 2006 05:29:12 +0000
parents ac5bc9a7b603
children ca677053ac11
files src/gtkaccount.c
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Sat Feb 11 05:25:47 2006 +0000
+++ b/src/gtkaccount.c	Sat Feb 11 05:29:12 2006 +0000
@@ -193,7 +193,24 @@
 set_dialog_icon(AccountPrefsDialog *dialog)
 {
 	char *filename = gaim_buddy_icons_get_full_path(dialog->icon_path);
-	gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), filename);
+	GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+
+	if (pixbuf && dialog->prpl_info &&
+	    (dialog->prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY))
+	{
+		int width, height;
+		GdkPixbuf *scale;
+
+		gaim_gtk_buddy_icon_get_scale_size(pixbuf,
+							&dialog->prpl_info->icon_spec, &width, &height);
+		scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR);
+		
+		g_object_unref(G_OBJECT(pixbuf));
+		pixbuf = scale;
+	}
+
+	gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_entry), pixbuf);
+	g_object_unref(G_OBJECT(pixbuf));
 	g_free(filename);
 }
 
@@ -627,7 +644,7 @@
 		fclose(image);
 
 #if GTK_CHECK_VERSION(2,2,0) && !GTK_CHECK_VERSION(2,4,0)
-			g_object_unref(G_OBJECT(pixbuf));
+		g_object_unref(G_OBJECT(pixbuf));
 #endif
 
 		g_free(filename);