[kupfer: 35/67] ui: Remove option "Close on unfocus" (always enabled)



commit fdba1b14153d6732ff1c42abf02b99b11cdf63a0
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Mar 16 22:49:02 2011 +0100

    ui: Remove option "Close on unfocus" (always enabled)

 data/defaults.cfg        |    1 -
 data/preferences.ui      |   13 -------------
 kupfer/core/settings.py  |    7 -------
 kupfer/ui/browser.py     |   28 ++++++++++++----------------
 kupfer/ui/preferences.py |    6 ------
 5 files changed, 12 insertions(+), 43 deletions(-)
---
diff --git a/data/defaults.cfg b/data/defaults.cfg
index e818ab2..445d12b 100644
--- a/data/defaults.cfg
+++ b/data/defaults.cfg
@@ -12,7 +12,6 @@ Keybinding = <Ctrl>space
 MagicKeybinding =
 ShowStatusIcon = True
 UseCommandKeys = True
-CloseOnUnfocus = True
 
 [Keybindings]
 activate = <Alt>a
diff --git a/data/preferences.ui b/data/preferences.ui
index f5e0f01..f7b7be0 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -95,19 +95,6 @@
                                         <property name="position">0</property>
                                       </packing>
                                     </child>
-                                    <child>
-                                      <object class="GtkCheckButton" id="checkcloseonunfocus">
-                                        <property name="label" translatable="yes">Hide Kupfer when focus is lost</property>
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">False</property>
-                                        <property name="draw_indicator">True</property>
-                                        <signal name="toggled" handler="on_checkcloseonunfocus_toggled"/>
-                                      </object>
-                                      <packing>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
                                   </object>
                                 </child>
                               </object>
diff --git a/kupfer/core/settings.py b/kupfer/core/settings.py
index 0ff0bf5..2ba6692 100644
--- a/kupfer/core/settings.py
+++ b/kupfer/core/settings.py
@@ -36,7 +36,6 @@ class SettingsController (gobject.GObject, pretty.OutputMixin):
 			"magickeybinding": "",
 			"showstatusicon" : True,
 			"usecommandkeys" : True,
-			"closeonunfocus" : True,
 		},
 		"Directories" : { "direct" : default_directories, "catalog" : (), },
 		"DeepDirectories" : { "direct" : (), "catalog" : (), "depth" : 1, },
@@ -247,12 +246,6 @@ class SettingsController (gobject.GObject, pretty.OutputMixin):
 		return self.set_plugin_config(plugin_id, key,
 		                              value, value_type=strbool)
 
-	def get_close_on_unfocus(self):
-		return self.get_config("Kupfer", "closeonunfocus")
-
-	def set_close_on_unfocus(self, val):
-		return self._set_config("Kupfer", "closeonunfocus", val)
-
 	def get_keybinding(self):
 		"""Convenience: Kupfer keybinding as string"""
 		return self.get_config("Kupfer", "keybinding")
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 4e4fae4..950c1c5 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -1741,22 +1741,18 @@ class WindowController (pretty.OutputMixin):
 			widget.window.invalidate_region(r, False)
 
 	def _lost_focus(self, window, event):
-		setctl = settings.GetSettingsController()
-		if setctl.get_close_on_unfocus():
-			# Since focus-out-event is triggered even
-			# when we click inside the window, we'll
-			# do some additional math to make sure that
-			# that window won't close if teh mouse pointer
-			# is over it. Looks like a dirty hack, but a
-			# similar solution is used in gnome-do, so probably
-			# there's no better way of handling this.
-			# Any impovements are welcome.
-			x, y, mods = window.get_screen().get_root_window().get_pointer()
-			w_x, w_y = window.get_position()
-			w_w, w_h = window.get_size()
-			if (x not in xrange(w_x, w_x + w_w) or
-			    y not in xrange(w_y, w_y + w_h)):
-				self._window_hide_timer.set_ms(50, self.put_away)
+		# Close at unfocus.
+		# Since focus-out-event is triggered even
+		# when we click inside the window, we'll
+		# do some additional math to make sure that
+		# that window won't close if the mouse pointer
+		# is over it.
+		x, y, mods = window.get_screen().get_root_window().get_pointer()
+		w_x, w_y = window.get_position()
+		w_w, w_h = window.get_size()
+		if (x not in xrange(w_x, w_x + w_w) or
+			y not in xrange(w_y, w_y + w_h)):
+			self._window_hide_timer.set_ms(50, self.put_away)
 
 	def _center_window(self, *ignored):
 		"""Center Window on the monitor the pointer is currently on"""
diff --git a/kupfer/ui/preferences.py b/kupfer/ui/preferences.py
index 246f41c..f08865c 100644
--- a/kupfer/ui/preferences.py
+++ b/kupfer/ui/preferences.py
@@ -105,7 +105,6 @@ class PreferencesWindowController (pretty.OutputMixin):
 		self.buttonremovedirectory = builder.get_object("buttonremovedirectory")
 		checkautostart = builder.get_object("checkautostart")
 		checkstatusicon = builder.get_object("checkstatusicon")
-		checkcloseonunfocus = builder.get_object("checkcloseonunfocus")
 		checkusecommandkeys = builder.get_object("checkusecommandkeys")
 		self.entry_plugins_filter = builder.get_object('entry_plugins_filter')
 		self.keybindings_list_parent = builder.get_object('keybindings_list_parent')
@@ -117,7 +116,6 @@ class PreferencesWindowController (pretty.OutputMixin):
 		checkautostart.set_active(self._get_should_autostart())
 		checkstatusicon.set_active(setctl.get_show_status_icon())
 		checkusecommandkeys.set_active(setctl.get_use_command_keys())
-		checkcloseonunfocus.set_active(setctl.get_close_on_unfocus())
 
 		# Plugin List
 		columns = [
@@ -736,10 +734,6 @@ class PreferencesWindowController (pretty.OutputMixin):
 		setctl = settings.GetSettingsController()
 		setctl.set_use_command_keys(widget.get_active())
 
-	def on_checkcloseonunfocus_toggled(self, widget):
-		setctl = settings.GetSettingsController()
-		setctl.set_close_on_unfocus(widget.get_active())
-
 	def dir_table_cursor_changed(self, table):
 		curpath, curcol = table.get_cursor()
 		if not curpath or not self.dir_store:



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