pidgin: 68ec69a9: Make the max size of incoming smileys a ...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Thu Jul 7 00:51:06 EDT 2011


----------------------------------------------------------------------
Revision: 68ec69a92f608fa91e453499f83908b79b96d047
Parent:   2a5fda677c1c053cc61d6aa0ebd71740dbb4fc28
Author:   masca at cpw.pidgin.im
Date:     07/07/11 00:47:10
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/68ec69a92f608fa91e453499f83908b79b96d047

Changelog: 

Make the max size of incoming smileys a pref instead of harcoding it. Patch from Xinef (with small modifications) Refs #5231

Changes against parent 2a5fda677c1c053cc61d6aa0ebd71740dbb4fc28

  patched  pidgin/gtkconv.c
  patched  pidgin/gtkimhtml.c
  patched  pidgin/gtkprefs.c

-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c	940a06658b489086b8aacb8da8bfd651912f5584
+++ pidgin/gtkimhtml.c	66e5bae4676a38c9409259178cf79940fb1c8508
@@ -5691,18 +5691,19 @@ gtk_custom_smiley_size_prepared(GdkPixbu
 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 (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_SMILEY_SIZE / width;
-		width = CUSTOM_SMILEY_SIZE;
-	} else {
-		width = width * CUSTOM_SMILEY_SIZE / height;
-		height = CUSTOM_SMILEY_SIZE;
+		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);
 }
 
============================================================
--- pidgin/gtkconv.c	1100c8ea5ae0a3c2b2ad8f0b1fe26b8bfb1b8dfd
+++ pidgin/gtkconv.c	607a4f7e015c4d1ae18d0edfc018ec20df299037
@@ -7883,6 +7883,8 @@ pidgin_conversations_init(void)
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
+	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys", TRUE);
+	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size", 96);
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 2);
 
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", TRUE);
============================================================
--- pidgin/gtkprefs.c	32709c4a648bcdbb3bd5027f40cc1853091b7218
+++ pidgin/gtkprefs.c	f35a70cbab14173359e1b5ce8cb15394ff73c554
@@ -1448,6 +1448,9 @@ conv_page(void)
 	GtkWidget *iconpref2;
 	GtkWidget *imhtml;
 	GtkWidget *frame;
+	GtkWidget *hbox;
+	GtkWidget *checkbox;
+	GtkWidget *spin_button;
 
 	ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
 	gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER);
@@ -1480,7 +1483,25 @@ conv_page(void)
 #ifdef _WIN32
 	pidgin_prefs_checkbox(_("F_lash window when IMs are received"), PIDGIN_PREFS_ROOT "/win32/blink_im", vbox);
 #endif
+	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 
+	checkbox = pidgin_prefs_checkbox(_("Resize incoming custom smileys"),
+			PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys", hbox);
+
+	spin_button = pidgin_prefs_labeled_spin_button(hbox,
+		_("Maximum size:"),
+		PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size",
+		16, 512, NULL);
+
+	if (!purple_prefs_get_bool(
+				PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys"))
+		gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE);
+
+	g_signal_connect(G_OBJECT(checkbox), "clicked",
+					 G_CALLBACK(pidgin_toggle_sensitive), spin_button);
+
+	pidgin_add_widget_to_vbox(GTK_BOX(vbox), NULL, NULL, hbox, TRUE, NULL);
+
 	pidgin_prefs_labeled_spin_button(vbox,
 		_("Minimum input area height in lines:"),
 		PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",


More information about the Commits mailing list