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
1=== modified file 'softwarecenter/db/appfilter.py'
2--- softwarecenter/db/appfilter.py 2012-03-16 18:51:40 +0000
3+++ softwarecenter/db/appfilter.py 2012-04-25 08:50:27 +0000
4@@ -115,3 +115,10 @@
5 new_filter.not_installed_only = self.not_installed_only
6 new_filter.restricted_list = self.restricted_list
7 return new_filter
8+
9+ def reset(self):
10+ """ reset the values that are not global """
11+ self.avilable_only = False
12+ self.installed_only = False
13+ self.not_installed_only = False
14+ self.restricted_list = False
15
16=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
17--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-04-19 07:28:14 +0000
18+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-04-25 08:50:27 +0000
19@@ -373,6 +373,9 @@
20 """
21 self.state.category = None
22 self.state.subcategory = None
23+ # reset the non-global filters see (LP: #985389)
24+ if self.state.filter:
25+ self.state.filter.reset()
26
27 def on_transaction_started(self, backend, pkgname, appname, trans_id,
28 trans_type):
29
30=== modified file 'softwarecenter/ui/gtk3/panes/softwarepane.py'
31--- softwarecenter/ui/gtk3/panes/softwarepane.py 2012-04-12 12:10:50 +0000
32+++ softwarecenter/ui/gtk3/panes/softwarepane.py 2012-04-25 08:50:27 +0000
33@@ -123,7 +123,8 @@
34 self.search_term = ""
35 self.application = None
36 self.limit = 0
37- #~ self.filter = None
38+ if self.filter:
39+ self.filter.reset()
40 self.vadjustment = 0.0
41
42
43@@ -368,23 +369,6 @@
44 self.action_bar.set_label(
45 label, link_result=self._show_nonapp_pkgs)
46
47- def _on_label_app_list_header_activate_link(self, link, uri):
48- #print "actiavte: ", link, uri
49- if uri.startswith("search:"):
50- self.searchentry.set_text(uri[len("search:"):])
51- elif uri.startswith("search-all:"):
52- self.unset_current_category()
53- self.refresh_apps()
54- elif uri.startswith("search-parent:"):
55- self.apps_subcategory = None
56- self.refresh_apps()
57- elif uri.startswith("search-unsupported:"):
58- self.apps_filter.set_supported_only(False)
59- self.refresh_apps()
60- # FIXME: add ability to remove categories restriction here
61- # True stops event propergation
62- return True
63-
64 def _show_nonapp_pkgs(self):
65 self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
66 self.refresh_apps()

Subscribers

People subscribed via source and target branches