[haiku-bugs] [Haiku] #13112: BPackageKit's BContext needs to be more user friendly

  • From: "kallisti5" <trac@xxxxxxxxxxxx>
  • Date: Wed, 14 Dec 2016 21:24:20 -0000

#13112: BPackageKit's BContext needs to be more user friendly
------------------------------+------------------------------
 Reporter:  kallisti5         |        Owner:  bonefish
     Type:  bug               |       Status:  new
 Priority:  high              |    Milestone:  Unscheduled
Component:  Kits/Package Kit  |      Version:  R1/Development
 Keywords:                    |   Blocked By:
 Blocking:                    |  Has a Patch:  0
 Platform:  All               |
------------------------------+------------------------------
 BPackageKit has a huge number of set-up requirements that may not be
 relevant in a lot of use cases.

 http://cgit.haiku-os.org/haiku/tree/src/bin/pkgman/command_refresh.cpp#n45

 For example, to refresh the repositories, I need to create a BContext
 which is made up of a custom DecisionProvider class and a JobStateListener
 class.


 To have BDecisionProvider simply accept all changes, I have to write a
 silly class as follows:
 {{{
 class DummyDescision : public BDecisionProvider {
 public:
                              DummyDescision();
                             ~DummyDescision();
             bool             YesNoDescisionNeeded(const BString&
 description,
                                const BString& question, const BString&
 yes,
                                const BString& no, const BString&
 defChoice)
                                    { return true; }
 }
 }}}

 JobStateListener is even worse:
 http://cgit.haiku-os.org/haiku/tree/src/bin/pkgman/JobStateListener.cpp


 Ideally I should be able to construct a BDescisionProvider and a
 BJobStateListener with sane defaults (accept all changes, etc)


 Why are these API's so infinitely complex?

--
Ticket URL: <https://dev.haiku-os.org/ticket/13112>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: