app: don't reject toolrc files due to missing experimental tools

Add a new GimpToolInfo::experimental boolean field, and mark
GimpNPointDeformationTool and GimpSeamlessCloneTool as
experimental.  In gimp_tools_deserialize(), don't reject the file
if the only missing tools are experimental, but rather add them to
the passed container.  In particular, this prevents us from
rejecting the default toolrc file when experimental tools are
enabled.
This commit is contained in:
Ell 2020-02-05 00:03:13 +02:00
parent 626e5b9b14
commit 9f298f767f
1 changed files with 25 additions and 3 deletions

View File

@ -543,6 +543,20 @@ gimp_tools_deserialize (Gimp *gimp,
if (! tool_info->hidden && ! g_hash_table_contains (tools, tool_info))
{
if (tool_info->experimental)
{
/* if an experimental tool is not in the file, just add it to
* the tool-item list.
*/
gimp_container_add (container, GIMP_OBJECT (tool_info));
}
else
{
/* otherwise, it means we added a new stable tool. this must
* be the user toolrc file; rejct it, so that we fall back to
* the default toolrc file, which should contain the missing
* tool.
*/
g_scanner_error (scanner, "missing tools in toolrc file");
result = FALSE;
@ -550,6 +564,7 @@ gimp_tools_deserialize (Gimp *gimp,
break;
}
}
}
g_hash_table_unref (tools);
}
@ -734,6 +749,13 @@ gimp_tools_register (GType tool_type,
if (tool_type == GIMP_TYPE_OPERATION_TOOL)
tool_info->hidden = TRUE;
/* hack to not require experimental tools to be present in toolrc */
if (tool_type == GIMP_TYPE_N_POINT_DEFORMATION_TOOL ||
tool_type == GIMP_TYPE_SEAMLESS_CLONE_TOOL)
{
tool_info->experimental = TRUE;
}
g_object_set_data (G_OBJECT (tool_info), "gimp-tool-options-gui-func",
options_gui_func);