On 06/03/2018 02:18, Ken Brown wrote:
On 3/5/2018 1:34 PM, Ken Brown wrote:
This is a followup to the thread started here:


There are two problems with installing from a local directory.

1. In the Category view, "No packages found" is displayed where it should say "All" in the first line of the list.  This is probably just a cosmetic issue, and I haven't tried to track it down yet.

This actually happens in all setup runs, not just local installs.  It looks like it was caused by the rearranging that was done in the following commit:

commit 0c539f7f7d86fb100f260f21367682fa2c0bb529
Author: Jon Turney <jon.turney-grjqepx9rppajuda+fb...@public.gmane.org>
Date:   Sat Nov 4 18:01:49 2017 +0000

     Correctly order preparing packagedb for chooser

I think the problem might be that createListview() is now called too early in ChooserPage::OnInit().  But it's not immediately obvious to me how to fix this without breaking something else.
I'm kind of inclined to fix this with the attached: I think we only ever got "No packages found" before if there were 0 packages, which presumably doesn't happen very often :)

We don't update this header if a search reduces the number of packages shown to 0, which might make some sort of sense.

(Also, weirdly, we don't remove empty categories from view, except if we are doing a search, but this seems to be deliberate? (PickView.cc:311))
From 1a0cf0a86088b4aae7d5a18953f7c214b07d8a03 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.tur...@dronecode.org.uk>
Date: Tue, 6 Mar 2018 16:17:30 +0000
Subject: [PATCH setup] Always give the fake root category the name 'All'

After we rearranged things in 0c539f7f, it's now too early to tell if we
have any packages or not.

The only thing about this category that is ever used is it's name, so we
don't acually need to use the real 'All' category here.

Saying 'No packages found' was never particularly helpful here, so just use
a fake category with the fixed name 'All'.
 choose.cc | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/choose.cc b/choose.cc
index 9cf3a50..5a4d3ad 100644
--- a/choose.cc
+++ b/choose.cc
@@ -137,11 +137,8 @@ ChooserPage::createListview ()
   SetBusy ();
   static std::vector<packagemeta *> empty_cat;
-  static Category dummy_cat (std::string ("No packages found."), empty_cat);
-  packagedb db;
-  packagedb::categoriesType::iterator it = db.categories.find("All");
-  Category &cat = (it == db.categories.end ()) ? dummy_cat : *it;
-  chooser = new PickView (cat);
+  static Category dummy_cat (std::string ("All"), empty_cat);
+  chooser = new PickView (dummy_cat);
   RECT r = getDefaultListViewSize();
   if (!chooser->Create(this, WS_CHILD | WS_HSCROLL | WS_VSCROLL | 
     throw new Exception (TOSTRING(__LINE__) " " __FILE__,

Reply via email to