[kupfer: 5/10] ui: Make result list max length a style property



commit 2e7714d4546c9aab001ae407470c5d35481be146
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Mar 31 18:49:21 2011 +0200

    ui: Make result list max length a style property

 kupfer/ui/browser.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 19940e5..9c414c7 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -637,6 +637,8 @@ class Search (gtk.Bin):
 		self.list_window.hide()
 
 	def _show_table(self):
+		table_maxlen = self.style_get_property('list-length')
+		opacity = 0.01*self.style_get_property('list-opacity')
 		# self.window is a GdkWindow (of self's parent)
 		win_width, win_height = self.window.get_size()
 		pos_x, pos_y = self.window.get_position()
@@ -646,7 +648,7 @@ class Search (gtk.Bin):
 		sub_x = pos_x
 		sub_y = pos_y + win_height
 		table_w, table_len = self.table.size_request()
-		subwin_height = min(table_len, 200) or 100
+		subwin_height = min(table_len, table_maxlen) or 100
 		subwin_width = self_width*2 - self_x
 		if not text_direction_is_ltr():
 			sub_x += win_width - subwin_width + self_x
@@ -658,7 +660,6 @@ class Search (gtk.Bin):
 		win = self.get_toplevel()
 		self.list_window.set_transient_for(win)
 		self.list_window.set_property("focus-on-map", False)
-		opacity = 0.01*self.style_get_property('list-opacity')
 		self.list_window.set_opacity(opacity)
 		self.list_window.show()
 		self._old_win_position = pos_x, pos_y
@@ -858,6 +859,12 @@ gtk.widget_class_install_style_property(Search,
 		 50, 100, 93,
 		 gobject.PARAM_READABLE))
 
+gtk.widget_class_install_style_property(Search,
+		('list-length', gobject.TYPE_INT, 'Result list length',
+		 'Maximum length of the result list',
+		 50, 1024, 200,
+		 gobject.PARAM_READABLE))
+
 class LeafSearch (Search):
 	"""
 	Customize for leaves search



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