/// <summary> /// Removes an accelerator from all accelerator groups associated with the main window. /// </summary> /// <param name="command">For convenience - not actually used.</param> /// <param name="visual">The visual from which to remove the accelerator.</param> /// <param name="key">The keyboard shortcut.</param> /// <remarks>If the visual is null, the shortcut will be registered using the /// current application's MainWindow.</remarks> public static void RemoveAccelerator(this VisualRelayCommand command, Gtk.Widget visual, Gtk.AccelKey key) { var mainWindow = SingleInstanceApplication.Instance.MainWindow; visual = visual ?? mainWindow; var groups = Gtk.Accel.GroupsFromObject(mainWindow); if (groups != null) { foreach (var group in groups) { visual.RemoveAccelerator(group, (uint)key.Key, key.AccelMods); } } }