Compare commits

...

1 Commits

Author SHA1 Message Date
Michael Gratton
9e4878d606 actionhelper: Mute warnings for actions with null targets
There's currently no way for actions parameterised with a target to be
disabled on a per-target basis, except by setting the target to be
null. This causes actionhelper to mark the associated widget as
insensitive as desired, but also print a warning about the target's
type being invalid.

This patch mutes the warning only in case the target is null, if the
target is otherwise the incorrect type then the warning will still be
printed.
2019-10-30 16:17:03 +11:00

View File

@@ -147,12 +147,18 @@ gtk_action_helper_action_added (GtkActionHelper *helper,
if (!helper->can_activate)
{
g_warning ("%s: action %s can't be activated due to parameter type mismatch "
"(parameter type %s, target type %s)",
"actionhelper",
helper->action_name,
parameter_type ? g_variant_type_peek_string (parameter_type) : "NULL",
helper->target ? g_variant_get_type_string (helper->target) : "NULL");
/* If target is null, just treat it as being disabled, otherwise
warn about the incorrect type. */
if (helper->target != NULL)
{
g_warning ("%s: action %s can't be activated due to parameter type mismatch "
"(parameter type %s, target type %s)",
"actionhelper",
helper->action_name,
parameter_type ? g_variant_type_peek_string (parameter_type) : "NULL",
g_variant_get_type_string (helper->target));
}
return;
}