[haiku-development] Re: Help regarding Dynamic Menu in Tracker

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 26 Apr 2018 14:40:13 +0000

On Thu, Apr 26, 2018 at 10:27 AM Stephan Aßmus <superstippi@xxxxxx> wrote:

I would like to propose the following solution: The idea is not to mess
with Tracker from inside add-on code by installing BHandlers or other
BLoopers which may be difficult to clean up. The dynamic menu building
may happen frequently and it could be messy for the add-on to figure out
what needs to be done. Also is the code of the add-on even kept loaded?
(I see that it used to be unloaded but that line is commented out in the
prototype...) Anyway, I would define a custom BMessage.what constant in
TrackerAddOn.h that all add-ons would use if they want to react to menu
items that they themselves installed. The add-on would also add a
message field with an add-on ID, by which Tracker then knows which
add-on should receive the message. Then I would add code in Tracker
which handles these special add-on messages, loads the add-on specified
by the id in the message and calls another new add-on hook method and
passes the message. In pseudo code:

+1, that would indeed be much cleaner.

Regards,

Rene

Other related posts: