# HG changeset patch # User Mark Doliner # Date 1177314861 0 # Node ID ea82f4e6321e491fe55d48eb5104a23812314224 # Parent bfa7bc0e7b21b60b93fc6f376a30bd22f66dda3d# Parent cf62255b0a74cc0d8d7cf43ec816809e9887ead8 merge of '2a2d4d6f656ef5ff272b086eb6eba1bee0c466de' and 'd6146877517deb248a8d68f13e7596b75ab0ca90' diff -r bfa7bc0e7b21 -r ea82f4e6321e finch/plugins/gntgf.c --- a/finch/plugins/gntgf.c Mon Apr 23 07:54:13 2007 +0000 +++ b/finch/plugins/gntgf.c Mon Apr 23 07:54:21 2007 +0000 @@ -111,6 +111,15 @@ } #ifdef HAVE_X11 +static int +error_handler(Display *dpy, XErrorEvent *error) +{ + char buffer[1024]; + XGetErrorText(dpy, error->error_code, buffer, sizeof(buffer)); + purple_debug_error("gntgf", "Could not set urgent to the window: %s.\n", buffer); + return 0; +} + static void urgent() { @@ -130,9 +139,14 @@ if (dpy == NULL) return; + XSetErrorHandler(error_handler); hints = XGetWMHints(dpy, id); - hints->flags|=XUrgencyHint; - XSetWMHints(dpy, id, hints); + if (hints) { + hints->flags|=XUrgencyHint; + XSetWMHints(dpy, id, hints); + XFree(hints); + } + XSetErrorHandler(NULL); XFlush(dpy); XCloseDisplay(dpy); diff -r bfa7bc0e7b21 -r ea82f4e6321e pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Mon Apr 23 07:54:13 2007 +0000 +++ b/pidgin/gtkimhtml.c Mon Apr 23 07:54:21 2007 +0000 @@ -1217,6 +1217,7 @@ g_list_free(imhtml->scalables); g_slist_free(imhtml->im_images); + g_queue_free(imhtml->animations); g_free(imhtml->protocol_name); g_free(imhtml->search_string); G_OBJECT_CLASS(parent_class)->finalize (object); @@ -1398,7 +1399,7 @@ imhtml->scalables = NULL; - + imhtml->animations = g_queue_new(); gtk_imhtml_set_editable(imhtml, FALSE); g_signal_connect(G_OBJECT(imhtml), "populate-popup", G_CALLBACK(hijack_menu_cb), NULL); @@ -4356,6 +4357,22 @@ return TRUE; } +/* In case the smiley gets removed from the imhtml before it gets removed from the queue */ +static void animated_smiley_destroy_cb(GtkObject *widget, GtkIMHtml *imhtml) +{ + GList *l = imhtml->animations->head; + while (l) { + GList *next = l->next; + if (l->data == widget) { + if (l == imhtml->animations->tail) + imhtml->animations->tail = imhtml->animations->tail->prev; + imhtml->animations->head = g_list_delete_link(imhtml->animations->head, l); + imhtml->num_animations--; + } + l = next; + } +} + void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter) { GdkPixbuf *pixbuf = NULL; @@ -4374,6 +4391,18 @@ icon = gtk_image_new_from_pixbuf(pixbuf); } else { icon = gtk_image_new_from_animation(annipixbuf); + if (imhtml->num_animations == 20) { + GtkImage *image = GTK_IMAGE(g_queue_pop_head(imhtml->animations)); + GdkPixbufAnimation *anim = gtk_image_get_animation(image); + if (anim) { + GdkPixbuf *pb = gdk_pixbuf_animation_get_static_image(anim); + gtk_image_set_from_pixbuf(image, pb); + } + } else { + imhtml->num_animations++; + } + g_signal_connect(G_OBJECT(icon), "destroy", G_CALLBACK(animated_smiley_destroy_cb), imhtml); + g_queue_push_tail(imhtml->animations, icon); } } } diff -r bfa7bc0e7b21 -r ea82f4e6321e pidgin/gtkimhtml.h --- a/pidgin/gtkimhtml.h Mon Apr 23 07:54:13 2007 +0000 +++ b/pidgin/gtkimhtml.h Mon Apr 23 07:54:21 2007 +0000 @@ -87,6 +87,8 @@ char *protocol_name; guint scroll_src; GTimer *scroll_time; + GQueue *animations; + int num_animations; gboolean show_comments; diff -r bfa7bc0e7b21 -r ea82f4e6321e pidgin/gtkstatusbox.c --- a/pidgin/gtkstatusbox.c Mon Apr 23 07:54:13 2007 +0000 +++ b/pidgin/gtkstatusbox.c Mon Apr 23 07:54:21 2007 +0000 @@ -1077,8 +1077,8 @@ add_popular_statuses(status_box); pidgin_status_box_add_separator(PIDGIN_STATUS_BOX(status_box)); - pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); - pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); + pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, NULL, _("New..."), NULL, NULL); + pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, NULL, _("Saved..."), NULL, NULL); if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); status_menu_refresh_iter(status_box);