[openbeos] Re: Tracker scripting and related headers
- From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Tue, 19 Dec 2006 14:45:21 +0100 (MET)
"Ryan Leavengood" <leavengood@xxxxxxxxx> wrote:
> It seems it would make sense to move PublicCommands.h to the public
> headers (headers/os/be_apps/Tracker) and Commands.h to the private
> headers (headers/private/tracker) so that both could be used by other
> apps, as it seems they are supposed to be used for such. Both are
> currently in src/kits/tracker (by the way why is Tracker under kits?)
Because libtracker.so is a public library that hosts the BFilePanel.
> The reason I'm asking for this is I would like to make use of
> kMoveToTrash (which is in Commands.h) to implement the TODO in
> ShowImage for deleting an image. Obviously I could just copy the
> constant into ShowImage, but that would not be as clean as I would
> like
> :)
As I wrote to the commit mail, this is not the way to go. These are
application internals that don't belong into the public, and shouldn't
be used.
Please use the interface dedicated to scripting to do such things.
But anyway, for the Trash in particular, I would think it even makes
sense to add a BEntry::MoveToTrash() method - this is not really
related to Tracker alone.
It's also not that hard to write such a method directly:
status_t
move_to_trash(BEntry& entry)
{
node_ref nodeRef;
status_t status = entry.GetNodeRef(&nodeRef);
if (status < B_OK)
return status;
char path[B_PATH_NAME_LENGTH];
status = find_directory(B_TRASH_DIRECTORY, nodeRef.device, true,
path, sizeof(path));
if (status < B_OK)
return status;
BDirectory trash(path);
status = trash.InitCheck();
if (status < B_OK)
return status;
return entry.MoveTo(&trash);
}
Bye,
Axel.
- Follow-Ups:
- [openbeos] Re: Tracker scripting and related headers
- From: Michael Pfeiffer
- References:
- [openbeos] Tracker scripting and related headers
- From: Ryan Leavengood
Other related posts:
- » [openbeos] Tracker scripting and related headers
- » [openbeos] Re: Tracker scripting and related headers
- » [openbeos] Re: Tracker scripting and related headers
- » [openbeos] Re: Tracker scripting and related headers
- » [openbeos] Re: Tracker scripting and related headers
- » [openbeos] Re: Tracker scripting and related headers
- [openbeos] Re: Tracker scripting and related headers
- From: Michael Pfeiffer
- [openbeos] Tracker scripting and related headers
- From: Ryan Leavengood