From 87f158f3f506130b6e516fe93144b7aa7e753153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 16 Dec 2004 02:45:44 +0000 Subject: [PATCH] Now only replaces the directory's name with the volume name for root directories for the window title. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10474 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/diskprobe/FileWindow.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/apps/diskprobe/FileWindow.cpp b/src/apps/diskprobe/FileWindow.cpp index a05bafba3b..d0844ee7cb 100644 --- a/src/apps/diskprobe/FileWindow.cpp +++ b/src/apps/diskprobe/FileWindow.cpp @@ -1,7 +1,7 @@ -/* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ +/* + * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include "FileWindow.h" @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -28,11 +29,15 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings) BPath path(ref); SetTitle(path.Path()); } else if (entry.IsDirectory()) { - BVolume volume(stat.st_dev); - if (volume.InitCheck() == B_OK) { - char name[B_FILE_NAME_LENGTH]; - if (volume.GetName(name) == B_OK) - SetTitle(name); + BDirectory directory(&entry); + if (directory.InitCheck() == B_OK && directory.IsRootDirectory()) { + // use the volume name for root directories + BVolume volume(stat.st_dev); + if (volume.InitCheck() == B_OK) { + char name[B_FILE_NAME_LENGTH]; + if (volume.GetName(name) == B_OK) + SetTitle(name); + } } }