[libdazzle] shortcuts: only add command once
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] shortcuts: only add command once
- Date: Thu, 20 Jul 2017 06:36:54 +0000 (UTC)
commit dce075b0df6b6b31e46c666ceee7b1ec8fb80103
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 19 23:35:06 2017 -0700
shortcuts: only add command once
We create these controllers at runtime and that means that we
could add the commands multiple times if we're not careful.
src/shortcuts/dzl-shortcut-controller.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-controller.c b/src/shortcuts/dzl-shortcut-controller.c
index 8b2f554..1d7b06f 100644
--- a/src/shortcuts/dzl-shortcut-controller.c
+++ b/src/shortcuts/dzl-shortcut-controller.c
@@ -1101,7 +1101,8 @@ dzl_shortcut_controller_add_command (DzlShortcutController *self,
/* Hook things up into the default context */
context = _dzl_shortcut_theme_find_default_context_with_phase (theme, priv->widget, phase);
- dzl_shortcut_context_add_command (context, default_accel, command_id);
+ if (!_dzl_shortcut_context_contains (context, chord))
+ dzl_shortcut_context_add_command (context, default_accel, command_id);
}
else
g_warning ("\"%s\" is not a valid accelerator chord", default_accel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]