Allow removing any Deskbar replicants, by name.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21585 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström 2007-07-07 16:29:44 +00:00
parent 412a49defe
commit 2c02680d03

View File

@ -388,10 +388,19 @@ main(int, char **argv)
return 0; return 0;
} }
if (strcmp(argv[i], "--remove") == 0) { if (strncmp(argv[i], "--remove", 8) == 0) {
BString replicant = "DeskButton";
if (strncmp(argv[i] + 8, "=", 1) == 0) {
if (strlen(argv[i] + 9) > 0) {
replicant = argv[i] + 9;
} else {
printf("desklink: Missing replicant name.\n");
return 1;
}
}
int32 found = 0; int32 found = 0;
int32 found_id; int32 found_id;
while (deskbar.GetItemInfo("DeskButton", &found_id) == B_OK) { while (deskbar.GetItemInfo(replicant.String(), &found_id) == B_OK) {
err = deskbar.RemoveItem(found_id); err = deskbar.RemoveItem(found_id);
if (err != B_OK) { if (err != B_OK) {
printf("desklink: Error removing replicant id %ld: %s\n", printf("desklink: Error removing replicant id %ld: %s\n",
@ -453,7 +462,8 @@ main(int, char **argv)
if (!atLeastOnePath) { if (!atLeastOnePath) {
printf( "usage: desklink { [ --list|--remove|[cmd=title:action ... ] [ path|signature ] } ...\n" printf( "usage: desklink { [ --list|--remove|[cmd=title:action ... ] [ path|signature ] } ...\n"
"--list: list all Deskbar addons.\n" "--list: list all Deskbar addons.\n"
"--remove: delete all desklink addons.\n"); "--remove: remove all desklink addons.\n"
"--remove=name: remove all 'name' addons.\n");
return 1; return 1;
} }