Commit 85cb525c authored by Massimo Valentini's avatar Massimo Valentini

Bug 766128: Use gegl_operation_progress

instead of reimplementing it in two operations
parent ec99c99b
......@@ -108,25 +108,17 @@ gimp_gegl_progress_connect (GeglNode *node,
GimpProgress *progress,
const gchar *text)
{
GObject *operation = NULL;
g_return_if_fail (GEGL_IS_NODE (node));
g_return_if_fail (GIMP_IS_PROGRESS (progress));
g_object_get (node, "gegl-operation", &operation, NULL);
g_return_if_fail (operation != NULL);
g_signal_connect (operation, "progress",
g_signal_connect (node, "progress",
G_CALLBACK (gimp_gegl_progress_callback),
progress);
if (text)
g_object_set_data_full (operation,
g_object_set_data_full (G_OBJECT (node),
"gimp-progress-text", g_strdup (text),
(GDestroyNotify) g_free);
g_object_unref (operation);
}
gboolean
......
......@@ -28,7 +28,6 @@
#include "operations-types.h"
#include "core/gimpmarshal.h"
#include "gimpoperationcagetransform.h"
#include "gimpcageconfig.h"
......@@ -41,12 +40,6 @@ enum
PROP_FILL,
};
enum
{
PROGRESS,
LAST_SIGNAL
};
static void gimp_operation_cage_transform_finalize (GObject *object);
static void gimp_operation_cage_transform_get_property (GObject *object,
......@@ -94,8 +87,6 @@ G_DEFINE_TYPE (GimpOperationCageTransform, gimp_operation_cage_transform,
#define parent_class gimp_operation_cage_transform_parent_class
static guint cage_transform_signals[LAST_SIGNAL] = { 0 };
static void
gimp_operation_cage_transform_class_init (GimpOperationCageTransformClass *klass)
......@@ -104,16 +95,6 @@ gimp_operation_cage_transform_class_init (GimpOperationCageTransformClass *klass
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
GeglOperationComposerClass *filter_class = GEGL_OPERATION_COMPOSER_CLASS (klass);
cage_transform_signals[PROGRESS] =
g_signal_new ("progress",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
gimp_marshal_VOID__DOUBLE,
G_TYPE_NONE, 1,
G_TYPE_DOUBLE);
object_class->get_property = gimp_operation_cage_transform_get_property;
object_class->set_property = gimp_operation_cage_transform_set_property;
object_class->finalize = gimp_operation_cage_transform_finalize;
......@@ -230,13 +211,6 @@ gimp_operation_cage_transform_prepare (GeglOperation *operation)
babl_format_n (babl_type ("float"), 2));
}
static void
gimp_operation_cage_transform_notify_progress (gpointer instance,
gdouble progress)
{
g_signal_emit (instance, cage_transform_signals[PROGRESS], 0, progress);
}
static gboolean
gimp_operation_cage_transform_process (GeglOperation *operation,
GeglBuffer *in_buf,
......@@ -314,7 +288,7 @@ gimp_operation_cage_transform_process (GeglOperation *operation,
}
}
gimp_operation_cage_transform_notify_progress (oct, 0.0);
gegl_operation_progress (operation, 0.0, "");
/* pre-allocate memory outside of the loop */
coords = g_slice_alloc (2 * sizeof (gfloat));
......@@ -379,7 +353,7 @@ gimp_operation_cage_transform_process (GeglOperation *operation,
/* 0.0 and 1.0 indicate progress start/end, so avoid them */
if (fraction > 0.0 && fraction < 1.0)
{
gimp_operation_cage_transform_notify_progress (oct, fraction);
gegl_operation_progress (operation, fraction, "");
}
}
}
......@@ -387,7 +361,7 @@ gimp_operation_cage_transform_process (GeglOperation *operation,
g_free (coef);
g_slice_free1 (2 * sizeof (gfloat), coords);
gimp_operation_cage_transform_notify_progress (oct, 1.0);
gegl_operation_progress (operation, 1.0, "");
return TRUE;
}
......
......@@ -29,7 +29,6 @@
#include "operations-types.h"
#include "core/gimpmarshal.h"
#include "gimpoperationshapeburst.h"
......@@ -39,12 +38,6 @@ enum
PROP_NORMALIZE,
};
enum
{
PROGRESS,
LAST_SIGNAL
};
static void gimp_operation_shapeburst_get_property (GObject *object,
guint property_id,
......@@ -75,8 +68,6 @@ G_DEFINE_TYPE (GimpOperationShapeburst, gimp_operation_shapeburst,
#define parent_class gimp_operation_shapeburst_parent_class
static guint shapeburst_signals[LAST_SIGNAL] = { 0 };
static void
gimp_operation_shapeburst_class_init (GimpOperationShapeburstClass *klass)
......@@ -85,16 +76,6 @@ gimp_operation_shapeburst_class_init (GimpOperationShapeburstClass *klass)
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
GeglOperationFilterClass *filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
shapeburst_signals[PROGRESS] =
g_signal_new ("progress",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
gimp_marshal_VOID__DOUBLE,
G_TYPE_NONE, 1,
G_TYPE_DOUBLE);
object_class->set_property = gimp_operation_shapeburst_set_property;
object_class->get_property = gimp_operation_shapeburst_get_property;
......@@ -163,13 +144,6 @@ gimp_operation_shapeburst_set_property (GObject *object,
}
}
static void
gimp_operation_shapeburst_notify_progress (gpointer instance,
gdouble progress)
{
g_signal_emit (instance, shapeburst_signals[PROGRESS], 0, progress);
}
static void
gimp_operation_shapeburst_prepare (GeglOperation *operation)
{
......@@ -320,7 +294,7 @@ gimp_operation_shapeburst_process (GeglOperation *operation,
0, output_format, distbuf_cur,
GEGL_AUTO_ROWSTRIDE);
gimp_operation_shapeburst_notify_progress (operation, (gdouble) y / roi->height);
gegl_operation_progress (operation, (gdouble) y / roi->height, "");
}
g_free (distbuf);
......@@ -342,7 +316,7 @@ gimp_operation_shapeburst_process (GeglOperation *operation,
}
}
gimp_operation_shapeburst_notify_progress (operation, 1.0);
gegl_operation_progress (operation, 1.0, "");
return TRUE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment