[gimp] app: clean up the text options notify callback



commit 2dc577d606fc11f1f98d8eee6b95d1821a041997
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 17 16:05:45 2010 +0100

    app: clean up the text options notify callback

 app/tools/gimptexttool.c |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index dd20f7e..07bbeda 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -149,6 +149,10 @@ static void      gimp_text_tool_select_all      (GimpTextTool      *text_tool,
 static void      gimp_text_tool_connect         (GimpTextTool      *text_tool,
                                                  GimpTextLayer     *layer,
                                                  GimpText          *text);
+
+static void      gimp_text_tool_options_notify  (GimpTextOptions   *options,
+                                                 GParamSpec        *pspec,
+                                                 GimpTextTool      *text_tool);
 static void      gimp_text_tool_set_dynamic_box (GimpTextTool      *text_tool);
 static void      gimp_text_tool_layer_notify    (GimpTextLayer     *layer,
                                                  GParamSpec        *pspec,
@@ -188,9 +192,6 @@ static void gimp_text_tool_text_buffer_mark_set (GtkTextBuffer     *text_buffer,
                                                  GtkTextIter       *location,
                                                  GtkTextMark       *mark,
                                                  GimpTextTool      *text_tool);
-static void gimp_text_tool_use_editor_notify    (GimpTextOptions   *options,
-                                                 GParamSpec        *pspec,
-                                                 GimpTextTool      *text_tool);
 
 static gint gimp_text_tool_xy_to_offset         (GimpTextTool      *text_tool,
                                                  gdouble            x,
@@ -345,7 +346,7 @@ gimp_text_tool_constructor (GType                  type,
                            text_tool, 0);
 
   g_signal_connect_object (options, "notify::use-editor",
-                           G_CALLBACK (gimp_text_tool_use_editor_notify),
+                           G_CALLBACK (gimp_text_tool_options_notify),
                            text_tool, 0);
 
   g_object_set (options,
@@ -1887,19 +1888,24 @@ gimp_text_tool_connect (GimpTextTool  *text_tool,
 }
 
 static void
-gimp_text_tool_use_editor_notify (GimpTextOptions *options,
-                                  GParamSpec      *pspec,
-                                  GimpTextTool    *text_tool)
+gimp_text_tool_options_notify (GimpTextOptions *options,
+                               GParamSpec      *pspec,
+                               GimpTextTool    *text_tool)
 {
-  if (options->use_editor)
-    {
-      if (text_tool->text)
-        gimp_text_tool_editor_dialog (text_tool);
-    }
-  else
+  const gchar *param_name = g_param_spec_get_name (pspec);
+
+  if (! strcmp (param_name, "use-editor"))
     {
-      if (text_tool->editor)
-        gtk_widget_destroy (text_tool->editor);
+      if (options->use_editor)
+        {
+          if (text_tool->text)
+            gimp_text_tool_editor_dialog (text_tool);
+        }
+      else
+        {
+          if (text_tool->editor)
+            gtk_widget_destroy (text_tool->editor);
+        }
     }
 }
 



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