[kupfer] settings: Unified accessors for global keybindings



commit 5235d3ea60cf94498d7d33b2dbb9a714e671e4a8
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Apr 7 22:13:13 2005 +0200

    settings: Unified accessors for global keybindings

 kupfer/core/settings.py |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/core/settings.py b/kupfer/core/settings.py
index 9375f89..625869a 100644
--- a/kupfer/core/settings.py
+++ b/kupfer/core/settings.py
@@ -229,6 +229,24 @@ class SettingsController (gobject.GObject, pretty.OutputMixin):
 		"""Convenience: Kupfer alternate keybinding as string"""
 		return self.get_config("Kupfer", "magickeybinding")
 
+	def set_magic_keybinding(self, keystr):
+		"""Convenience: Set alternate keybinding as string"""
+		return self._set_config("Kupfer", "magickeybinding", keystr)
+
+	def get_global_keybinding(self, key):
+		M = {
+			"keybinding": self.get_keybinding,
+			"magickeybinding": self.get_magic_keybinding,
+		}
+		return M[key]()
+
+	def set_global_keybinding(self, key, val):
+		M = {
+			"keybinding": self.set_keybinding,
+			"magickeybinding": self.set_magic_keybinding,
+		}
+		return M[key](val)
+
 	def get_show_status_icon(self):
 		"""Convenience: Show icon in notification area as bool"""
 		return strbool(self.get_config("Kupfer", "showstatusicon"))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]