[kupfer] Add an accelerator for Show Preferences, default to Ctrl+;



commit fdcdd78f4921a2e74a9a12cbd59fa5bfeeecd8cd
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Mar 31 02:53:30 2010 +0200

    Add an accelerator for Show Preferences, default to Ctrl+;

 data/defaults.cfg        |    1 +
 kupfer/ui/browser.py     |   17 ++++++++++++-----
 kupfer/ui/preferences.py |    1 +
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/data/defaults.cfg b/data/defaults.cfg
index 7406c4d..eb5b5f5 100644
--- a/data/defaults.cfg
+++ b/data/defaults.cfg
@@ -22,6 +22,7 @@ select_quit = <Control>q
 select_selected_file = <Control>g
 select_selected_text = <Control>t
 show_help = F1
+show_preferences = <Control>semicolon
 switch_to_source = <Control>s
 toggle_text_mode_quick = <Control>period
 
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 79911cf..571f838 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -12,6 +12,9 @@ import gtk
 import gio
 import gobject
 
+from kupfer import kupferui
+from kupfer import version
+
 from kupfer import scheduler
 from kupfer.ui  import listen
 from kupfer.ui import keybindings
@@ -1211,8 +1214,12 @@ class Interface (gobject.GObject):
 		self.data_controller.find_object("qpfer:quit")
 
 	def show_help(self):
-		from kupfer import kupferui
 		kupferui.show_help()
+		self.emit("launched-action")
+
+	def show_preferences(self):
+		kupferui.show_preferences()
+		self.emit("launched-action")
 
 	def compose_action(self):
 		self.data_controller.compose_selection()
@@ -1388,6 +1395,9 @@ class Interface (gobject.GObject):
 gobject.type_register(Interface)
 gobject.signal_new("cancelled", Interface, gobject.SIGNAL_RUN_LAST,
 		gobject.TYPE_BOOLEAN, ())
+# Send only when the interface itself launched an action directly
+gobject.signal_new("launched-action", Interface, gobject.SIGNAL_RUN_LAST,
+		gobject.TYPE_BOOLEAN, ())
 
 class WindowController (pretty.OutputMixin):
 	"""
@@ -1403,6 +1413,7 @@ class WindowController (pretty.OutputMixin):
 		data_controller.connect("command-result", self.result_callback)
 
 		self.interface = Interface(data_controller, self.window)
+		self.interface.connect("launched-action", self.launch_callback)
 		self.interface.connect("cancelled", self._cancelled)
 		self._setup_window()
 		self._statusicon = None
@@ -1421,9 +1432,6 @@ class WindowController (pretty.OutputMixin):
 			else: self.hide_statusicon()
 
 	def _setup_status_icon(self):
-		from kupfer import kupferui
-		from kupfer import version
-
 		status = gtk.status_icon_new_from_icon_name(version.ICON_NAME)
 		status.set_tooltip(version.PROGRAM_NAME)
 		menu = gtk.Menu()
@@ -1452,7 +1460,6 @@ class WindowController (pretty.OutputMixin):
 		"""
 		Returns window
 		"""
-		from kupfer import version
 
 		self.window.connect("delete-event", self._close_window)
 		widget = self.interface.get_widget()
diff --git a/kupfer/ui/preferences.py b/kupfer/ui/preferences.py
index 6ebd1d2..4549798 100644
--- a/kupfer/ui/preferences.py
+++ b/kupfer/ui/preferences.py
@@ -48,6 +48,7 @@ class PreferencesWindowController (pretty.OutputMixin):
 		'select_selected_file': _('Select Selected File'),
 		'select_selected_text': _('Select Selected Text'),
 		'show_help': _('Show Help'),
+		'show_preferences': _('Show Preferences'),
 		'switch_to_source': _('Switch to First Pane'),
 		"toggle_text_mode_quick": _('Toggle Text Mode'),
 	}



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