[haiku-development] Re: Package Kit woes - Need help ASAP

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 21 Dec 2016 22:52:42 +0100

On 12/21/2016 12:42 AM, kallisti5 wrote:

BRefreshRepositoryRequest is where things start getting painful, that
context is a BContext
which needs all kinds of custom Decision providers and Job state
listeners defined.
(which seems insane to me as you generally don't have very many
decisions around refreshing
repositories)

At a quick glance it seems ATM there is indeed no decision making needed in this case. When we start to use cryptographically verify the repository origin and integrity, however, encountering a new repository certificate will definitely be something that requires a user interaction. I don't know how you want to handle it other than with a callback.

TBH, I'm not too fond of the BDecisionProvider interface. But that's mainly because the callback interface is completely text based. Currently it isn't really practical to handle certain decisions programmatically, because you'd have to parse the (theoretically internationalized) question text to determine what it is about.

That aside, neither BDecisionProvider nor BJobStateListener are abstract. If you don't need job progress updates and always want to go with the default decisions, you don't need to subclass anything and can refresh the cache for a given repository in 5 lines (4, if you omit the BRefreshRepositoryRequest variable). Another line could be saved by introducing a BContext constructor that doesn't require a BJobStateListener (I'd rather keep and explicit BDecisionProvider parameter, though).

CU, Ingo


Other related posts: