app: when connecting the text object, also set its text on the buffer

and don't do it in editor_start(), which caused an undo to be pushed.
This commit is contained in:
Michael Natterer 2010-02-21 02:00:57 +01:00
parent a6ca7e184c
commit 5150f3c8f6
2 changed files with 9 additions and 15 deletions

View File

@ -138,12 +138,6 @@ gimp_text_tool_editor_start (GimpTextTool *text_tool)
gtk_im_context_focus_in (text_tool->im_context);
if (text_tool->text)
gtk_text_buffer_set_text (text_tool->text_buffer,
text_tool->text->text, -1);
else
gtk_text_buffer_set_text (text_tool->text_buffer, "", -1);
if (options->use_editor)
gimp_text_tool_editor_dialog (text_tool);

View File

@ -949,6 +949,10 @@ gimp_text_tool_connect (GimpTextTool *text_tool,
{
GimpTextOptions *options = GIMP_TEXT_TOOL_GET_OPTIONS (tool);
g_signal_handlers_block_by_func (text_tool->text_buffer,
gimp_text_tool_buffer_changed,
text_tool);
if (text_tool->text)
{
g_signal_handlers_disconnect_by_func (text_tool->text,
@ -962,16 +966,7 @@ gimp_text_tool_connect (GimpTextTool *text_tool,
text_tool->text = NULL;
g_object_set (text_tool->proxy, "text", NULL, NULL);
g_signal_handlers_block_by_func (text_tool->text_buffer,
gimp_text_tool_buffer_changed,
text_tool);
gtk_text_buffer_set_text (text_tool->text_buffer, "", -1);
g_signal_handlers_unblock_by_func (text_tool->text_buffer,
gimp_text_tool_buffer_changed,
text_tool);
}
gimp_context_define_property (GIMP_CONTEXT (options),
@ -981,6 +976,7 @@ gimp_text_tool_connect (GimpTextTool *text_tool,
if (text)
{
gimp_config_sync (G_OBJECT (text), G_OBJECT (text_tool->proxy), 0);
gtk_text_buffer_set_text (text_tool->text_buffer, text->text, -1);
text_tool->text = g_object_ref (text);
@ -988,6 +984,10 @@ gimp_text_tool_connect (GimpTextTool *text_tool,
G_CALLBACK (gimp_text_tool_text_notify),
text_tool);
}
g_signal_handlers_unblock_by_func (text_tool->text_buffer,
gimp_text_tool_buffer_changed,
text_tool);
}
if (text_tool->layer != layer)