comparison src/gtkaccount.c @ 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 0aa231ebbfd5
children 43c7e892d8bf
comparison
equal deleted inserted replaced
13220:ac5bc9a7b603 13221:cc85a78191cc
191 191
192 static void 192 static void
193 set_dialog_icon(AccountPrefsDialog *dialog) 193 set_dialog_icon(AccountPrefsDialog *dialog)
194 { 194 {
195 char *filename = gaim_buddy_icons_get_full_path(dialog->icon_path); 195 char *filename = gaim_buddy_icons_get_full_path(dialog->icon_path);
196 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), filename); 196 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
197
198 if (pixbuf && dialog->prpl_info &&
199 (dialog->prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY))
200 {
201 int width, height;
202 GdkPixbuf *scale;
203
204 gaim_gtk_buddy_icon_get_scale_size(pixbuf,
205 &dialog->prpl_info->icon_spec, &width, &height);
206 scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR);
207
208 g_object_unref(G_OBJECT(pixbuf));
209 pixbuf = scale;
210 }
211
212 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_entry), pixbuf);
213 g_object_unref(G_OBJECT(pixbuf));
197 g_free(filename); 214 g_free(filename);
198 } 215 }
199 216
200 static void 217 static void
201 set_account_protocol_cb(GtkWidget *item, const char *id, 218 set_account_protocol_cb(GtkWidget *item, const char *id,
625 return NULL; 642 return NULL;
626 } 643 }
627 fclose(image); 644 fclose(image);
628 645
629 #if GTK_CHECK_VERSION(2,2,0) && !GTK_CHECK_VERSION(2,4,0) 646 #if GTK_CHECK_VERSION(2,2,0) && !GTK_CHECK_VERSION(2,4,0)
630 g_object_unref(G_OBJECT(pixbuf)); 647 g_object_unref(G_OBJECT(pixbuf));
631 #endif 648 #endif
632 649
633 g_free(filename); 650 g_free(filename);
634 return random; 651 return random;
635 } 652 }