Merge lp:~evfool/software-center/lp855581 into lp:software-center/5.2

Proposed by Robert Roth
Status: Rejected
Rejected by: dobey
Proposed branch: lp:~evfool/software-center/lp855581
Merge into: lp:software-center/5.2
Diff against target: 22 lines (+8/-2)
1 file modified
softwarecenter/ui/gtk3/views/catview_gtk.py (+8/-2)
To merge this branch: bzr merge lp:~evfool/software-center/lp855581
Reviewer Review Type Date Requested Status
dobey Needs Information
Review via email: mp+106887@code.launchpad.net

Description of the change

On checking the count of items in subcategories (in category view to hide the empty ones) the supported_only flag has been disregarded, so if the canonical-maintained only was checked, it did count the items in all software, and it had some items, so the subcategory tile has been displayed, but when the user navigated to the subcategory, it was shown as empty, as there were no supported items in the subcategory.
Fixed by ANDing the supported and category query if the flag is checked, to fix LP #855581

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Looks good, thanks! A test would be sweel, not sure about the best approach for it yet.

Revision history for this message
Michael Vogt (mvo) wrote :

Eh, "would be sweet" of course

Revision history for this message
dobey (dobey) wrote :

Robert, are you able to write a test for this as Michael requested?

review: Needs Information

Unmerged revisions

3033. By Robert Roth

Do not display empty subcategories (LP: #855581)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/views/catview_gtk.py'
2--- softwarecenter/ui/gtk3/views/catview_gtk.py 2012-05-22 14:36:03 +0000
3+++ softwarecenter/ui/gtk3/views/catview_gtk.py 2012-05-22 19:55:21 +0000
4@@ -613,10 +613,16 @@
5 sorted_cats = categories_sorted_by_name(self.categories)
6 enquire = xapian.Enquire(self.db.xapiandb)
7 app_filter = AppFilter(self.db, self.cache)
8+ distro = get_distro()
9+ supported_only = get_global_filter().supported_only
10 for cat in sorted_cats:
11 # add the subcategory if and only if it is non-empty
12- enquire.set_query(cat.query)
13-
14+ if supported_only:
15+ enquire.set_query(xapian.Query(xapian.Query.OP_AND,
16+ cat.query,
17+ distro.get_supported_query()))
18+ else:
19+ enquire.set_query(cat.query)
20 if len(enquire.get_mset(0, 1)):
21 tile = CategoryTile(cat.name, cat.iconname)
22 tile.connect('clicked', self.on_category_clicked, cat)

Subscribers

People subscribed via source and target branches