[gegl] gegl: custom label and description for composer aux pads
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: custom label and description for composer aux pads
- Date: Fri, 19 Jul 2019 20:51:11 +0000 (UTC)
commit f52090d0937dd9c11437b05abbef556484f25a16
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Jul 19 18:39:20 2019 +0200
gegl: custom label and description for composer aux pads
Adds members to GeglOperationComposerClass and GeglOperationComposer3Class,
which if set are used on the paramspecs backing the pads.
gegl/operation/gegl-operation-composer.c | 13 ++++++++-----
gegl/operation/gegl-operation-composer.h | 4 +++-
gegl/operation/gegl-operation-composer3.c | 23 +++++++++++++----------
gegl/operation/gegl-operation-composer3.h | 5 ++++-
4 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer.c b/gegl/operation/gegl-operation-composer.c
index da5949197..e9b2602be 100644
--- a/gegl/operation/gegl-operation-composer.c
+++ b/gegl/operation/gegl-operation-composer.c
@@ -25,6 +25,7 @@
#include "gegl-operation-composer.h"
#include "gegl-operation-context.h"
#include "gegl-config.h"
+#include <glib/gi18n-lib.h>
static gboolean gegl_operation_composer_process (GeglOperation *operation,
GeglOperationContext *context,
@@ -67,6 +68,7 @@ static void
attach (GeglOperation *self)
{
GeglOperation *operation = GEGL_OPERATION (self);
+ GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
GParamSpec *pspec;
pspec = g_param_spec_object ("output",
@@ -88,13 +90,14 @@ attach (GeglOperation *self)
g_param_spec_sink (pspec);
pspec = g_param_spec_object ("aux",
- "Aux",
- "Auxiliary image buffer input pad.",
- GEGL_TYPE_BUFFER,
- G_PARAM_READWRITE |
- GEGL_PARAM_PAD_INPUT);
+ klass->aux_label?klass->aux_label:"Aux",
+ klass->aux_description?klass->aux_description:_("Auxiliary image buffer input pad."),
+ GEGL_TYPE_BUFFER,
+ G_PARAM_READWRITE |
+ GEGL_PARAM_PAD_INPUT);
gegl_operation_create_pad (operation, pspec);
g_param_spec_sink (pspec);
+
}
typedef struct ThreadData
diff --git a/gegl/operation/gegl-operation-composer.h b/gegl/operation/gegl-operation-composer.h
index 783498610..14b17598a 100644
--- a/gegl/operation/gegl-operation-composer.h
+++ b/gegl/operation/gegl-operation-composer.h
@@ -52,7 +52,9 @@ struct _GeglOperationComposerClass
GeglBuffer *output,
const GeglRectangle *result,
gint level);
- gpointer pad[4];
+ const char *aux_label;
+ const char *aux_description;
+ gpointer pad[2];
};
GType gegl_operation_composer_get_type (void) G_GNUC_CONST;
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index 6ef945ba0..22739619c 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -25,6 +25,8 @@
#include "gegl-operation-composer3.h"
#include "gegl-operation-context.h"
#include "gegl-config.h"
+#include <glib/gi18n-lib.h>
+
static gboolean gegl_operation_composer3_process
(GeglOperation *operation,
@@ -46,7 +48,7 @@ G_DEFINE_TYPE (GeglOperationComposer3, gegl_operation_composer3,
GEGL_TYPE_OPERATION)
- static void
+static void
gegl_operation_composer3_class_init (GeglOperationComposer3Class * klass)
{
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
@@ -58,20 +60,21 @@ gegl_operation_composer3_class_init (GeglOperationComposer3Class * klass)
operation_class->get_required_for_output = get_required_for_output;
}
- static void
+static void
gegl_operation_composer3_init (GeglOperationComposer3 *self)
{
}
- static void
+static void
attach (GeglOperation *self)
{
GeglOperation *operation = GEGL_OPERATION (self);
+ GeglOperationComposer3Class *klass = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation);
GParamSpec *pspec;
pspec = g_param_spec_object ("output",
"Output",
- "Output pad for generated image buffer.",
+ _("Output pad for generated image buffer."),
GEGL_TYPE_BUFFER,
G_PARAM_READABLE |
GEGL_PARAM_PAD_OUTPUT);
@@ -80,7 +83,7 @@ attach (GeglOperation *self)
pspec = g_param_spec_object ("input",
"Input",
- "Input pad, for image buffer input.",
+ _("Input pad, for image buffer input."),
GEGL_TYPE_BUFFER,
G_PARAM_READWRITE |
GEGL_PARAM_PAD_INPUT);
@@ -88,8 +91,8 @@ attach (GeglOperation *self)
g_param_spec_sink (pspec);
pspec = g_param_spec_object ("aux",
- "Aux",
- "Auxiliary image buffer input pad.",
+ klass->aux_label?klass->aux_label:"Aux",
+ klass->aux_description?klass->aux_description:_("Auxiliary image buffer input pad."),
GEGL_TYPE_BUFFER,
G_PARAM_READWRITE |
GEGL_PARAM_PAD_INPUT);
@@ -97,8 +100,8 @@ attach (GeglOperation *self)
g_param_spec_sink (pspec);
pspec = g_param_spec_object ("aux2",
- "Aux2",
- "Second auxiliary image buffer input pad.",
+ klass->aux2_label?klass->aux2_label:"Aux2",
+ klass->aux2_description?klass->aux2_description:_("Second auxiliary image buffer input pad."),
GEGL_TYPE_BUFFER,
G_PARAM_READWRITE |
GEGL_PARAM_PAD_INPUT);
@@ -208,7 +211,7 @@ gegl_operation_composer3_process (GeglOperation *operation,
GEGL_SPLIT_STRATEGY_AUTO,
(GeglParallelDistributeAreaFunc) thread_process,
&data);
-
+
success = data.success;
}
else
diff --git a/gegl/operation/gegl-operation-composer3.h b/gegl/operation/gegl-operation-composer3.h
index c8b6c7bf3..dc09828fc 100644
--- a/gegl/operation/gegl-operation-composer3.h
+++ b/gegl/operation/gegl-operation-composer3.h
@@ -48,7 +48,10 @@ struct _GeglOperationComposer3Class
GeglBuffer *output,
const GeglRectangle *result,
gint level);
- gpointer pad[4];
+ const char *aux_label;
+ const char *aux_description;
+ const char *aux2_label;
+ const char *aux2_description;
};
GType gegl_operation_composer3_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]