# HG changeset patch # User Elliott Sales de Andrade # Date 1241395495 0 # Node ID 985e7f8d874434ec2d996262e7cd4c03b7481202 # Parent 18129e760e1082d91b46576518d340f5830e806f# Parent 5f9c475b57ca6de93f6673dc015b9a6940cb6ef0 merge of '233c28248ecd717704ccb1932748bdf97b679cf1' and 'f575a8d88f75dfe9f1541c8c290a3b7ef621c4a0' diff -r 18129e760e10 -r 985e7f8d8744 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Mon May 04 00:01:16 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Mon May 04 00:04:55 2009 +0000 @@ -848,10 +848,10 @@ MsnSession *session; PurpleAccount *account; PurpleConnection *gc; - /*char *adl = g_strndup(payload, len);*/ - char *reason = g_strdup_printf(_("Unknown error (%d)"), - GPOINTER_TO_INT(cmd->payload_cbdata)/*, adl*/); - /*g_free(adl);*/ + char *adl = g_strndup(payload, len); + char *reason = g_strdup_printf(_("Unknown error (%d): %s"), + GPOINTER_TO_INT(cmd->payload_cbdata), adl); + g_free(adl); session = cmdproc->session; account = session->account; diff -r 18129e760e10 -r 985e7f8d8744 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Mon May 04 00:01:16 2009 +0000 +++ b/pidgin/gtkimhtml.c Mon May 04 00:04:55 2009 +0000 @@ -4420,15 +4420,19 @@ * people can highlight stuff. */ /* gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(imhtml), editable); */ - imhtml->editable = editable; - imhtml->format_functions = GTK_IMHTML_ALL; - - if (editable) - { + if (editable && !imhtml->editable) { g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), imhtml); g_signal_connect(G_OBJECT(imhtml), "backspace", G_CALLBACK(smart_backspace_cb), NULL); + } else if (!editable && imhtml->editable) { + g_signal_handlers_disconnect_by_func(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), + mark_set_cb, imhtml); + g_signal_handlers_disconnect_by_func(G_OBJECT(imhtml), + smart_backspace_cb, NULL); } + + imhtml->editable = editable; + imhtml->format_functions = GTK_IMHTML_ALL; } void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo) @@ -5880,3 +5884,16 @@ g_signal_connect(G_OBJECT(imhtml), "message_send", G_CALLBACK(return_add_newline_cb), NULL); } + +void gtk_imhtml_set_populate_primary_clipboard(GtkIMHtml *imhtml, gboolean populate) +{ + if (populate) { + g_signal_handlers_unblock_matched(imhtml->text_buffer, + G_SIGNAL_MATCH_FUNC, 0, 0, NULL, + mark_set_so_update_selection_cb, NULL); + } else { + g_signal_handlers_block_matched(imhtml->text_buffer, + G_SIGNAL_MATCH_FUNC, 0, 0, NULL, + mark_set_so_update_selection_cb, NULL); + } +} diff -r 18129e760e10 -r 985e7f8d8744 pidgin/gtkimhtml.h --- a/pidgin/gtkimhtml.h Mon May 04 00:01:16 2009 +0000 +++ b/pidgin/gtkimhtml.h Mon May 04 00:04:55 2009 +0000 @@ -957,6 +957,16 @@ */ void gtk_imhtml_set_return_inserts_newline(GtkIMHtml *imhtml); +/** + * By default this widget populates the PRIMARY clipboard with any selected + * text (as you would expect). For scenarios (e.g. select-on-focus) where this + * would be problematic, this function can disable the PRIMARY population. + * + * @oaram imhtml The GtkIMHtml to enable/disable populating PRIMARY + * @param populate enable/disable PRIMARY population + */ +void gtk_imhtml_set_populate_primary_clipboard(GtkIMHtml *imhtml, gboolean populate); + /*@}*/ #ifdef __cplusplus diff -r 18129e760e10 -r 985e7f8d8744 pidgin/gtkstatusbox.c --- a/pidgin/gtkstatusbox.c Mon May 04 00:01:16 2009 +0000 +++ b/pidgin/gtkstatusbox.c Mon May 04 00:04:55 2009 +0000 @@ -265,6 +265,9 @@ break; } + gtk_imhtml_set_populate_primary_clipboard( + GTK_IMHTML(status_box->imhtml), TRUE); + if (status_no != -1) { GtkTreePath *path; gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); @@ -1149,6 +1152,8 @@ { purple_timeout_remove(status_box->typing); status_box->typing = 0; + gtk_imhtml_set_populate_primary_clipboard( + GTK_IMHTML(status_box->imhtml), TRUE); if (status_box->account != NULL) update_to_reflect_account_status(status_box, status_box->account, purple_account_get_active_status(status_box->account)); @@ -1876,7 +1881,7 @@ g_signal_connect(G_OBJECT(status_box->imhtml), "key_press_event", G_CALLBACK(imhtml_remove_focus), status_box); g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "message_send", G_CALLBACK(remove_typing_cb), status_box); - gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE); + #ifdef USE_GTKSPELL if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) pidgin_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml)); @@ -2583,6 +2588,9 @@ return; } + gtk_imhtml_set_populate_primary_clipboard( + GTK_IMHTML(status_box->imhtml), TRUE); + purple_timeout_remove(status_box->typing); status_box->typing = 0; @@ -2682,6 +2690,10 @@ status_box->typing = purple_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); gtk_widget_grab_focus(status_box->imhtml); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); + + gtk_imhtml_set_populate_primary_clipboard( + GTK_IMHTML(status_box->imhtml), FALSE); + gtk_text_buffer_get_bounds(buffer, &start, &end); gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "insert"), &end); gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "selection_bound"), &start);