From a9dfa85e4e1d06fa4f19cdeb99f147f490c4ab79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 24 Jan 2007 14:03:21 +0000 Subject: [PATCH] * DataEditor::SetTo() now checks if the reported block size is zero and then sets it to the 512 byte default - this fixes bug #960. * IconView::UpdateIcon() now uses 8-bit icon for get_device_icon(), as B_RGB32 cannot work in this case. * Also, in case it couldn't get an icon, it now tries to show the generic icon instead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19940 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/diskprobe/DataEditor.cpp | 5 ++++- src/apps/diskprobe/DiskProbe.cpp | 4 ++-- src/apps/diskprobe/ProbeView.cpp | 19 ++++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/apps/diskprobe/DataEditor.cpp b/src/apps/diskprobe/DataEditor.cpp index 20194af99f..7cc01a0c84 100644 --- a/src/apps/diskprobe/DataEditor.cpp +++ b/src/apps/diskprobe/DataEditor.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -505,6 +505,9 @@ DataEditor::SetTo(BEntry &entry, const char *attribute) } } + if (fBlockSize == 0) + fBlockSize = 512; + fRealViewSize = fViewSize = fBlockSize; fNeedsUpdate = true; diff --git a/src/apps/diskprobe/DiskProbe.cpp b/src/apps/diskprobe/DiskProbe.cpp index 1b5b5e4047..141803ba6b 100644 --- a/src/apps/diskprobe/DiskProbe.cpp +++ b/src/apps/diskprobe/DiskProbe.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -454,7 +454,7 @@ DiskProbe::AboutRequested() { BAlert *alert = new BAlert("about", "DiskProbe\n" "\twritten by Axel Dörfler\n" - "\tCopyright 2004-2006, Haiku.\n\n" + "\tCopyright 2004-2007, Haiku.\n\n" "original Be version by Robert Polic\n", "Ok"); BTextView *view = alert->TextView(); BFont font; diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 2184340c5d..76ea696595 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -256,13 +256,26 @@ IconView::UpdateIcon() status_t status = B_ERROR; if (fIsDevice) { + BBitmap* icon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8); + // TODO: as long as we'll use get_device_icon() for this + BPath path(&fRef); - status = get_device_icon(path.Path(), fBitmap->Bits(), B_LARGE_ICON); + status = get_device_icon(path.Path(), icon->Bits(), B_LARGE_ICON); + if (status == B_OK) { + delete fBitmap; + fBitmap = icon; + } else + delete icon; } else status = BNodeInfo::GetTrackerIcon(&fRef, fBitmap); if (status != B_OK) { - // ToDo: get a standard generic icon here? + // Try to get generic icon + BMimeType type(B_FILE_MIME_TYPE); + status = type.GetIcon(fBitmap, B_LARGE_ICON); + } + + if (status != B_OK) { delete fBitmap; fBitmap = NULL; }