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 = None | ||||||
|  |         try: | ||||||
|             self.apt_cache = apt.Cache() |             self.apt_cache = apt.Cache() | ||||||
|  |         except Exception, detail: | ||||||
|  |             print "Could not initialize APT cache" | ||||||
|  |             pass             | ||||||
| 
 | 
 | ||||||
|         self.mintMenuWin = mintMenuWin |         self.mintMenuWin = mintMenuWin | ||||||
| 
 | 
 | ||||||
| @ -457,6 +462,14 @@ class pluginclass( object ): | |||||||
|             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 | ||||||
| @ -690,6 +703,7 @@ class pluginclass( object ): | |||||||
|                             self.current_results = []                             |                             self.current_results = []                             | ||||||
|                             self.add_search_suggestions(text)  |                             self.add_search_suggestions(text)  | ||||||
|                             found_packages = 0   |                             found_packages = 0   | ||||||
|  |                             if self.apt_cache is not None:                                  | ||||||
|                                 for pkg in self.apt_cache: |                                 for pkg in self.apt_cache: | ||||||
|                                     if text in pkg.name: |                                     if text in pkg.name: | ||||||
|                                         found_packages+=1 |                                         found_packages+=1 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user