Mercurial > pidgin.yaz
diff pidgin/gtkimhtmltoolbar.c @ 22874:02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Mauro Srgio Ferreira Brasil.
I have not applied the bits on MSN yet. I will have to look at it later, but
I would rather someone else more familiar with the MSN code look at it first.
I changed some bits of the applied patch (whitespacing, camelcasing etc.), and
the bit that required a major version bump (in gtkthemes.h). There are a few
more things that need to be done for this to be merged back to i.p.p.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 19 Feb 2008 19:41:56 +0000 |
parents | 35d5b7804449 |
children | ac567757d236 |
line wrap: on
line diff
--- a/pidgin/gtkimhtmltoolbar.c Mon Feb 18 19:22:39 2008 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Tue Feb 19 19:41:56 2008 +0000 @@ -36,6 +36,7 @@ #include "gtkdialogs.h" #include "gtkimhtmltoolbar.h" +#include "gtksmiley.h" #include "gtkthemes.h" #include "gtkutils.h" @@ -626,6 +627,34 @@ image = gtk_image_new_from_file(filename); gtk_widget_size_request(image, &size); + + if (size.width > 24) { /* This is a custom smiley, let's scale it */ + GdkPixbuf *pixbuf = NULL; + GdkPixbuf *resized; + GtkImageType type; + + type = gtk_image_get_storage_type(GTK_IMAGE(image)); + + if (type == GTK_IMAGE_PIXBUF) { + pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); + } + else if (type == GTK_IMAGE_ANIMATION) { + GdkPixbufAnimation *animation; + + animation = gtk_image_get_animation(GTK_IMAGE(image)); + + pixbuf = gdk_pixbuf_animation_get_static_image(animation); + } + + if (pixbuf != NULL) { + resized = gdk_pixbuf_scale_simple(pixbuf, 24, 24, + GDK_INTERP_HYPER); + image = gtk_image_new_from_pixbuf(resized); + + gtk_widget_size_request(image, &size); + } + } + (*width) += size.width; button = gtk_button_new(); @@ -688,6 +717,7 @@ GtkWidget *dialog; GtkWidget *smiley_table = NULL; GSList *smileys, *unique_smileys = NULL; + GSList *custom_smileys = NULL; if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) { destroy_smiley_dialog(toolbar); @@ -709,6 +739,15 @@ smileys = smileys->next; } + custom_smileys = pidgin_smileys_get_all(); + + while (custom_smileys) { + GtkIMHtmlSmiley *smiley = custom_smileys->data; + unique_smileys = g_slist_append(unique_smileys, smiley); + + custom_smileys = custom_smileys->next; + } + dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);