changeset 15239:30932055bb7c

[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 <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 20 Dec 2006 09:31:11 +0000
parents ea246204cf36
children 7ce73985115a
files ChangeLog.API gtk/gtkaccount.c gtk/gtkconv.c gtk/gtkutils.c gtk/gtkutils.h
diffstat 5 files changed, 15 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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));
--- 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),
--- 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 */
--- 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