mirror of https://github.com/GNOME/gimp.git
libgimpconfig: fix gimp_config_param_spec_duplicate() for objects and…
… object arrays. We were not supporting duplicating object pspec for no good reason. Well maybe the reason was that libgimpconfig does not see these types which are in libgimp. But then the trick is to compare by name. As for object array, they are present as subtypes of GimpArray specs. Yet most GimpParamSpec*Array-s are subclass of GimpParamSpecArray but GimpParamSpecObjectArray are their own GParamSpecBoxed subclass (same as the Gimp*Array-s are just typedef-s of GimpArray but GimpObjectArray is its own boxed type). So I had to move the object array test as its own case to fix support. Finally do not ignore anymore any type in gimp_config_class_init(). When we create a GimpConfig, we want to know when a type is not implemented as parameter (and if it's a well known type, we need to implement it).
This commit is contained in:
parent
e6350f9459
commit
e7a7edd29c
|
@ -333,20 +333,29 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
|
|||
copy = gimp_param_spec_rgb_array (name, nick, blurb,
|
||||
flags);
|
||||
}
|
||||
else if (GIMP_IS_PARAM_SPEC_OBJECT_ARRAY (pspec))
|
||||
{
|
||||
GimpParamSpecObjectArray *spec = GIMP_PARAM_SPEC_OBJECT_ARRAY (pspec);
|
||||
}
|
||||
else if (GIMP_IS_PARAM_SPEC_OBJECT_ARRAY (pspec))
|
||||
{
|
||||
GimpParamSpecObjectArray *spec = GIMP_PARAM_SPEC_OBJECT_ARRAY (pspec);
|
||||
|
||||
copy = gimp_param_spec_object_array (name, nick, blurb,
|
||||
spec->object_type,
|
||||
flags);
|
||||
}
|
||||
copy = gimp_param_spec_object_array (name, nick, blurb,
|
||||
spec->object_type,
|
||||
flags);
|
||||
}
|
||||
else if (G_IS_PARAM_SPEC_OBJECT (pspec))
|
||||
{
|
||||
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||
const gchar *type_name = g_type_name (value_type);
|
||||
|
||||
if (value_type == G_TYPE_FILE)
|
||||
if (value_type == G_TYPE_FILE ||
|
||||
/* These types are not visibile in libgimpconfig so we compare
|
||||
* with type names instead.
|
||||
*/
|
||||
g_strcmp0 (type_name, "GimpImage") == 0 ||
|
||||
g_strcmp0 (type_name, "GimpDrawable") == 0 ||
|
||||
g_strcmp0 (type_name, "GimpLayer") == 0 ||
|
||||
g_strcmp0 (type_name, "GimpSelection") == 0 ||
|
||||
g_strcmp0 (type_name, "GimpVectors") == 0)
|
||||
{
|
||||
copy = g_param_spec_object (name, nick, blurb,
|
||||
value_type,
|
||||
|
|
|
@ -141,12 +141,8 @@ gimp_config_class_init (GObjectClass *klass,
|
|||
{
|
||||
g_object_class_install_property (klass, i + 1, copy);
|
||||
}
|
||||
else if (! G_IS_PARAM_SPEC_OBJECT (pspec) &&
|
||||
! G_IS_PARAM_SPEC_POINTER (pspec) &&
|
||||
! GIMP_IS_PARAM_SPEC_OBJECT_ARRAY (pspec))
|
||||
else
|
||||
{
|
||||
/* silently ignore object properties */
|
||||
|
||||
g_warning ("%s: not supported: %s (%s)\n", G_STRFUNC,
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (pspec)), pspec->name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue