From 2c02680d03afb82572d731ec867244be91fdbeaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Sat, 7 Jul 2007 16:29:44 +0000 Subject: [PATCH] Allow removing any Deskbar replicants, by name. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21585 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/desklink/desklink.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/bin/desklink/desklink.cpp b/src/bin/desklink/desklink.cpp index cded7b9188..e503a29f7c 100644 --- a/src/bin/desklink/desklink.cpp +++ b/src/bin/desklink/desklink.cpp @@ -388,10 +388,19 @@ main(int, char **argv) 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_id; - while (deskbar.GetItemInfo("DeskButton", &found_id) == B_OK) { + while (deskbar.GetItemInfo(replicant.String(), &found_id) == B_OK) { err = deskbar.RemoveItem(found_id); if (err != B_OK) { printf("desklink: Error removing replicant id %ld: %s\n", @@ -453,7 +462,8 @@ main(int, char **argv) if (!atLeastOnePath) { printf( "usage: desklink { [ --list|--remove|[cmd=title:action ... ] [ path|signature ] } ...\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; }