From 054e27672d643e40e7c64e89e16e0cf2dbe6b8ec Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Fri, 04 Jul 2008 12:10:12 +0000 Subject: Fix autocompletion for addresses with the same root #7280 --- (limited to 'webtoolbar.py') diff --git a/webtoolbar.py b/webtoolbar.py index 3cfbba3..d7262e7 100755 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -130,9 +130,6 @@ class WebEntry(AddressEntry): width = self.allocation.width - entry_h height = gtk.gdk.screen_height() / 3 - i = self._search_view.get_model().get_iter_first() - self._search_view.get_selection().select_iter(i) - self._search_window.move(x, y) self._search_window.resize(width, height) self._search_window.show() @@ -169,20 +166,26 @@ class WebEntry(AddressEntry): selection = self._search_view.get_selection() model, selected = selection.get_selected() - if selected == None: - return False if keyname == 'Up': - index = model.get_path(selected)[0] - if index > 0: - selection.select_path(index - 1) + if selected is None: + selection.select_path(model[-1].path) + else: + index = model.get_path(selected)[0] + if index > 0: + selection.select_path(index - 1) return True elif keyname == 'Down': - next = model.iter_next(selected) - if next: - selection.select_iter(next) + if selected is None: + down_iter = model.get_iter_first() + else: + down_iter = model.iter_next(selected) + if down_iter: + selection.select_iter(down_iter) return True elif keyname == 'Return': + if selected is None: + return False uri = model[model.get_path(selected)][self._COL_ADDRESS] self.activate(uri) return True -- cgit v0.9.1