Don't break menu if apt fails to initialize
This commit is contained in:
parent
022aed6b83
commit
18e9c6616a
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
|||||||
|
mintmenu (5.0.4) julia; urgency=low
|
||||||
|
|
||||||
|
* Don't break menu if apt fails to initialize
|
||||||
|
|
||||||
|
-- Clement Lefebvre <root@linuxmint.com> Fri, 10 Sep 2010 13:34:00 +0000
|
||||||
|
|
||||||
mintmenu (5.0.3) julia; urgency=low
|
mintmenu (5.0.3) julia; urgency=low
|
||||||
|
|
||||||
* Fixed separators colors in search results
|
* Fixed separators colors in search results
|
||||||
|
@ -221,7 +221,12 @@ class pluginclass( object ):
|
|||||||
@print_timing
|
@print_timing
|
||||||
def __init__( self, mintMenuWin, toggleButton ):
|
def __init__( self, mintMenuWin, toggleButton ):
|
||||||
|
|
||||||
self.apt_cache = apt.Cache()
|
self.apt_cache = None
|
||||||
|
try:
|
||||||
|
self.apt_cache = apt.Cache()
|
||||||
|
except Exception, detail:
|
||||||
|
print "Could not initialize APT cache"
|
||||||
|
pass
|
||||||
|
|
||||||
self.mintMenuWin = mintMenuWin
|
self.mintMenuWin = mintMenuWin
|
||||||
|
|
||||||
@ -456,7 +461,15 @@ class pluginclass( object ):
|
|||||||
self.favoritesBox.remove( fav )
|
self.favoritesBox.remove( fav )
|
||||||
self.favoritesPositionOnGrid( fav )
|
self.favoritesPositionOnGrid( fav )
|
||||||
|
|
||||||
def RegenPlugin( self, *args, **kargs ):
|
def RegenPlugin( self, *args, **kargs ):
|
||||||
|
try:
|
||||||
|
apt_cache = apt.Cache()
|
||||||
|
if apt_cache != None:
|
||||||
|
self.apt_cache = apt_cache
|
||||||
|
except Exception, detail:
|
||||||
|
print "Could not refresh APT cache"
|
||||||
|
pass
|
||||||
|
|
||||||
# save old config - this is necessary because the app will notified when it sets the default values and you don't want the to reload itself several times
|
# save old config - this is necessary because the app will notified when it sets the default values and you don't want the to reload itself several times
|
||||||
oldcategories_mouse_over = self.categories_mouse_over
|
oldcategories_mouse_over = self.categories_mouse_over
|
||||||
oldtotalrecent = self.totalrecent
|
oldtotalrecent = self.totalrecent
|
||||||
@ -689,19 +702,20 @@ class pluginclass( object ):
|
|||||||
else:
|
else:
|
||||||
self.current_results = []
|
self.current_results = []
|
||||||
self.add_search_suggestions(text)
|
self.add_search_suggestions(text)
|
||||||
found_packages = 0
|
found_packages = 0
|
||||||
for pkg in self.apt_cache:
|
if self.apt_cache is not None:
|
||||||
if text in pkg.name:
|
for pkg in self.apt_cache:
|
||||||
found_packages+=1
|
if text in pkg.name:
|
||||||
name = pkg.name.replace(text, "<b>%s</b>" % text);
|
found_packages+=1
|
||||||
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
|
name = pkg.name.replace(text, "<b>%s</b>" % text);
|
||||||
suggestionButton.connect("clicked", self.apturl_install, pkg.name)
|
suggestionButton = SuggestionButton(gtk.STOCK_ADD, self.iconSize, "")
|
||||||
suggestionButton.set_text(_("Install package '%s'") % name)
|
suggestionButton.connect("clicked", self.apturl_install, pkg.name)
|
||||||
suggestionButton.set_tooltip_text("%s\n\n%s\n\n%s" % (pkg.name, pkg.summary.capitalize(), pkg.description))
|
suggestionButton.set_text(_("Install package '%s'") % name)
|
||||||
suggestionButton.set_icon_size(self.iconSize)
|
suggestionButton.set_tooltip_text("%s\n\n%s\n\n%s" % (pkg.name, pkg.summary.capitalize(), pkg.description))
|
||||||
self.applicationsBox.add(suggestionButton)
|
suggestionButton.set_icon_size(self.iconSize)
|
||||||
self.suggestions.append(suggestionButton)
|
self.applicationsBox.add(suggestionButton)
|
||||||
self.current_results.append(pkg)
|
self.suggestions.append(suggestionButton)
|
||||||
|
self.current_results.append(pkg)
|
||||||
if found_packages == 0:
|
if found_packages == 0:
|
||||||
self.applicationsBox.remove(self.last_separator)
|
self.applicationsBox.remove(self.last_separator)
|
||||||
self.suggestions.remove(self.last_separator)
|
self.suggestions.remove(self.last_separator)
|
||||||
|
Loading…
Reference in New Issue
Block a user