Mercurial > pidgin
changeset 31726: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 | 3f47428bd4de |
children | eeb3a2f7f587 |
files | pidgin/gtkconv.c pidgin/gtkimhtml.c pidgin/gtkprefs.c |
diffstat | 3 files changed, 35 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Wed Jul 06 22:04:06 2011 +0000 +++ b/pidgin/gtkconv.c Thu Jul 07 04:47:10 2011 +0000 @@ -7883,6 +7883,8 @@ 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);
--- 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); }
--- a/pidgin/gtkprefs.c Wed Jul 06 22:04:06 2011 +0000 +++ b/pidgin/gtkprefs.c Thu Jul 07 04:47:10 2011 +0000 @@ -1448,6 +1448,9 @@ 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,6 +1483,24 @@ #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:"),