diff options
author | Benjamin Otte <otte@redhat.com> | 2018-08-20 19:45:51 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-03-25 23:14:28 -0400 |
commit | 580863b112063750e57cff74e879e75d857b1561 (patch) | |
tree | 98afd13063ea5b56573ea87fb25c37562f513949 /gtk/gtkapplicationaccels.c | |
parent | fb6a8f5fc154376895fa1e665d1bdf3bec8f993c (diff) | |
download | gtk+-580863b112063750e57cff74e879e75d857b1561.tar.gz |
accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
A parse function should return success or not. So do that.
Diffstat (limited to 'gtk/gtkapplicationaccels.c')
-rw-r--r-- | gtk/gtkapplicationaccels.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gtk/gtkapplicationaccels.c b/gtk/gtkapplicationaccels.c index e7a4f48948..f800cb4d7b 100644 --- a/gtk/gtkapplicationaccels.c +++ b/gtk/gtkapplicationaccels.c @@ -195,9 +195,7 @@ gtk_application_accels_set_accels_for_action (GtkApplicationAccels *accels, for (i = 0; i < n; i++) { - gtk_accelerator_parse (accelerators[i], &keys[i].key, &keys[i].modifier); - - if (keys[i].key == 0) + if (!gtk_accelerator_parse (accelerators[i], &keys[i].key, &keys[i].modifier)) { g_warning ("Unable to parse accelerator '%s': ignored request to install %d accelerators", accelerators[i], n); @@ -271,12 +269,10 @@ gtk_application_accels_get_actions_for_accel (GtkApplicationAccels *accels, AccelKey accel_key; guint i, n; - gtk_accelerator_parse (accel, &accel_key.key, &accel_key.modifier); - - if (accel_key.key == 0) + if (!gtk_accelerator_parse (accel, &accel_key.key, &accel_key.modifier)) { g_critical ("invalid accelerator string '%s'", accel); - g_return_val_if_fail (accel_key.key != 0, NULL); + return NULL; } actions_and_targets = g_hash_table_lookup (accels->accel_to_actions, &accel_key); |