Mercurial > pidgin.yaz
diff pidgin/gtkconv.c @ 31894:a9e077fb65e9
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
This stems out of an email discussion with Andrew Victor back in July 2010
regarding letting protocol plugins clear the message scrollback area for
UIs. At the time, nobody objected to having the libpurple-clearing function
call the UI clearing function.
This should also be happily backward-compatible.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 31 Mar 2011 04:41:27 +0000 |
parents | 9710b3226f11 |
children | 8b9e9c61d061 32a00b76ce49 |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Wed Mar 30 22:36:30 2011 +0000 +++ b/pidgin/gtkconv.c Thu Mar 31 04:41:27 2011 +0000 @@ -373,23 +373,21 @@ return PURPLE_CMD_RET_OK; } -static void clear_conversation_scrollback(PurpleConversation *conv) +static void clear_conversation_scrollback_cb(PurpleConversation *conv, + void *data) { PidginConversation *gtkconv = NULL; - GList *iter; gtkconv = PIDGIN_CONVERSATION(conv); - - gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); - for (iter = gtkconv->convs; iter; iter = iter->next) - purple_conversation_clear_message_history(iter->data); + if (gtkconv) + gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); } static PurpleCmdRet clear_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - clear_conversation_scrollback(conv); + purple_conversation_clear_message_history(conv); return PURPLE_CMD_RET_OK; } @@ -397,7 +395,7 @@ clearall_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - purple_conversation_foreach(clear_conversation_scrollback); + purple_conversation_foreach(purple_conversation_clear_message_history); return PURPLE_CMD_RET_OK; } @@ -1113,7 +1111,7 @@ PurpleConversation *conv; conv = pidgin_conv_window_get_active_conversation(win); - clear_conversation_scrollback(conv); + purple_conversation_clear_message_history(conv); } static void @@ -8042,6 +8040,8 @@ purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", handle, G_CALLBACK(received_im_msg_cb), NULL); + purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", + handle, G_CALLBACK(clear_conversation_scrollback_cb), NULL); purple_conversations_set_ui_ops(&conversation_ui_ops);