Merge lp:~mvo/software-center/whatsnew-leak-lp985389 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2999
Proposed branch: lp:~mvo/software-center/whatsnew-leak-lp985389
Merge into: lp:software-center
Diff against target: 66 lines (+12/-18)
3 files modified
softwarecenter/db/appfilter.py (+7/-0)
softwarecenter/ui/gtk3/panes/availablepane.py (+3/-0)
softwarecenter/ui/gtk3/panes/softwarepane.py (+2/-18)
To merge this branch: bzr merge lp:~mvo/software-center/whatsnew-leak-lp985389
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+103424@code.launchpad.net

Description of the change

This branch fixes bug #985389 where the filter restriction "installed-only" leaks into subsequent searches.

It also fixes the case where you are in "whats-new" (or any category with a filter restriction) and the searchaid logic suggests you to search "all-categories". This will also reset the non-global filters.

While working on it I removed some deadcode in softwarepane.py that is now part of searchaid.py but never got
cleaned up.

I would appreciate extra critical review/testing of this one as its potentially doing too much. I think we should be fine because global filters (like supported-only) are honored. And the installed-pane has no searchaid logic or categories so there should be no impact here. But I may overlook something of course :)

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

This looks good! Both test cases work perfectly, and I did a bunch more testing and found no ill effects, so I think this is good for merging. Note that I did find one small typo in the new reset() method of softwarecenter/db/appfilter.py, which I have fixed.

This is a nice improvement, thank you, Michael!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/db/appfilter.py'
--- softwarecenter/db/appfilter.py 2012-03-16 18:51:40 +0000
+++ softwarecenter/db/appfilter.py 2012-04-25 08:50:27 +0000
@@ -115,3 +115,10 @@
115 new_filter.not_installed_only = self.not_installed_only115 new_filter.not_installed_only = self.not_installed_only
116 new_filter.restricted_list = self.restricted_list116 new_filter.restricted_list = self.restricted_list
117 return new_filter117 return new_filter
118
119 def reset(self):
120 """ reset the values that are not global """
121 self.avilable_only = False
122 self.installed_only = False
123 self.not_installed_only = False
124 self.restricted_list = False
118125
=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-04-19 07:28:14 +0000
+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-04-25 08:50:27 +0000
@@ -373,6 +373,9 @@
373 """373 """
374 self.state.category = None374 self.state.category = None
375 self.state.subcategory = None375 self.state.subcategory = None
376 # reset the non-global filters see (LP: #985389)
377 if self.state.filter:
378 self.state.filter.reset()
376379
377 def on_transaction_started(self, backend, pkgname, appname, trans_id,380 def on_transaction_started(self, backend, pkgname, appname, trans_id,
378 trans_type):381 trans_type):
379382
=== modified file 'softwarecenter/ui/gtk3/panes/softwarepane.py'
--- softwarecenter/ui/gtk3/panes/softwarepane.py 2012-04-12 12:10:50 +0000
+++ softwarecenter/ui/gtk3/panes/softwarepane.py 2012-04-25 08:50:27 +0000
@@ -123,7 +123,8 @@
123 self.search_term = ""123 self.search_term = ""
124 self.application = None124 self.application = None
125 self.limit = 0125 self.limit = 0
126 #~ self.filter = None126 if self.filter:
127 self.filter.reset()
127 self.vadjustment = 0.0128 self.vadjustment = 0.0
128129
129130
@@ -368,23 +369,6 @@
368 self.action_bar.set_label(369 self.action_bar.set_label(
369 label, link_result=self._show_nonapp_pkgs)370 label, link_result=self._show_nonapp_pkgs)
370371
371 def _on_label_app_list_header_activate_link(self, link, uri):
372 #print "actiavte: ", link, uri
373 if uri.startswith("search:"):
374 self.searchentry.set_text(uri[len("search:"):])
375 elif uri.startswith("search-all:"):
376 self.unset_current_category()
377 self.refresh_apps()
378 elif uri.startswith("search-parent:"):
379 self.apps_subcategory = None
380 self.refresh_apps()
381 elif uri.startswith("search-unsupported:"):
382 self.apps_filter.set_supported_only(False)
383 self.refresh_apps()
384 # FIXME: add ability to remove categories restriction here
385 # True stops event propergation
386 return True
387
388 def _show_nonapp_pkgs(self):372 def _show_nonapp_pkgs(self):
389 self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE373 self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
390 self.refresh_apps()374 self.refresh_apps()

Subscribers

People subscribed via source and target branches