builder: Show warning for invalid action on GtkShortcut

The parsing for a `GTK_TYPE_SHORTCUT_ACTION` on a GtkShortcut in a
builder file can fail, resulting in a `NULL` GtkShortcutAction. This
currently does not result in any warnings, potentially making typos in
builder files tricky to debug.

Since `gtk_shortcut_action_parse_builder()` already sets an error if it
fails, we can just use that and simply return false.
This commit is contained in:
Matthijs Velsink 2024-04-09 02:18:05 +02:00
parent f36f1b9829
commit c0b813940e

View File

@ -2695,8 +2695,10 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
{
GtkShortcutAction *action = gtk_shortcut_action_parse_builder (builder, string, error);
/* Works for success and failure (NULL) case */
g_value_take_object (value, action);
if (action)
g_value_take_object (value, action);
else
ret = FALSE;
}
else
{