Now also shows the volume name instead of the entry_ref name for root directories.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10482 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "AttributeWindow.h"
|
#include "AttributeWindow.h"
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <Volume.h>
|
||||||
|
|
||||||
|
|
||||||
static const uint32 kMsgRemoveAttribute = 'rmat';
|
static const uint32 kMsgRemoveAttribute = 'rmat';
|
||||||
@@ -171,8 +173,28 @@ AttributeWindow::AttributeWindow(BRect rect, entry_ref *ref, const char *attribu
|
|||||||
: ProbeWindow(rect, ref),
|
: ProbeWindow(rect, ref),
|
||||||
fAttribute(strdup(attribute))
|
fAttribute(strdup(attribute))
|
||||||
{
|
{
|
||||||
char buffer[256];
|
// Set alternative window title for devices
|
||||||
snprintf(buffer, sizeof(buffer), "%s: %s", ref->name, attribute);
|
|
||||||
|
char name[B_FILE_NAME_LENGTH];
|
||||||
|
#ifdef COMPILE_FOR_R5
|
||||||
|
strncpy(name, ref->name, sizeof(name));
|
||||||
|
name[sizeof(name) - 1] = '\0';
|
||||||
|
#else
|
||||||
|
strlcpy(name, ref->name, sizeof(name));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEntry entry(ref);
|
||||||
|
if (entry.IsDirectory()) {
|
||||||
|
BDirectory directory(&entry);
|
||||||
|
if (directory.InitCheck() == B_OK && directory.IsRootDirectory()) {
|
||||||
|
// use the volume name for root directories
|
||||||
|
BVolume volume;
|
||||||
|
if (directory.GetVolume(&volume) == B_OK)
|
||||||
|
volume.GetName(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char buffer[B_PATH_NAME_LENGTH];
|
||||||
|
snprintf(buffer, sizeof(buffer), "%s: %s", name, attribute);
|
||||||
SetTitle(buffer);
|
SetTitle(buffer);
|
||||||
|
|
||||||
// add the menu
|
// add the menu
|
||||||
|
|||||||
Reference in New Issue
Block a user