# HG changeset patch # User John Bailey # Date 1269483663 0 # Node ID d75813811637e1b695555ce9fe0aff152866992b # Parent 33a4d72232a734a79d41e368e64a0d321a4a12d4 Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy names, or anything else a plugin author might choose to dream up. Fixes #4598. diff -r 33a4d72232a7 -r d75813811637 ChangeLog --- a/ChangeLog Wed Mar 24 02:38:56 2010 +0000 +++ b/ChangeLog Thu Mar 25 02:21:03 2010 +0000 @@ -28,6 +28,8 @@ * Default binding of Ctrl+Shift+v to 'Paste as Plain Text' in conversation windows. This can be changed in .gtkrc-2.0. For example, Ctrl+v can be bound to 'Paste as Plain Text' by default. + * Plugins can now handle markup in buddy names by attaching to the signal + "drawing-buddy". Bonjour: * Added support for IPv6. (Thanks to T_X for testing) diff -r 33a4d72232a7 -r d75813811637 ChangeLog.API --- a/ChangeLog.API Wed Mar 24 02:38:56 2010 +0000 +++ b/ChangeLog.API Thu Mar 25 02:21:03 2010 +0000 @@ -32,6 +32,7 @@ * pidgin_dialogs_translators (should not be used by anything but Pidgin) * gtk_imhtmltoolbar_switch_active_conversation * 'paste' signal for GtkIMHtml (more in gtkimhtml-signals.dox) + * 'drawing-buddy' signal for gtkblist (more in gtkblist-signals.dox) version 2.6.6 (02/18/2010): libpurple: diff -r 33a4d72232a7 -r d75813811637 doc/gtkblist-signals.dox --- a/doc/gtkblist-signals.dox Wed Mar 24 02:38:56 2010 +0000 +++ b/doc/gtkblist-signals.dox Thu Mar 25 02:21:03 2010 +0000 @@ -5,6 +5,7 @@ @signal gtkblist-unhiding @signal gtkblist-created @signal drawing-tooltip + @signal drawing-buddy @endsignals @see gtkblist.h @@ -53,5 +54,17 @@ @param full Whether we're doing a full tooltip for the priority buddy or a compact tooltip for a non-priority buddy. @endsignaldef + + @signaldef drawing-buddy + @signalproto +char *(*drawing-buddy)(PurpleBuddy *buddy); + @endsignalproto + @signaldesc + Emitted to allow plugins to handle markup within a buddy's name or to + override the default of no formatting for names shown in the buddy list. + @param buddy A pointer to the PurpleBuddy that will be displayed. + @return The text to display (must be allocated), or @c NULL if no + changes to the default behavior are desired. + @endsignaldef */ // vim: syntax=c.doxygen tw=75 et diff -r 33a4d72232a7 -r d75813811637 pidgin/gtkblist.c --- a/pidgin/gtkblist.c Wed Mar 24 02:38:56 2010 +0000 +++ b/pidgin/gtkblist.c Thu Mar 25 02:21:03 2010 +0000 @@ -4271,7 +4271,12 @@ else name = purple_buddy_get_alias(b); - nametext = g_markup_escape_text(name, strlen(name)); + /* Raise a contact pre-draw signal here. THe callback will return an + * escaped version of the name. */ + nametext = purple_signal_emit_return_1(pidgin_blist_get_handle(), "drawing-buddy", b); + + if(!nametext) + nametext = g_markup_escape_text(name, strlen(name)); presence = purple_buddy_get_presence(b); @@ -7595,10 +7600,19 @@ purple_value_new_outgoing(PURPLE_TYPE_BOXED, "GString *"), purple_value_new(PURPLE_TYPE_BOOLEAN)); - - purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL); - purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL); - purple_signal_connect(purple_blist_get_handle(), "buddy-privacy-changed", gtk_blist_handle, PURPLE_CALLBACK(pidgin_blist_update_privacy_cb), NULL); + purple_signal_register(gtk_blist_handle, "drawing-buddy", + purple_marshal_POINTER__POINTER, + purple_value_new(PURPLE_TYPE_STRING), 1, + purple_value_new(PURPLE_TYPE_SUBTYPE, + PURPLE_SUBTYPE_BLIST_BUDDY)); + + purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", + gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL); + purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", + gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL); + purple_signal_connect(purple_blist_get_handle(), "buddy-privacy-changed", + gtk_blist_handle, PURPLE_CALLBACK(pidgin_blist_update_privacy_cb), NULL); + } void