[gimp] app: make gimp_image_map_tool_preview() private



commit c77357053c918d07188bf8ad5a7504e561c32c14
Author: Michael Natterer <mitch gimp org>
Date:   Mon May 9 01:21:03 2016 +0200

    app: make gimp_image_map_tool_preview() private
    
    - call it in gimp_image_map_tool_get_operation() so
      gimp_operation_tool_set_operation() doesn't need to call it
    
    - gimp_image_map_tool_settings_import() doesn't need to call it because
      importing settings changes the config object anyway

 app/tools/gimpimagemaptool-settings.c |    2 -
 app/tools/gimpimagemaptool.c          |   39 ++++++++++++++++-----------------
 app/tools/gimpimagemaptool.h          |    1 -
 app/tools/gimpoperationtool.c         |    5 +---
 4 files changed, 20 insertions(+), 27 deletions(-)
---
diff --git a/app/tools/gimpimagemaptool-settings.c b/app/tools/gimpimagemaptool-settings.c
index 6a61725..25cc3a4 100644
--- a/app/tools/gimpimagemaptool-settings.c
+++ b/app/tools/gimpimagemaptool-settings.c
@@ -187,8 +187,6 @@ gimp_image_map_tool_settings_import (GimpSettingsBox  *box,
 
   g_object_unref (input);
 
-  gimp_image_map_tool_preview (im_tool);
-
   g_object_set (GIMP_TOOL_GET_OPTIONS (im_tool),
                 "settings", file,
                 NULL);
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 9d2cd72..3c253e4 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -132,6 +132,7 @@ static void      gimp_image_map_tool_dialog_unmap   (GtkWidget            *dialo
                                                      GimpImageMapTool     *im_tool);
 static void      gimp_image_map_tool_reset          (GimpImageMapTool     *im_tool);
 static void      gimp_image_map_tool_create_map     (GimpImageMapTool     *im_tool);
+static void      gimp_image_map_tool_preview        (GimpImageMapTool     *im_tool);
 
 static void      gimp_image_map_tool_flush          (GimpImageMap         *image_map,
                                                      GimpImageMapTool     *im_tool);
@@ -993,6 +994,22 @@ gimp_image_map_tool_create_map (GimpImageMapTool *im_tool)
 }
 
 static void
+gimp_image_map_tool_preview (GimpImageMapTool *im_tool)
+{
+  GimpTool            *tool    = GIMP_TOOL (im_tool);
+  GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
+
+  if (im_tool->image_map && options->preview)
+    {
+      gimp_tool_control_push_preserve (tool->control, TRUE);
+
+      gimp_image_map_apply (im_tool->image_map, NULL);
+
+      gimp_tool_control_pop_preserve (tool->control);
+    }
+}
+
+static void
 gimp_image_map_tool_flush (GimpImageMap     *image_map,
                            GimpImageMapTool *im_tool)
 {
@@ -1332,27 +1349,9 @@ gimp_image_map_tool_get_operation (GimpImageMapTool *im_tool)
                              G_OBJECT (im_tool), 0);
 
   if (GIMP_TOOL (im_tool)->drawable)
-    gimp_image_map_tool_create_map (im_tool);
-}
-
-void
-gimp_image_map_tool_preview (GimpImageMapTool *im_tool)
-{
-  GimpTool            *tool;
-  GimpImageMapOptions *options;
-
-  g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (im_tool));
-
-  tool    = GIMP_TOOL (im_tool);
-  options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
-
-  if (im_tool->image_map && options->preview)
     {
-      gimp_tool_control_push_preserve (tool->control, TRUE);
-
-      gimp_image_map_apply (im_tool->image_map, NULL);
-
-      gimp_tool_control_pop_preserve (tool->control);
+      gimp_image_map_tool_create_map (im_tool);
+      gimp_image_map_tool_preview (im_tool);
     }
 }
 
diff --git a/app/tools/gimpimagemaptool.h b/app/tools/gimpimagemaptool.h
index 969e8ed..0c5356a 100644
--- a/app/tools/gimpimagemaptool.h
+++ b/app/tools/gimpimagemaptool.h
@@ -108,7 +108,6 @@ struct _GimpImageMapToolClass
 GType       gimp_image_map_tool_get_type         (void) G_GNUC_CONST;
 
 void        gimp_image_map_tool_get_operation    (GimpImageMapTool *im_tool);
-void        gimp_image_map_tool_preview          (GimpImageMapTool *im_tool);
 
 void        gimp_image_map_tool_edit_as          (GimpImageMapTool *im_tool,
                                                   const gchar      *new_tool_id,
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 1e95e9a..87b1aa1 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -753,8 +753,5 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
     }
 
   if (GIMP_TOOL (tool)->drawable)
-    {
-      gimp_operation_tool_sync_op (tool, GIMP_TOOL (tool)->drawable);
-      gimp_image_map_tool_preview (im_tool);
-    }
+    gimp_operation_tool_sync_op (tool, GIMP_TOOL (tool)->drawable);
 }


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