diff pidgin/gtkimhtml.c @ 32184:a8f62638417e

Make the max size of incoming smileys a pref instead of harcoding it. Patch from Xinef (with small modifications) Refs #5231
author masca@cpw.pidgin.im
date Thu, 07 Jul 2011 04:47:10 +0000
parents e2c6e4fc3c84
children 9aee8493db7f 323876c34a96
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Wed Jul 06 22:04:06 2011 +0000
+++ b/pidgin/gtkimhtml.c	Thu Jul 07 04:47:10 2011 +0000
@@ -5691,18 +5691,19 @@
 static void
 gtk_custom_smiley_size_prepared(GdkPixbufLoader *loader, gint width, gint height, gpointer data)
 {
-#define CUSTOM_SMILEY_SIZE 96	/* XXX: Should this be a theme setting? */
-	if (width <= CUSTOM_SMILEY_SIZE && height <= CUSTOM_SMILEY_SIZE)
-		return;
-
-	if (width >= height) {
-		height = height * CUSTOM_SMILEY_SIZE / width;
-		width = CUSTOM_SMILEY_SIZE;
-	} else {
-		width = width * CUSTOM_SMILEY_SIZE / height;
-		height = CUSTOM_SMILEY_SIZE;
+	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys")) {
+		int custom_smileys_size = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size");
+		if (width <= custom_smileys_size && height <= custom_smileys_size)
+			return;
+
+		if (width >= height) {
+			height = height * custom_smileys_size / width;
+			width = custom_smileys_size;
+		} else {
+			width = width * custom_smileys_size / height;
+			height = custom_smileys_size;
+		}
 	}
-
 	gdk_pixbuf_loader_set_size(loader, width, height);
 }