- /* GTK has the useful feature of showing key bindings for actions in
- * menus. As of August 2015, we have no interest in trying to
- * reimplement this functionality, so we will use it even though we no
- * longer use GTK accelerators for handling key events. To do this, we
- * need to make sure that there is a fully populated GTK AccelMap set
- * up with all bindings/actions.
- */
-
- Gtk::AccelKey gtk_key;
-
- /* tweak the modifier used in the binding so that GTK will accept it
- * and display something acceptable. The actual keyval should display
- * correctly even if it involves a key that GTK would not allow
- * as an accelerator.
- */
-
- uint32_t gtk_legal_keyval = kb.key();
- possibly_translate_keyval_to_make_legal_accelerator (gtk_legal_keyval);
- KeyboardKey gtk_binding (kb.state(), gtk_legal_keyval);
-
-
- bool entry_exists = Gtk::AccelMap::lookup_entry (what->get_accel_path(), gtk_key);
-
- if (!entry_exists || gtk_key.get_key() == 0) {
-
- /* there is a trick happening here. It turns out that
- * gtk_accel_map_add_entry() performs no validation checks on
- * the accelerator keyval. This means we can use it to define
- * ANY accelerator, even if they violate GTK's rules
- * (e.g. about not using navigation keys). This works ONLY when
- * the entry in the GTK accelerator map has not already been
- * added. The entries will be added by the GTK UIManager when
- * building menus, so this code must be called before that
- * happens.
- */
-
- Gtk::AccelMap::add_entry (what->get_accel_path(),
- gtk_binding.key(),
- (Gdk::ModifierType) gtk_binding.state());
- } else {
- warning << string_compose (_("There is more than one key binding defined for %1. Both will work, but only the first will be visible in menus"), what->get_accel_path()) << endmsg;
- }
-
- if (!Gtk::AccelMap::lookup_entry (what->get_accel_path(), gtk_key) || gtk_key.get_key() == 0) {
- cerr << "GTK binding using " << gtk_binding << " failed for " << what->get_accel_path() << " existing = " << gtk_key.get_key() << " + " << gtk_key.get_mod() << endl;
- }
-}
-
-bool
-Bindings::replace (KeyboardKey kb, Operation op, string const & action_name, bool can_save)
-{
- /* We have to search the existing binding map by both action and
- * keybinding, because the following are possible:
- *
- * - key is already used for a different action
- * - action has a different binding
- * - key is not used
- * - action is not bound
+ /* GTK has the useful feature of showing key bindings for actions in
+ * menus. As of August 2015, we have no interest in trying to
+ * reimplement this functionality, so we will use it even though we no
+ * longer use GTK accelerators for handling key events. To do this, we
+ * need to make sure that there is a fully populated GTK AccelMap set
+ * up with all bindings/actions.