Fix: 'None' value for keybindings breaks editor

The bug: Gtk.accelerator_parse throws an error if the arg is None.
This means that if one keybinding is set to None, it is impossible to
set any new keybinding.
This commit is contained in:
Vulcalien 2021-12-07 16:09:56 +01:00
parent 4ab3343e61
commit b2d15898a2
2 changed files with 5 additions and 2 deletions

View File

@ -1738,10 +1738,13 @@ class PrefsEditor:
accel = Gtk.accelerator_name(key, mods) accel = Gtk.accelerator_name(key, mods)
current_binding = liststore.get_value(liststore.get_iter(path), 0) current_binding = liststore.get_value(liststore.get_iter(path), 0)
parsed_accel = Gtk.accelerator_parse(accel)
duplicate_bindings = [] duplicate_bindings = []
for conf_binding, conf_accel in self.config["keybindings"].items(): for conf_binding, conf_accel in self.config["keybindings"].items():
parsed_accel = Gtk.accelerator_parse(accel) if conf_accel is None:
continue
parsed_conf_accel = Gtk.accelerator_parse(conf_accel) parsed_conf_accel = Gtk.accelerator_parse(conf_accel)
if ( if (

View File

@ -130,7 +130,7 @@ class Window(Container, Gtk.Window):
# Attempt to grab a global hotkey for hiding the window. # Attempt to grab a global hotkey for hiding the window.
# If we fail, we'll never hide the window, iconifying instead. # If we fail, we'll never hide the window, iconifying instead.
if self.config['keybindings']['hide_window'] != '': if self.config['keybindings']['hide_window'] not in ('', None):
if display_manager() == 'X11': if display_manager() == 'X11':
try: try:
self.hidebound = Keybinder.bind( self.hidebound = Keybinder.bind(