Fix -Wdiscarded-qualifiers in gimp_tool_button_update.

[2207/2321] Compiling C object app/widgets/libappwidgets.a.p/gimptoolbutton.c.o
../app/widgets/gimptoolbutton.c: In function ‘gimp_tool_button_update’:
../app/widgets/gimptoolbutton.c:905:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  905 |       gchar *id = gimp_object_get_name (tool_info);
      |                   ^~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Axel Viala 2022-03-29 17:04:32 +02:00 committed by Jehan
parent 2cfe18fcf7
commit 3372dbaf38
1 changed files with 9 additions and 7 deletions

View File

@ -902,10 +902,11 @@ gimp_tool_button_update (GimpToolButton *tool_button)
if (tool_info)
{
gchar *id = gimp_object_get_name (tool_info);
const gchar *tool_name = gimp_object_get_name (tool_info);
gchar *identifier;
if (g_str_has_prefix (id, "gimp-") &&
g_str_has_suffix (id, "-tool"))
if (g_str_has_prefix (tool_name, "gimp-") &&
g_str_has_suffix (tool_name, "-tool"))
{
/* The GimpToolInfo names are of the form "gimp-pencil-tool",
* and action names are of the form "tools-pencil".
@ -914,16 +915,17 @@ gimp_tool_button_update (GimpToolButton *tool_button)
*/
gchar *suffix;
id = g_strdup_printf ("tools-%s", id + 5);
suffix = g_strrstr (id, "-tool");
identifier = g_strdup_printf ("tools-%s", tool_name + 5);
suffix = g_strrstr (identifier, "-tool");
suffix[0] = '\0';
}
else
{
id = g_strdup (id);
identifier = g_strdup (tool_name);
}
gimp_widget_set_identifier (tool_button, id);
gimp_widget_set_identifier (GTK_WIDGET (tool_button), identifier);
g_free (identifier);
}
gimp_tool_button_update_toggled (tool_button);