# HG changeset patch # User Mark Doliner # Date 1166607071 0 # Node ID 30932055bb7c06b32440dd8c5472df0373a261ae # Parent ea246204cf36bd918a2f28928ee10bd0a102038a [gaim-migrate @ 18029] A better fix for the bugs I introduced in revision 18012, that was partially fixed by sf patch #1618871. committer: Tailor Script diff -r ea246204cf36 -r 30932055bb7c ChangeLog.API --- a/ChangeLog.API Wed Dec 20 09:28:29 2006 +0000 +++ b/ChangeLog.API Wed Dec 20 09:31:11 2006 +0000 @@ -147,11 +147,13 @@ avoid accessing it directly. * notify_userinfo() UI op is passed a GaimNotifyUserInfo instead of a char* for the user information - * gaim_buddy_icon_get_scale_size() and - gaim_gtk_buddy_icon_get_scale_size() were changed to ALWAYS scale + * gaim_buddy_icon_get_scale_size() and was changed to ALWAYS scale the icon instead of only when icon_spec->scale_rules contains GAIM_ICON_SCALE_DISPLAY. Callers should be changed to check the scale_rules before calling this function. + * gaim_gtk_buddy_icon_get_scale_size() was changed to accept an + additional parameter which is used to determine what kind of + scaling should be done, if any. Removed: * gaim_gtk_sound_{get,set}_mute() (replaced by the /gaim/gtk/sound/mute diff -r ea246204cf36 -r 30932055bb7c gtk/gtkaccount.c --- a/gtk/gtkaccount.c Wed Dec 20 09:28:29 2006 +0000 +++ b/gtk/gtkaccount.c Wed Dec 20 09:31:11 2006 +0000 @@ -218,9 +218,8 @@ int width, height; GdkPixbuf *scale; - if (dialog->prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY) - gaim_gtk_buddy_icon_get_scale_size(pixbuf, - &dialog->prpl_info->icon_spec, &width, &height); + gaim_gtk_buddy_icon_get_scale_size(pixbuf, &dialog->prpl_info->icon_spec, + GAIM_ICON_SCALE_DISPLAY, &width, &height); scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR); g_object_unref(G_OBJECT(pixbuf)); diff -r ea246204cf36 -r 30932055bb7c gtk/gtkconv.c --- a/gtk/gtkconv.c Wed Dec 20 09:28:29 2006 +0000 +++ b/gtk/gtkconv.c Wed Dec 20 09:31:11 2006 +0000 @@ -2308,9 +2308,8 @@ gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); - if (prpl_info && prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY) - gaim_gtk_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, - &scale_width, &scale_height); + gaim_gtk_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, + GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height); /* this code is ugly, and scares me */ scale = gdk_pixbuf_scale_simple(buf, @@ -6070,14 +6069,8 @@ start_anim(NULL, gtkconv); } - if (prpl_info && prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY) { - gaim_gtk_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, - &scale_width, &scale_height); - } else { - scale_width = gdk_pixbuf_get_width(buf); - scale_height = gdk_pixbuf_get_height(buf); - } - + gaim_gtk_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, + GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height); scale = gdk_pixbuf_scale_simple(buf, MAX(gdk_pixbuf_get_width(buf) * scale_width / gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), diff -r ea246204cf36 -r 30932055bb7c gtk/gtkutils.c --- a/gtk/gtkutils.c Wed Dec 20 09:28:29 2006 +0000 +++ b/gtk/gtkutils.c Wed Dec 20 09:31:11 2006 +0000 @@ -1525,11 +1525,14 @@ g_list_free(files); } -void gaim_gtk_buddy_icon_get_scale_size(GdkPixbuf *buf, GaimBuddyIconSpec *spec, int *width, int *height) +void gaim_gtk_buddy_icon_get_scale_size(GdkPixbuf *buf, GaimBuddyIconSpec *spec, GaimIconScaleRules rules, int *width, int *height) { *width = gdk_pixbuf_get_width(buf); *height = gdk_pixbuf_get_height(buf); + if ((spec == NULL) || !(spec->scale_rules & rules)) + return; + gaim_buddy_icon_get_scale_size(spec, width, height); /* and now for some arbitrary sanity checks */ diff -r ea246204cf36 -r 30932055bb7c gtk/gtkutils.h --- a/gtk/gtkutils.h Wed Dec 20 09:28:29 2006 +0000 +++ b/gtk/gtkutils.h Wed Dec 20 09:31:11 2006 +0000 @@ -362,7 +362,7 @@ /** * Convenience wrapper for gaim_buddy_icon_get_scale_size */ -void gaim_gtk_buddy_icon_get_scale_size(GdkPixbuf *buf, GaimBuddyIconSpec *spec, int *width, int *height); +void gaim_gtk_buddy_icon_get_scale_size(GdkPixbuf *buf, GaimBuddyIconSpec *spec, GaimIconScaleRules rules, int *width, int *height); /** * Returns the base image to represent the account, based on