[kupfer] preferences: Foucs plugin list search box when its tab is opened



commit 3a4f2ab4081aadd27f46a1a474d6bf7c1bd8c894
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Apr 7 05:48:02 2011 +0200

    preferences: Foucs plugin list search box when its tab is opened

 data/preferences.ui      |    3 +++
 kupfer/ui/preferences.py |    9 +++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index a363ca7..86b306c 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -22,6 +22,7 @@
               <object class="GtkNotebook" id="preferences_notebook">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <signal name="switch_page" handler="on_preferences_notebook_switch_page"/>
                 <child>
                   <object class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
@@ -396,6 +397,8 @@
                           <object class="GtkEntry" id="entry_plugins_filter">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="has_focus">True</property>
+                            <property name="is_focus">True</property>
                             <property name="invisible_char">&#x25CF;</property>
                             <property name="secondary_icon_stock">gtk-clear</property>
                             <signal name="changed" handler="on_entry_plugins_filter_changed"/>
diff --git a/kupfer/ui/preferences.py b/kupfer/ui/preferences.py
index 80da584..05974a9 100644
--- a/kupfer/ui/preferences.py
+++ b/kupfer/ui/preferences.py
@@ -797,11 +797,20 @@ class PreferencesWindowController (pretty.OutputMixin):
 			self._update_alternative_combobox(category_key,
 					self.icons_combobox)
 
+	def on_preferences_notebook_switch_page(self, notebook, page, page_num):
+		## focus the search box on the plugin tab
+		if page_num == PLUGIN_LIST_PAGE:
+			gobject.idle_add(self.entry_plugins_filter.grab_focus)
+
 	def show(self, timestamp):
 		self.window.present_with_time(timestamp)
+
 	def show_on_screen(self, timestamp, screen):
 		self.window.set_screen(screen)
 		self.show(timestamp)
+		## focus the search box on the plugin tab
+		if self.preferences_notebook.get_current_page() == PLUGIN_LIST_PAGE:
+			self.entry_plugins_filter.grab_focus()
 
 	def show_focus_plugin(self, plugin_id, timestamp):
 		"""



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