[haiku-development] Re: Dual license in a file.

  • From: "Jonas Sundström" <jonas@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 30 Aug 2009 21:47:34 +0200 CEST

Fredrik Modèen <fredrik@xxxxxxxxx> wrote:
> 
> The file DiskUsage.cpp (same exists in GrepApp.cpp) has a realy good
> solution (process_refs) on how to solve the ticket # 4336 and I would 
> like
> to use this in Backgrounds.cpp (backgrounds), how would like license 
> look
> like?
> 
> (http://dev.haiku-os.org/ticket/4336)
> (http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/src/apps/diskusage/DiskUsage.cpp)
> > (http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/src/preferences/backgrounds/Backgrounds.cpp)
> 
Yes I agree. Having Backgrounds run stand-alone avoids 
compromising the stability of Tracker and makes it show
up in Deskbar. Those are good things.

Some general thoughts on the use of dirRef provided to 
Tracker addons in process_refs():

DiskUsage does

        if (!message->HasRef("refs"))
                message->AddRef("refs", &dirRef);

using dirRef as a single "refs" if there are no other "refs".
I.e. a Tracker add-on launched without any selected files.
(You get the dirRef of the folder and an empty BMessage.)

I prefer how that code was originally in
http://haiku.it.su.se:8180/source/xref/src/apps/text_search/TextSearch.cpp#60

Just
        message->AddRef("dir_ref", &dirRef);

Thus keeping "refs" and "dir_ref" separate for now, and
deciding later on what to do about the data.

The refs/dirRef thing DiskUsage does in process_refs() I would
do at the receiving end - e.g. in BApplication::RefsReceived()
or wherever the message gets unpacked and used. (a window or view)

That way you can send just the BMessage all the way and not 
the BMessage -and- the dirRef, from app -> window -> view, 
like it's done now in Backgrounds.

Granted, dealing with dirRefs early in process_refs()
accomplishes the same. I just like placing all the logic in
the core of the application and do the least possible amount
of work in process_refs(), merely passing on the data.

I think this works well and makes it easy to handle both 
B_REFS_RECEIVED and B_SIMPLE_DATA in the same leaf method.

/Jonas.


Other related posts: