app: block text buffer signals around copying to the clipboard

so the copying doesn't produce an undo step. Same fix as applied
earlier in button_press().
This commit is contained in:
Michael Natterer 2010-03-05 10:53:09 +01:00
parent 076948b4b7
commit e9f85b3afc

View file

@ -1804,8 +1804,27 @@ gimp_text_tool_copy_clipboard (GimpTextTool *text_tool)
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
GDK_SELECTION_CLIPBOARD);
/* need to block "end-user-action" on the text buffer, because
* GtkTextBuffer considers copying text to the clipboard an
* undo-relevant user action, which is clearly a bug, but what
* can we do...
*/
g_signal_handlers_block_by_func (text_tool->buffer,
gimp_text_tool_buffer_begin_edit,
text_tool);
g_signal_handlers_block_by_func (text_tool->buffer,
gimp_text_tool_buffer_end_edit,
text_tool);
gtk_text_buffer_copy_clipboard (GTK_TEXT_BUFFER (text_tool->buffer),
clipboard);
g_signal_handlers_unblock_by_func (text_tool->buffer,
gimp_text_tool_buffer_end_edit,
text_tool);
g_signal_handlers_unblock_by_func (text_tool->buffer,
gimp_text_tool_buffer_begin_edit,
text_tool);
}
void