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



commit 5150f3c8f616585373ba3a0171caede8e763ed91
Author: Michael Natterer <mitch gimp org>
Date:   Sun Feb 21 02:00:57 2010 +0100

    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.

 app/tools/gimptexttool-editor.c |    6 ------
 app/tools/gimptexttool.c        |   18 +++++++++---------
 2 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index c69e69b..a14af8c 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -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);
 
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 6907c4d..720ffc3 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]