Fix search suggestions hangup, apt search. Need to fix multiline though

This commit is contained in:
Michael Webster 2013-03-08 08:02:48 -05:00
parent a47e17dfbf
commit 5e69fefe8e

View File

@ -32,7 +32,7 @@ import matemenu
from user import home
Gdk.threads_init()
GObject.threads_init()
# i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale")
@ -187,7 +187,7 @@ class SuggestionButton ( Gtk.Button ):
self.image.show()
HBox1.pack_start( self.image, False, False, 5 )
self.label = Gtk.Label()
self.label.set_ellipsize( Pango.EllipsizeMode.END )
#self.label.set_ellipsize( Pango.EllipsizeMode.END )
self.label.set_alignment( 0.0, 1.0 )
self.label.show()
labelBox.pack_start( self.label, False, False, 0 )
@ -648,13 +648,8 @@ class pluginclass( object ):
def add_apt_filter_results(self, keyword):
try:
# Wait to see if the keyword has changed.. before doing anything
time.sleep(0.3)
current_keyword = keyword
Gdk.threads_enter()
try:
current_keyword = self.searchEntry.get_text()
finally:
Gdk.threads_leave()
if keyword != current_keyword:
return
found_packages = []
@ -697,8 +692,6 @@ class pluginclass( object ):
break
found_packages.extend(found_in_name)
found_packages.extend(found_elsewhere)
Gdk.threads_enter()
try:
if keyword == self.searchEntry.get_text() and len(found_packages) > 0:
last_separator = Gtk.EventBox()
last_separator.add(Gtk.HSeparator())
@ -713,7 +706,7 @@ class pluginclass( object ):
for word in keywords:
if word != "":
name = name.replace(word, "<b>%s</b>" % word);
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
suggestionButton.connect("clicked", self.apturl_install, pkg.name)
suggestionButton.set_text(_("Install package '%s'") % name)
suggestionButton.set_tooltip_text("%s\n\n%s\n\n%s" % (pkg.name, pkg.summary, pkg.description))
@ -722,8 +715,6 @@ class pluginclass( object ):
self.suggestions.append(suggestionButton)
#if cache != self.current_results:
# self.current_results.append(pkg)
finally:
Gdk.threads_leave()
#if len(found_packages) == 0:
# gtk.gdk.threads_enter()
@ -810,13 +801,12 @@ class pluginclass( object ):
#if (len(self.current_results) > 0):
#self.add_apt_filter_results_sync(self.current_results, text)
#else:
thr = threading.Thread(name="mint-menu-apt-filter", group=None, target=self.add_apt_filter_results, args=([text]), kwargs={})
thr.start()
GObject.timeout_add (300, self.add_apt_filter_results, text)
else:
self.current_results = []
self.add_search_suggestions(text)
thr = threading.Thread(name="mint-menu-apt-filter", group=None, target=self.add_apt_filter_results, args=([text]), kwargs={})
thr.start()
GObject.timeout_add (300, self.add_apt_filter_results, text)
self.current_suggestion = text
else:
self.current_suggestion = None