pdb: Encode param info with unsupported type in a placeholder spec
To prevent losing all information about a type (and also reporting a different API by dropping a parameter when retrieving an operation's pspecs, create a placeholder type with a known name and type and put the rest of the information into its blurb. A little hack-y but filter browser can now show information of parameters with unsupported types.
This commit is contained in:
parent
74d79ba0c6
commit
ce5efe29d6
2 changed files with 42 additions and 26 deletions
|
|
@ -883,22 +883,14 @@ drawable_filter_operation_get_pspecs_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
GParamSpec *pspec = specs[n_parent_specs + i];
|
||||
GPParamDef param_def = { 0, };
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&value, G_TYPE_PARAM);
|
||||
|
||||
/* Make sure we do not try to send param specs over the wire
|
||||
* if we don't support sending their type.
|
||||
*/
|
||||
if (_gimp_param_spec_to_gp_param_def (pspec, ¶m_def, TRUE))
|
||||
{
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&value, G_TYPE_PARAM);
|
||||
|
||||
g_value_set_param (&value, g_param_spec_ref (pspec));
|
||||
gimp_value_array_append (pspecs, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
else
|
||||
if (! _gimp_param_spec_to_gp_param_def (pspec, ¶m_def, TRUE))
|
||||
{
|
||||
/* This is not technically a bug if an operation has
|
||||
* unsupported argument types, because we cannot possibly
|
||||
|
|
@ -909,11 +901,27 @@ drawable_filter_operation_get_pspecs_invoker (GimpProcedure *procedure,
|
|||
* want to softly notify developers, in case we can
|
||||
* actually do something about some types.
|
||||
*/
|
||||
g_printerr ("%s: ignoring argument '%s' of procedure '%s'. "
|
||||
g_printerr ("%s: replacing argument '%s' of procedure '%s' with a placeholder. "
|
||||
"Unsupported argument type '%s'.\n",
|
||||
G_STRFUNC, pspec->name, operation_name,
|
||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
|
||||
|
||||
g_value_set_param (&value, g_param_spec_param (
|
||||
"unknown", "Unknown",
|
||||
g_strdup_printf ("placeholder for unsupported type:%s:%s:%s",
|
||||
pspec->name,
|
||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||
g_param_spec_get_blurb (pspec)),
|
||||
G_TYPE_PARAM, G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_value_set_param (&value, g_param_spec_ref (pspec));
|
||||
}
|
||||
|
||||
gimp_value_array_append (pspecs, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
g_free (specs);
|
||||
|
|
|
|||
|
|
@ -849,22 +849,14 @@ HELP
|
|||
{
|
||||
GParamSpec *pspec = specs[n_parent_specs + i];
|
||||
GPParamDef param_def = { 0, };
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&value, G_TYPE_PARAM);
|
||||
|
||||
/* Make sure we do not try to send param specs over the wire
|
||||
* if we don't support sending their type.
|
||||
*/
|
||||
if (_gimp_param_spec_to_gp_param_def (pspec, ¶m_def, TRUE))
|
||||
{
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&value, G_TYPE_PARAM);
|
||||
|
||||
g_value_set_param (&value, g_param_spec_ref (pspec));
|
||||
gimp_value_array_append (pspecs, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
else
|
||||
if (! _gimp_param_spec_to_gp_param_def (pspec, ¶m_def, TRUE))
|
||||
{
|
||||
/* This is not technically a bug if an operation has
|
||||
* unsupported argument types, because we cannot possibly
|
||||
|
|
@ -875,11 +867,27 @@ HELP
|
|||
* want to softly notify developers, in case we can
|
||||
* actually do something about some types.
|
||||
*/
|
||||
g_printerr ("%s: ignoring argument '%s' of procedure '%s'. "
|
||||
g_printerr ("%s: replacing argument '%s' of procedure '%s' with a placeholder. "
|
||||
"Unsupported argument type '%s'.\n",
|
||||
G_STRFUNC, pspec->name, operation_name,
|
||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
|
||||
|
||||
g_value_set_param (&value, g_param_spec_param (
|
||||
"unknown", "Unknown",
|
||||
g_strdup_printf ("placeholder for unsupported type:%s:%s:%s",
|
||||
pspec->name,
|
||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||
g_param_spec_get_blurb (pspec)),
|
||||
G_TYPE_PARAM, G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_value_set_param (&value, g_param_spec_ref (pspec));
|
||||
}
|
||||
|
||||
gimp_value_array_append (pspecs, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
g_free (specs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue