[gimp] app, libgimp: support GParamParam as a GParamSpec
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, libgimp: support GParamParam as a GParamSpec
- Date: Mon, 5 Aug 2019 12:16:46 +0000 (UTC)
commit 6c18492668841c8ac3e75fdb20a153b12aa4e001
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 5 14:14:32 2019 +0200
app, libgimp: support GParamParam as a GParamSpec
also add forgotten support for GimpParamEnum.
app/plug-in/gimpgpparams.c | 13 +++++++++++++
libgimp/gimpgpparams-body.c | 10 +++++++++-
libgimp/gimpgpparams.c | 14 ++++++++++++++
3 files changed, 36 insertions(+), 1 deletion(-)
---
diff --git a/app/plug-in/gimpgpparams.c b/app/plug-in/gimpgpparams.c
index c98aed55e8..236db44a8f 100644
--- a/app/plug-in/gimpgpparams.c
+++ b/app/plug-in/gimpgpparams.c
@@ -134,6 +134,12 @@ _gimp_gp_param_def_to_param_spec (gpointer gimp,
g_type_from_name (param_def->meta.m_enum.type_name),
param_def->meta.m_enum.default_val,
flags);
+
+ if (! strcmp (param_def->type_name, "GimpParamEnum"))
+ return gimp_param_spec_enum (name, nick, blurb,
+ g_type_from_name (param_def->meta.m_enum.type_name),
+ param_def->meta.m_enum.default_val,
+ flags);
break;
case GP_PARAM_DEF_TYPE_BOOLEAN:
@@ -225,6 +231,13 @@ _gimp_gp_param_def_to_param_spec (gpointer gimp,
param_def->meta.m_id.none_ok,
flags);
break;
+
+ case GP_PARAM_DEF_TYPE_PARAM_DEF:
+ if (! strcmp (param_def->type_name, "GParamParam"))
+ return g_param_spec_param (name, nick, blurb,
+ g_type_from_name (param_def->meta.m_param_def.type_name),
+ flags);
+ break;
}
g_printerr ("%s: GParamSpec type '%s' is not handled\n",
diff --git a/libgimp/gimpgpparams-body.c b/libgimp/gimpgpparams-body.c
index 00da2b1faa..0c76f410dd 100644
--- a/libgimp/gimpgpparams-body.c
+++ b/libgimp/gimpgpparams-body.c
@@ -73,7 +73,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_unit.allow_percent = uspec->allow_percent;
param_def->meta.m_unit.default_val = ispec->default_value;
}
- else if (pspec_type == G_TYPE_PARAM_ENUM)
+ else if (G_IS_PARAM_SPEC_ENUM (pspec))
{
GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
GType enum_type = pspec->value_type;
@@ -110,6 +110,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_string.null_ok = ! gsspec->ensure_non_null;
param_def->meta.m_string.default_val = gsspec->default_value;
+
if (pspec_type == GIMP_TYPE_PARAM_STRING)
{
GimpParamSpecString *sspec = GIMP_PARAM_SPEC_STRING (pspec);
@@ -157,6 +158,13 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_id.none_ok = ispec->none_ok;
}
+ else if (G_IS_PARAM_SPEC_PARAM (pspec))
+ {
+ param_def->param_def_type = GP_PARAM_DEF_TYPE_PARAM_DEF;
+
+ param_def->meta.m_param_def.type_name =
+ (gchar *) g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec));
+ }
}
void
diff --git a/libgimp/gimpgpparams.c b/libgimp/gimpgpparams.c
index 21dee89fae..8ee9e7a4c6 100644
--- a/libgimp/gimpgpparams.c
+++ b/libgimp/gimpgpparams.c
@@ -125,6 +125,13 @@ _gimp_gp_param_def_to_param_spec (gpointer gimp,
g_type_from_name (param_def->meta.m_enum.type_name),
param_def->meta.m_enum.default_val,
flags);
+
+ if (! strcmp (param_def->type_name, "GimpParamEnum"))
+ /* FIXME GimpParamEnum */
+ return g_param_spec_enum (name, nick, blurb,
+ g_type_from_name (param_def->meta.m_enum.type_name),
+ param_def->meta.m_enum.default_val,
+ flags);
break;
case GP_PARAM_DEF_TYPE_BOOLEAN:
@@ -207,6 +214,13 @@ _gimp_gp_param_def_to_param_spec (gpointer gimp,
param_def->meta.m_id.none_ok,
flags);
break;
+
+ case GP_PARAM_DEF_TYPE_PARAM_DEF:
+ if (! strcmp (param_def->type_name, "GParamParam"))
+ return g_param_spec_param (name, nick, blurb,
+ g_type_from_name (param_def->meta.m_param_def.type_name),
+ flags);
+ break;
}
g_printerr ("%s: GParamSpec type '%s' is not handled\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]