[gimp/gimp-2-10] app: bind "orientation" measure-tool option to compass



commit bfa94216a95e8b9d780ab9a9ee8dd5ebf769cbbd
Author: Ell <ell_se yahoo com>
Date:   Sun Jul 15 19:54:47 2018 -0400

    app: bind "orientation" measure-tool option to compass
    
    Bind the "orientation" property of the measure-tool options to the
    tool's compass widget's "orientation" property, instead of manually
    synchronizing their values.
    
    (cherry picked from commit 7a91aabf37d0976da7e7dc3e268e183bd857b928)

 app/tools/gimpmeasuretool.c | 29 ++++-------------------------
 1 file changed, 4 insertions(+), 25 deletions(-)
---
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 24897ee648..4f24c94cfa 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -80,9 +80,6 @@ static void     gimp_measure_tool_motion          (GimpTool              *tool,
                                                    guint32                time,
                                                    GdkModifierType        state,
                                                    GimpDisplay           *display);
-static void     gimp_measure_tool_options_notify  (GimpTool              *tool,
-                                                   GimpToolOptions       *options,
-                                                   const GParamSpec      *pspec);
 
 static void     gimp_measure_tool_recalc_matrix   (GimpTransformTool     *tr_tool);
 static gchar  * gimp_measure_tool_get_undo_desc   (GimpTransformTool     *tr_tool);
@@ -149,7 +146,6 @@ gimp_measure_tool_class_init (GimpMeasureToolClass *klass)
   tool_class->button_press   = gimp_measure_tool_button_press;
   tool_class->button_release = gimp_measure_tool_button_release;
   tool_class->motion         = gimp_measure_tool_motion;
-  tool_class->options_notify = gimp_measure_tool_options_notify;
 
   tr_class->recalc_matrix    = gimp_measure_tool_recalc_matrix;
   tr_class->get_undo_desc    = gimp_measure_tool_get_undo_desc;
@@ -322,27 +318,6 @@ gimp_measure_tool_motion (GimpTool         *tool,
     }
 }
 
-static void
-gimp_measure_tool_options_notify (GimpTool         *tool,
-                                  GimpToolOptions  *options,
-                                  const GParamSpec *pspec)
-{
-  GimpMeasureTool    *measure         = GIMP_MEASURE_TOOL (tool);
-  GimpMeasureOptions *measure_options = GIMP_MEASURE_OPTIONS (options);
-
-  GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
-
-  if (! strcmp (pspec->name, "orientation"))
-    {
-      if (measure->widget)
-        {
-          g_object_set (measure->widget,
-                        "orientation", measure_options->orientation,
-                        NULL);
-        }
-    }
-}
-
 static void
 gimp_measure_tool_recalc_matrix (GimpTransformTool *tr_tool)
 {
@@ -488,6 +463,10 @@ gimp_measure_tool_start (GimpMeasureTool  *measure,
 
   gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), measure->widget);
 
+  g_object_bind_property (options,         "orientation",
+                          measure->widget, "orientation",
+                          G_BINDING_DEFAULT);
+
   g_signal_connect (measure->widget, "changed",
                     G_CALLBACK (gimp_measure_tool_compass_changed),
                     measure);


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