[haiku-commits] r35402 - haiku/trunk/src/bin/desklink
- From: stpere@xxxxxxxxx
- To: haiku-commits@xxxxxxxxxxxxx
- Date: Thu, 4 Feb 2010 02:37:21 +0100 (CET)
Author: stpere
Date: 2010-02-04 02:37:21 +0100 (Thu, 04 Feb 2010)
New Revision: 35402
Changeset: http://dev.haiku-os.org/changeset/35402/haiku
Ticket: http://dev.haiku-os.org/ticket/5354
Modified:
haiku/trunk/src/bin/desklink/desklink.cpp
Log:
desklink: --list fixes
* Don't assume that ids to be contiguous (and to start at 0).
* Use the executable's name as the replicant view name (to ease its
identification and removal)
Fixes ticket #5354.
Modified: haiku/trunk/src/bin/desklink/desklink.cpp
===================================================================
--- haiku/trunk/src/bin/desklink/desklink.cpp 2010-02-03 21:23:52 UTC (rev
35401)
+++ haiku/trunk/src/bin/desklink/desklink.cpp 2010-02-04 01:37:21 UTC (rev
35402)
@@ -48,15 +48,18 @@
if (strcmp(argv[i], "--list") == 0) {
int32 count = deskbar.CountItems();
-
+ int32 found = 0;
+ int32 j = 0;
printf("Deskbar items:\n");
- for (int32 i = 0; i < count; i++) {
+ while (found < count) {
const char *name = NULL;
- if (deskbar.GetItemInfo(i, &name) == B_OK) {
- printf("Item %ld: '%s'\n", i, name);
+ if (deskbar.GetItemInfo(j, &name) == B_OK) {
+ printf("Item %ld: '%s'\n", j, name);
free((void *)name);
+ found++;
}
+ j++;
}
return 0;
}
@@ -137,7 +140,7 @@
err = deskbar.AddItem(&ref);
if (err != B_OK) {
err = deskbar.AddItem(new DeskButton(BRect(0, 0, 15,
15),
- &ref, "DeskButton", titleList, actionList));
+ &ref, ref.name, titleList, actionList));
if (err != B_OK) {
printf("desklink: Deskbar refuses link to '%s':
%s\n", argv[i], strerror(err));
return 1;
Other related posts:
- » [haiku-commits] r35402 - haiku/trunk/src/bin/desklink - stpere