app: do not rely on data name for identifying internal data.

The name for internal data may be localized. This is the case at least
for some dynamic gradients (Foreground to Background and others).
Nevertheless they have unique collection name. So let's simply rely on
this for internal data.
See point 2 in: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/1830#note_2218014

I also change the standard alias fonts to also have unique collection
names. These seem to be the only other internal data which had no unique
collection until now, which is now fixed.
This commit is contained in:
Jehan 2024-09-09 13:40:59 +02:00
parent 9963543a01
commit 0270fa5d7f
2 changed files with 10 additions and 2 deletions

View File

@ -1404,7 +1404,11 @@ gimp_data_identify (GimpData *data,
identified = (is_internal == gimp_data_is_internal (data) &&
g_strcmp0 (collection, current_collection) == 0 &&
g_strcmp0 (name, gimp_object_get_name (GIMP_OBJECT (data))) == 0);
/* Internal data have unique collection names. Moreover
* their names can be localized so it should not be
* relied upon for comparison.
*/
(is_internal ? TRUE : g_strcmp0 (name, gimp_object_get_name (GIMP_OBJECT (data))) == 0));
g_free (current_collection);

View File

@ -632,7 +632,11 @@ gimp_font_factory_add_font (GimpContainer *container,
}
else
{
gimp_data_make_internal (GIMP_DATA (font), "gimp-font-standard-alias");
gchar *collection;
collection = g_strdup_printf ("gimp-font-standard-alias: %s", name);
gimp_data_make_internal (GIMP_DATA (font), collection);
g_free (collection);
}
gimp_container_add (container, GIMP_OBJECT (font));