* Added two new ways to retrieve an icon from a device:

- B_GET_ICON_NAME: returns the name of an icon. This will then be read from
    a predefined location on disk (not yet implemented). This would also allow
    to add specifiers like "-boot", or "-fat|bfs|ntfs|...", and have special
    icons for those.
  - B_GET_VECTOR_ICON: retrieves the vector icon of a device, if any.
* get_device_icon(BBitmap*, ...) now supports other color spaces than B_CMAP8.
* Added get_device_icon(), BPartition::GetIcon(), and BVolume::GetIcon()
  variants that can also retrieve the icon data directly (like
  BNodeInfo::GetIcon()).
* Reenabled the previous BPartition::GetIcon(), based on a patch by
  Justin O'Dell - this fixes #1391.
* Tracker's MountMenu class now uses B_RGBA32 icons, instead of B_CMAP8.
* Added vector icon to scsi_disk, and scsi_cd. The former doesn't have any
  special removable icon, though.
* Header cleanup, added/updated license, whitespace cleanup.
* Marked deprecated/obsolete driver ioctls in Drivers.h.
* Removed OpenBeOS namespace in the headers I touched that still had them.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27001 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-17 11:27:07 +00:00
parent 9ad1415ecb
commit 06ba3f0acb
10 changed files with 464 additions and 308 deletions
+58 -98
View File
@@ -1,46 +1,46 @@
/*
* Copyright 2002-2008, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _DRIVERS_DRIVERS_H #ifndef _DRIVERS_DRIVERS_H
#define _DRIVERS_DRIVERS_H #define _DRIVERS_DRIVERS_H
#include <BeBuild.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <SupportDefs.h>
#include <BeBuild.h>
#include <Select.h> #include <Select.h>
#include <SupportDefs.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* --- /* These hooks are how the kernel accesses legacy devices */
these hooks are how the kernel accesses the device typedef status_t (*device_open_hook)(const char *name, uint32 flags,
--- */ void **cookie);
typedef status_t (*device_close_hook)(void *cookie);
typedef status_t (*device_open_hook) (const char *name, uint32 flags, void **cookie); typedef status_t (*device_free_hook)(void *cookie);
typedef status_t (*device_close_hook) (void *cookie); typedef status_t (*device_control_hook)(void *cookie, uint32 op, void *data,
typedef status_t (*device_free_hook) (void *cookie); size_t len);
typedef status_t (*device_control_hook) (void *cookie, uint32 op, void *data, typedef status_t (*device_read_hook)(void *cookie, off_t position, void *data,
size_t len); size_t *numBytes);
typedef status_t (*device_read_hook) (void *cookie, off_t position, void *data, typedef status_t (*device_write_hook)(void *cookie, off_t position,
size_t *numBytes); const void *data, size_t *numBytes);
typedef status_t (*device_write_hook) (void *cookie, off_t position, typedef status_t (*device_select_hook)(void *cookie, uint8 event, uint32 ref,
const void *data, size_t *numBytes); selectsync *sync);
typedef status_t (*device_select_hook) (void *cookie, uint8 event, uint32 ref, typedef status_t (*device_deselect_hook)(void *cookie, uint8 event,
selectsync *sync); selectsync *sync);
typedef status_t (*device_deselect_hook) (void *cookie, uint8 event, typedef status_t (*device_read_pages_hook)(void *cookie, off_t position,
selectsync *sync); const iovec *vec, size_t count, size_t *_numBytes);
typedef status_t (*device_read_pages_hook)(void *cookie, off_t position, const iovec *vec, typedef status_t (*device_write_pages_hook)(void *cookie, off_t position,
size_t count, size_t *_numBytes); const iovec *vec, size_t count, size_t *_numBytes);
typedef status_t (*device_write_pages_hook) (void *cookie, off_t position, const iovec *vec,
size_t count, size_t *_numBytes);
#define B_CUR_DRIVER_API_VERSION 2 #define B_CUR_DRIVER_API_VERSION 2
/* --- /* Legacy driver device hooks */
the device_hooks structure is a descriptor for the device, giving its
entry points.
--- */
typedef struct { typedef struct {
device_open_hook open; /* called to open the device */ device_open_hook open; /* called to open the device */
device_close_hook close; /* called to close the device */ device_close_hook close; /* called to close the device */
@@ -50,55 +50,43 @@ typedef struct {
device_write_hook write; /* writes to the device */ device_write_hook write; /* writes to the device */
device_select_hook select; /* start select */ device_select_hook select; /* start select */
device_deselect_hook deselect; /* stop select */ device_deselect_hook deselect; /* stop select */
device_read_pages_hook read_pages; /* scatter-gather physical read from the device */ device_read_pages_hook read_pages;
device_write_pages_hook write_pages; /* scatter-gather physical write to the device */ /* scatter-gather physical read from the device */
device_write_pages_hook write_pages;
/* scatter-gather physical write to the device */
} device_hooks; } device_hooks;
/* Driver functions needed to be exported by legacy drivers */
status_t init_hardware(void); status_t init_hardware(void);
const char **publish_devices(void); const char** publish_devices(void);
device_hooks *find_device(const char *name); device_hooks* find_device(const char* name);
status_t init_driver(void); status_t init_driver(void);
void uninit_driver(void); void uninit_driver(void);
extern int32 api_version; extern int32 api_version;
enum { enum {
B_GET_DEVICE_SIZE = 1, /* get # bytes */ B_GET_DEVICE_SIZE = 1, /* get # bytes - returns size_t in *data */
/* returns size_t in *data */ B_SET_DEVICE_SIZE, /* set # bytes - passes size_t in *data */
B_SET_DEVICE_SIZE, /* set # bytes */
/* passed size_t in *data */
B_SET_NONBLOCKING_IO, /* set to non-blocking i/o */ B_SET_NONBLOCKING_IO, /* set to non-blocking i/o */
B_SET_BLOCKING_IO, /* set to blocking i/o */ B_SET_BLOCKING_IO, /* set to blocking i/o */
B_GET_READ_STATUS, /* check if can read w/o blocking */ B_GET_READ_STATUS, /* check if can read w/o blocking */
/* returns bool in *data */ /* returns bool in *data */
B_GET_WRITE_STATUS, /* check if can write w/o blocking */ B_GET_WRITE_STATUS, /* check if can write w/o blocking */
/* returns bool in *data */ /* returns bool in *data */
B_GET_GEOMETRY, /* get info about device geometry */ B_GET_GEOMETRY, /* get info about device geometry */
/* returns struct geometry in *data */ /* returns struct geometry in *data */
B_GET_DRIVER_FOR_DEVICE, /* get the path of the executable serving */
B_GET_DRIVER_FOR_DEVICE, /* get the path of the executable serving that device */ /* that device */
B_GET_PARTITION_INFO, /* get info about a device partition */ B_GET_PARTITION_INFO, /* get info about a device partition */
/* returns struct partition_info in *data */ /* returns struct partition_info in *data */
B_SET_PARTITION, /* obsolete, will be removed */
B_SET_PARTITION, /* create a user-defined partition */
B_FORMAT_DEVICE, /* low-level device format */ B_FORMAT_DEVICE, /* low-level device format */
B_EJECT_DEVICE, /* eject the media if supported */ B_EJECT_DEVICE, /* eject the media if supported */
B_GET_ICON, /* return device icon (see struct below) */ B_GET_ICON, /* return device icon (see struct below) */
B_GET_BIOS_GEOMETRY, /* get info about device geometry */ B_GET_BIOS_GEOMETRY, /* get info about device geometry */
/* as reported by the bios */ /* as reported by the bios */
/* returns struct geometry in *data */ /* returns struct geometry in *data */
B_GET_MEDIA_STATUS, /* get status of media. */ B_GET_MEDIA_STATUS, /* get status of media. */
/* return status_t in *data: */ /* return status_t in *data: */
/* B_NO_ERROR: media ready */ /* B_NO_ERROR: media ready */
@@ -109,21 +97,18 @@ enum {
/* B_DEV_MEDIA_CHANGE_REQUESTED: user */ /* B_DEV_MEDIA_CHANGE_REQUESTED: user */
/* pressed button on drive */ /* pressed button on drive */
/* B_DEV_DOOR_OPEN: door open */ /* B_DEV_DOOR_OPEN: door open */
B_LOAD_MEDIA, /* load the media if supported */ B_LOAD_MEDIA, /* load the media if supported */
B_GET_BIOS_DRIVE_ID, /* get bios id for this device */ B_GET_BIOS_DRIVE_ID, /* get bios id for this device */
B_SET_UNINTERRUPTABLE_IO, /* prevent cntl-C from interrupting i/o */ B_SET_UNINTERRUPTABLE_IO, /* prevent cntl-C from interrupting i/o */
B_SET_INTERRUPTABLE_IO, /* allow cntl-C to interrupt i/o */ B_SET_INTERRUPTABLE_IO, /* allow cntl-C to interrupt i/o */
B_FLUSH_DRIVE_CACHE, /* flush drive cache */ B_FLUSH_DRIVE_CACHE, /* flush drive cache */
B_GET_PATH_FOR_DEVICE, /* get the absolute path of the device */ B_GET_PATH_FOR_DEVICE, /* get the absolute path of the device */
B_GET_ICON_NAME, /* get an icon name identifier */
B_GET_VECTOR_ICON, /* retrieves the device's vector icon */
B_GET_NEXT_OPEN_DEVICE = 1000, /* iterate through open devices */ B_GET_NEXT_OPEN_DEVICE = 1000, /* obsolete, will be removed */
B_ADD_FIXED_DRIVER, /* private */ B_ADD_FIXED_DRIVER, /* obsolete, will be removed */
B_REMOVE_FIXED_DRIVER, /* private */ B_REMOVE_FIXED_DRIVER, /* obsolete, will be removed */
B_AUDIO_DRIVER_BASE = 8000, /* base for codes in audio_driver.h */ B_AUDIO_DRIVER_BASE = 8000, /* base for codes in audio_driver.h */
B_MIDI_DRIVER_BASE = 8100, /* base for codes in midi_driver.h */ B_MIDI_DRIVER_BASE = 8100, /* base for codes in midi_driver.h */
@@ -133,10 +118,7 @@ enum {
B_DEVICE_OP_CODES_END = 9999 /* end of Be-defined contol id's */ B_DEVICE_OP_CODES_END = 9999 /* end of Be-defined contol id's */
}; };
/* --- /* B_GET_GEOMETRY data structure */
geometry structure for the B_GET_GEOMETRY opcode
--- */
typedef struct { typedef struct {
uint32 bytes_per_sector; /* sector size in bytes */ uint32 bytes_per_sector; /* sector size in bytes */
uint32 sectors_per_track; /* # sectors per track */ uint32 sectors_per_track; /* # sectors per track */
@@ -148,12 +130,6 @@ typedef struct {
bool write_once; /* non-zero if write-once */ bool write_once; /* non-zero if write-once */
} device_geometry; } device_geometry;
/* ---
Be-defined device types returned by B_GET_GEOMETRY. Use these if it makes
sense for your device.
--- */
enum { enum {
B_DISK = 0, /* Hard disks, floppy disks, etc. */ B_DISK = 0, /* Hard disks, floppy disks, etc. */
B_TAPE, /* Tape drives */ B_TAPE, /* Tape drives */
@@ -168,10 +144,7 @@ enum {
}; };
/* --- /* B_GET_PARTITION_INFO data structure */
partition_info structure used by B_GET_PARTITION_INFO and B_SET_PARTITION
--- */
typedef struct { typedef struct {
off_t offset; /* offset (in bytes) */ off_t offset; /* offset (in bytes) */
off_t size; /* size (in bytes) */ off_t size; /* size (in bytes) */
@@ -181,30 +154,17 @@ typedef struct {
char device[256]; /* path to the physical device */ char device[256]; /* path to the physical device */
} partition_info; } partition_info;
/* ---
driver_path structure returned by the B_GET_DRIVER_FOR_DEVICE
--- */
/* B_GET_DRIVER_FOR_DEVICE data structure */
typedef char driver_path[256]; typedef char driver_path[256];
/* --- /* B_GET_ICON, and B_GET_VECTOR_ICON data structure */
open_device_iterator structure used by the B_GET_NEXT_OPEN_DEVICE opcode
--- */
typedef struct { typedef struct {
uint32 cookie; /* must be set to 0 before iterating */ int32 icon_size;
char device[256]; /* device path */ /* B_GET_VECTOR_ICON: size of the data buffer in icon_data */
} open_device_iterator; /* B_GET_ICON: size of the icon in pixels */
void *icon_data;
/* ---
icon structure for the B_GET_ICON opcode
--- */
typedef struct {
int32 icon_size; /* icon size requested */
void *icon_data; /* where to put 'em (usually BBitmap->Bits()) */
} device_icon; } device_icon;
+24 -33
View File
@@ -1,37 +1,18 @@
/* /*
* Copyright 2004-2006, Haiku Inc. All Rights Reserved. * Copyright 2004-2008, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
/*!
\file Mime.h
Mime type C functions interface declarations.
*/
#ifndef _MIME_H #ifndef _MIME_H
#define _MIME_H #define _MIME_H
#ifndef _BE_BUILD_H
#include <BeBuild.h>
#endif
#include <sys/types.h> #include <sys/types.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#include <StorageDefs.h> #include <StorageDefs.h>
// C functions
#ifdef __cplusplus static const uint32 B_MIME_STRING_TYPE = 'MIMS';
extern "C" {
#endif
int update_mime_info(const char *path, int recursive, int synchronous,
int force);
status_t create_app_meta_mime(const char *path, int recursive, int synchronous,
int force);
status_t get_device_icon(const char *dev, void *icon, int32 size);
static const uint32 B_MIME_STRING_TYPE = 'MIMS';
enum icon_size { enum icon_size {
B_LARGE_ICON = 32, B_LARGE_ICON = 32,
@@ -45,22 +26,32 @@ enum {
B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL = 2, B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL = 2,
}; };
// C functions
#ifdef __cplusplus #ifdef __cplusplus
} extern "C" {
#endif #endif
// Haiku only! int update_mime_info(const char* path, int recursive, int synchronous,
int force);
status_t create_app_meta_mime(const char* path, int recursive, int synchronous,
int force);
status_t get_device_icon(const char* device, void* icon, int32 size);
#ifdef __cplusplus #ifdef __cplusplus
}
// C++ functions, Haiku only!
class BBitmap; class BBitmap;
status_t get_device_icon(const char *dev, BBitmap *icon, icon_size which); status_t get_device_icon(const char* device, BBitmap* icon, icon_size which);
status_t get_device_icon(const char* device, uint8** _data, size_t* _size,
type_code* _type);
#endif // include MimeType.h for convenience
# include <MimeType.h>
// include the C++ API #endif // __cplusplus
#ifdef __cplusplus
#include <MimeType.h>
#endif
#endif // _MIME_H #endif // _MIME_H
+43 -57
View File
@@ -1,18 +1,11 @@
// ---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2002-2008, Haiku Inc. All Rights Reserved.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
// */
// File Name: Directory.cpp
//
// Description: BVolume class
// ----------------------------------------------------------------------
/*!
\file Volume.h
BVolume interface declarations.
*/
#ifndef _VOLUME_H #ifndef _VOLUME_H
#define _VOLUME_H #define _VOLUME_H
#include <sys/types.h> #include <sys/types.h>
#include <fs_info.h> #include <fs_info.h>
@@ -20,67 +13,60 @@
#include <StorageDefs.h> #include <StorageDefs.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {
#endif
class BDirectory; class BDirectory;
class BBitmap; class BBitmap;
class BVolume { class BVolume {
public: public:
BVolume(); BVolume();
BVolume(dev_t dev); BVolume(dev_t device);
BVolume(const BVolume &vol); BVolume(const BVolume& volume);
virtual ~BVolume(); virtual ~BVolume();
status_t InitCheck() const; status_t InitCheck() const;
status_t SetTo(dev_t dev); status_t SetTo(dev_t device);
void Unset(); void Unset();
dev_t Device() const; dev_t Device() const;
status_t GetRootDirectory(BDirectory *directory) const; status_t GetRootDirectory(BDirectory* directory) const;
off_t Capacity() const; off_t Capacity() const;
off_t FreeBytes() const; off_t FreeBytes() const;
status_t GetName(char *name) const; status_t GetName(char* name) const;
status_t SetName(const char *name); status_t SetName(const char* name);
status_t GetIcon(BBitmap *icon, icon_size which) const; status_t GetIcon(BBitmap* icon, icon_size which) const;
status_t GetIcon(uint8** _data, size_t* _size,
type_code* _type) const;
bool IsRemovable() const; bool IsRemovable() const;
bool IsReadOnly() const; bool IsReadOnly() const;
bool IsPersistent() const; bool IsPersistent() const;
bool IsShared() const; bool IsShared() const;
bool KnowsMime() const; bool KnowsMime() const;
bool KnowsAttr() const; bool KnowsAttr() const;
bool KnowsQuery() const; bool KnowsQuery() const;
bool operator==(const BVolume &volume) const; bool operator==(const BVolume& volume) const;
bool operator!=(const BVolume &volume) const; bool operator!=(const BVolume& volume) const;
BVolume &operator=(const BVolume &volume); BVolume& operator=(const BVolume& volume);
private: private:
// friend class BVolumeRoster; virtual void _TurnUpTheVolume1();
virtual void _TurnUpTheVolume2();
virtual void _TurnUpTheVolume3();
virtual void _TurnUpTheVolume4();
virtual void _TurnUpTheVolume5();
virtual void _TurnUpTheVolume6();
virtual void _TurnUpTheVolume7();
virtual void _TurnUpTheVolume8();
virtual void _TurnUpTheVolume1(); dev_t fDevice;
virtual void _TurnUpTheVolume2(); status_t fCStatus;
virtual void _TurnUpTheVolume3(); int32 _reserved[8];
virtual void _TurnUpTheVolume4();
virtual void _TurnUpTheVolume5();
virtual void _TurnUpTheVolume6();
virtual void _TurnUpTheVolume7();
virtual void _TurnUpTheVolume8();
dev_t fDevice;
status_t fCStatus;
int32 _reserved[8];
}; };
#ifdef USE_OPENBEOS_NAMESPACE
} // namespace OpenBeOS
#endif
#endif // _VOLUME_H #endif // _VOLUME_H
+12 -10
View File
@@ -38,7 +38,7 @@ public:
uint32 BlockSize() const; uint32 BlockSize() const;
int32 Index() const; // 0 for devices int32 Index() const; // 0 for devices
uint32 Status() const; uint32 Status() const;
bool ContainsFileSystem() const; bool ContainsFileSystem() const;
bool ContainsPartitioningSystem() const; bool ContainsPartitioningSystem() const;
@@ -47,8 +47,8 @@ public:
bool IsMounted() const; bool IsMounted() const;
bool IsBusy() const; bool IsBusy() const;
uint32 Flags() const; uint32 Flags() const;
const char* Name() const; const char* Name() const;
const char* ContentName() const; const char* ContentName() const;
const char* Type() const; // See DiskDeviceTypes.h const char* Type() const; // See DiskDeviceTypes.h
@@ -58,10 +58,12 @@ public:
const char* ContentParameters() const; const char* ContentParameters() const;
status_t GetDiskSystem(BDiskSystem* diskSystem) const; status_t GetDiskSystem(BDiskSystem* diskSystem) const;
virtual status_t GetPath(BPath* path) const; virtual status_t GetPath(BPath* path) const;
status_t GetVolume(BVolume* volume) const; status_t GetVolume(BVolume* volume) const;
status_t GetIcon(BBitmap* icon, icon_size which) const; status_t GetIcon(BBitmap* icon, icon_size which) const;
status_t GetIcon(uint8** _data, size_t* _size,
type_code* _type) const;
status_t GetMountPoint(BPath* mountPoint) const; status_t GetMountPoint(BPath* mountPoint) const;
dev_t Mount(const char* mountPoint = NULL, dev_t Mount(const char* mountPoint = NULL,
@@ -80,7 +82,7 @@ public:
status_t GetPartitioningInfo( status_t GetPartitioningInfo(
BPartitioningInfo* info) const; BPartitioningInfo* info) const;
BPartition* VisitEachChild(BDiskDeviceVisitor* visitor) BPartition* VisitEachChild(BDiskDeviceVisitor* visitor)
const; const;
virtual BPartition* VisitEachDescendant( virtual BPartition* VisitEachDescendant(
@@ -90,7 +92,7 @@ public:
bool CanDefragment(bool* whileMounted = NULL) const; bool CanDefragment(bool* whileMounted = NULL) const;
status_t Defragment() const; status_t Defragment() const;
bool CanRepair(bool checkOnly, bool CanRepair(bool checkOnly,
bool* whileMounted = NULL) const; bool* whileMounted = NULL) const;
status_t Repair(bool checkOnly) const; status_t Repair(bool checkOnly) const;
@@ -149,14 +151,14 @@ public:
bool CanInitialize(const char* diskSystem) const; bool CanInitialize(const char* diskSystem) const;
status_t GetInitializationParameterEditor( status_t GetInitializationParameterEditor(
const char* system, const char* system,
BDiskDeviceParameterEditor** editor) const; BDiskDeviceParameterEditor** editor) const;
status_t ValidateInitialize(const char* diskSystem, status_t ValidateInitialize(const char* diskSystem,
BString* name, const char* parameters); BString* name, const char* parameters);
status_t Initialize(const char* diskSystem, status_t Initialize(const char* diskSystem,
const char* name, const char* parameters); const char* name, const char* parameters);
status_t Uninitialize(); status_t Uninitialize();
// Modification of child partitions // Modification of child partitions
bool CanCreateChild() const; bool CanCreateChild() const;
@@ -170,10 +172,10 @@ public:
const char* type, const char* name, const char* type, const char* name,
const char* parameters, const char* parameters,
BPartition** child = NULL); BPartition** child = NULL);
bool CanDeleteChild(int32 index) const; bool CanDeleteChild(int32 index) const;
status_t DeleteChild(int32 index); status_t DeleteChild(int32 index);
private: private:
class Delegate; class Delegate;
@@ -27,6 +27,31 @@
#endif #endif
static const uint8 kCDIcon[] = {
0x6e, 0x63, 0x69, 0x66, 0x05, 0x05, 0x00, 0x02, 0x03, 0x06, 0x05, 0xb8,
0x12, 0xa5, 0xbe, 0x03, 0xe1, 0x3d, 0xe7, 0x84, 0xb8, 0x02, 0x10, 0x49,
0xf7, 0x9f, 0x49, 0xed, 0xd8, 0x00, 0xf1, 0xf1, 0xf1, 0x36, 0xd9, 0xdd,
0xf4, 0x8a, 0x99, 0x96, 0xb9, 0xb4, 0xb8, 0xbe, 0xdb, 0xff, 0xf4, 0xf4,
0xf4, 0x04, 0xeb, 0xd0, 0x02, 0x00, 0x06, 0x02, 0x3c, 0x92, 0xc0, 0x38,
0x8f, 0x5f, 0xb8, 0x54, 0x50, 0x3c, 0x57, 0x63, 0x48, 0xd8, 0xdf, 0x48,
0x89, 0x5b, 0x00, 0x41, 0x37, 0xa9, 0xff, 0xb9, 0xb9, 0xb9, 0x04, 0x01,
0x7e, 0x04, 0x02, 0x04, 0x3f, 0x2c, 0x4e, 0x2c, 0x30, 0x2c, 0x22, 0x40,
0x22, 0x34, 0x22, 0x4c, 0x3f, 0x54, 0x30, 0x54, 0x4e, 0x54, 0x5c, 0x40,
0x5c, 0x4c, 0x5c, 0x34, 0x02, 0x04, 0x3f, 0x3a, 0x43, 0x3a, 0x3b, 0x3a,
0x39, 0x3e, 0x39, 0x3c, 0x39, 0x40, 0x3f, 0x42, 0x3b, 0x42, 0x43, 0x42,
0x45, 0x3e, 0x45, 0x40, 0x45, 0x3c, 0x02, 0x04, 0x4b, 0x3e, 0x4b, 0x3a,
0x4b, 0x42, 0x3f, 0x46, 0x47, 0x46, 0x37, 0x46, 0x33, 0x3e, 0x33, 0x42,
0x33, 0x3a, 0x3f, 0xbb, 0xf7, 0x37, 0xbb, 0xf7, 0x47, 0xbb, 0xf7, 0x02,
0x04, 0x40, 0x2a, 0x54, 0x2a, 0x50, 0x2c, 0x5c, 0x40, 0x5c, 0x34, 0x5c,
0x4c, 0x40, 0x56, 0x50, 0x54, 0x54, 0x56, 0x60, 0x40, 0x60, 0x4c, 0x60,
0x34, 0x06, 0x0a, 0x04, 0x01, 0x03, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x01,
0x18, 0x15, 0xff, 0x01, 0x17, 0x84, 0x00, 0x04, 0x0a, 0x00, 0x02, 0x00,
0x01, 0x18, 0x00, 0x15, 0x01, 0x17, 0x86, 0x00, 0x04, 0x0a, 0x01, 0x02,
0x00, 0x02, 0x00, 0x0a, 0x02, 0x02, 0x02, 0x01, 0x00, 0x0a, 0x03, 0x01,
0x02, 0x10, 0x01, 0x17, 0x82, 0x00, 0x04
};
static scsi_periph_interface *sSCSIPeripheral; static scsi_periph_interface *sSCSIPeripheral;
static device_manager_info *sDeviceManager; static device_manager_info *sDeviceManager;
@@ -714,6 +739,27 @@ cd_ioctl(void* cookie, uint32 op, void* buffer, size_t length)
return user_memcpy(buffer, &geometry, sizeof(device_geometry)); return user_memcpy(buffer, &geometry, sizeof(device_geometry));
} }
case B_GET_ICON_NAME:
return user_strlcpy((char*)buffer, "device-cd", B_FILE_NAME_LENGTH);
case B_GET_VECTOR_ICON:
{
device_icon iconData;
if (length != sizeof(device_icon))
return B_BAD_VALUE;
if (user_memcpy(&iconData, buffer, sizeof(device_icon)) != B_OK)
return B_BAD_ADDRESS;
if (iconData.icon_size >= (int32)sizeof(kCDIcon)) {
if (user_memcpy(iconData.icon_data, kCDIcon,
sizeof(kCDIcon)) != B_OK)
return B_BAD_ADDRESS;
}
iconData.icon_size = sizeof(kCDIcon);
return user_memcpy(buffer, &iconData, sizeof(device_icon));
}
case B_GET_ICON: case B_GET_ICON:
return sSCSIPeripheral->get_icon(icon_type_cd, return sSCSIPeripheral->get_icon(icon_type_cd,
(device_icon *)buffer); (device_icon *)buffer);
@@ -29,6 +29,33 @@
#endif #endif
static const uint8 kDriveIcon[] = {
0x6e, 0x63, 0x69, 0x66, 0x08, 0x03, 0x01, 0x00, 0x00, 0x02, 0x00, 0x16,
0x02, 0x3c, 0xc7, 0xee, 0x38, 0x9b, 0xc0, 0xba, 0x16, 0x57, 0x3e, 0x39,
0xb0, 0x49, 0x77, 0xc8, 0x42, 0xad, 0xc7, 0x00, 0xff, 0xff, 0xd3, 0x02,
0x00, 0x06, 0x02, 0x3c, 0x96, 0x32, 0x3a, 0x4d, 0x3f, 0xba, 0xfc, 0x01,
0x3d, 0x5a, 0x97, 0x4b, 0x57, 0xa5, 0x49, 0x84, 0x4d, 0x00, 0x47, 0x47,
0x47, 0xff, 0xa5, 0xa0, 0xa0, 0x02, 0x00, 0x16, 0x02, 0xbc, 0x59, 0x2f,
0xbb, 0x29, 0xa7, 0x3c, 0x0c, 0xe4, 0xbd, 0x0b, 0x7c, 0x48, 0x92, 0xc0,
0x4b, 0x79, 0x66, 0x00, 0x7d, 0xff, 0xd4, 0x02, 0x00, 0x06, 0x02, 0x38,
0xdb, 0xb4, 0x39, 0x97, 0x33, 0xbc, 0x4a, 0x33, 0x3b, 0xa5, 0x42, 0x48,
0x6e, 0x66, 0x49, 0xee, 0x7b, 0x00, 0x59, 0x67, 0x56, 0xff, 0xeb, 0xb2,
0xb2, 0x03, 0xa7, 0xff, 0x00, 0x03, 0xff, 0x00, 0x00, 0x04, 0x01, 0x80,
0x07, 0x0a, 0x06, 0x22, 0x3c, 0x22, 0x49, 0x44, 0x5b, 0x5a, 0x3e, 0x5a,
0x31, 0x39, 0x25, 0x0a, 0x04, 0x22, 0x3c, 0x44, 0x4b, 0x5a, 0x31, 0x39,
0x25, 0x0a, 0x04, 0x44, 0x4b, 0x44, 0x5b, 0x5a, 0x3e, 0x5a, 0x31, 0x0a,
0x04, 0x22, 0x3c, 0x22, 0x49, 0x44, 0x5b, 0x44, 0x4b, 0x08, 0x02, 0x27,
0x43, 0xb8, 0x14, 0xc1, 0xf1, 0x08, 0x02, 0x26, 0x43, 0x29, 0x44, 0x0a,
0x05, 0x44, 0x5d, 0x49, 0x5d, 0x60, 0x3e, 0x5a, 0x3b, 0x5b, 0x3f, 0x08,
0x0a, 0x07, 0x01, 0x06, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x10, 0x01, 0x17,
0x84, 0x00, 0x04, 0x0a, 0x01, 0x01, 0x01, 0x00, 0x0a, 0x02, 0x01, 0x02,
0x00, 0x0a, 0x03, 0x01, 0x03, 0x00, 0x0a, 0x04, 0x01, 0x04, 0x10, 0x01,
0x17, 0x85, 0x20, 0x04, 0x0a, 0x06, 0x01, 0x05, 0x30, 0x24, 0xb3, 0x99,
0x01, 0x17, 0x82, 0x00, 0x04, 0x0a, 0x05, 0x01, 0x05, 0x30, 0x20, 0xb2,
0xe6, 0x01, 0x17, 0x82, 0x00, 0x04
};
static scsi_periph_interface* sSCSIPeripheral; static scsi_periph_interface* sSCSIPeripheral;
static device_manager_info* sDeviceManager; static device_manager_info* sDeviceManager;
@@ -318,6 +345,30 @@ das_ioctl(void* cookie, uint32 op, void* buffer, size_t length)
return user_memcpy(buffer, &geometry, sizeof(device_geometry)); return user_memcpy(buffer, &geometry, sizeof(device_geometry));
} }
case B_GET_ICON_NAME:
// TODO: take device type into account!
return user_strlcpy((char*)buffer, "device-harddisk",
B_FILE_NAME_LENGTH);
case B_GET_VECTOR_ICON:
{
// TODO: take device type into account!
device_icon iconData;
if (length != sizeof(device_icon))
return B_BAD_VALUE;
if (user_memcpy(&iconData, buffer, sizeof(device_icon)) != B_OK)
return B_BAD_ADDRESS;
if (iconData.icon_size >= (int32)sizeof(kDriveIcon)) {
if (user_memcpy(iconData.icon_data, kDriveIcon,
sizeof(kDriveIcon)) != B_OK)
return B_BAD_ADDRESS;
}
iconData.icon_size = sizeof(kDriveIcon);
return user_memcpy(buffer, &iconData, sizeof(device_icon));
}
case B_GET_ICON: case B_GET_ICON:
return sSCSIPeripheral->get_icon(info->removable return sSCSIPeripheral->get_icon(info->removable
? icon_type_floppy : icon_type_disk, (device_icon *)buffer); ? icon_type_floppy : icon_type_disk, (device_icon *)buffer);
+130 -51
View File
@@ -1,10 +1,11 @@
/* /*
* Copyright 2002-2006, Haiku Inc. * Copyright 2002-2008, Haiku Inc.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Tyler Dauwalder * Tyler Dauwalder
* Ingo Weinhold, [email protected] * Ingo Weinhold, [email protected]
* Axel Dörfler, [email protected]
*/ */
/*! /*!
@@ -12,11 +13,18 @@
Mime type C functions implementation. Mime type C functions implementation.
*/ */
#include <errno.h>
#include <new>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fs_attr.h> #include <fs_attr.h>
#include <fs_info.h> #include <fs_info.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Drivers.h> #include <Drivers.h>
#include <Entry.h> #include <Entry.h>
#include <IconUtils.h>
#include <Mime.h> #include <Mime.h>
#include <MimeType.h> #include <MimeType.h>
#include <mime/database_access.h> #include <mime/database_access.h>
@@ -25,9 +33,6 @@
#include <Roster.h> #include <Roster.h>
#include <RosterPrivate.h> #include <RosterPrivate.h>
#include <unistd.h>
#include <sys/ioctl.h>
using namespace BPrivate; using namespace BPrivate;
enum { enum {
@@ -42,7 +47,7 @@ do_mime_update(int32 what, const char *path, int recursive,
{ {
BEntry root; BEntry root;
entry_ref ref; entry_ref ref;
status_t err = root.SetTo(path ? path : "/"); status_t err = root.SetTo(path ? path : "/");
if (!err) if (!err)
err = root.GetRef(&ref); err = root.GetRef(&ref);
@@ -50,7 +55,7 @@ do_mime_update(int32 what, const char *path, int recursive,
BMessage msg(what); BMessage msg(what);
BMessage reply; BMessage reply;
status_t result; status_t result;
// Build and send the message, read the reply // Build and send the message, read the reply
if (!err) if (!err)
err = msg.AddRef("entry", &ref); err = msg.AddRef("entry", &ref);
@@ -60,13 +65,13 @@ do_mime_update(int32 what, const char *path, int recursive,
err = msg.AddBool("synchronous", synchronous); err = msg.AddBool("synchronous", synchronous);
if (!err) if (!err)
err = msg.AddInt32("force", force); err = msg.AddInt32("force", force);
if (!err) if (!err)
err = BRoster::Private().SendTo(&msg, &reply, true); err = BRoster::Private().SendTo(&msg, &reply, true);
if (!err) if (!err)
err = reply.what == B_REG_RESULT ? B_OK : B_BAD_VALUE; err = reply.what == B_REG_RESULT ? B_OK : B_BAD_VALUE;
if (!err) if (!err)
err = reply.FindInt32("result", &result); err = reply.FindInt32("result", &result);
if (!err) if (!err)
err = result; err = result;
} }
return err; return err;
@@ -106,7 +111,7 @@ update_mime_info(const char *path, int recursive, int synchronous, int force)
recursive = true; recursive = true;
return do_mime_update(B_REG_MIME_UPDATE_MIME_INFO, path, recursive, return do_mime_update(B_REG_MIME_UPDATE_MIME_INFO, path, recursive,
synchronous, force); synchronous, force);
} }
// create_app_meta_mime // create_app_meta_mime
@@ -139,50 +144,44 @@ create_app_meta_mime(const char *path, int recursive, int synchronous,
synchronous, force); synchronous, force);
} }
// get_device_icon
/*! Retrieves an icon associated with a given device. /*! Retrieves an icon associated with a given device.
\param dev The path to the device. \param dev The path to the device.
\param icon A pointer to a buffer the icon data shall be written to. \param icon A pointer to a buffer the icon data shall be written to.
\param size The size of the icon. Currently the sizes 16 (small, i.e \param size The size of the icon. Currently the sizes 16 (small, i.e
\c B_MINI_ICON) and 32 (large, i.e. \c B_LARGE_ICON) are \c B_MINI_ICON) and 32 (large, i.e. \c B_LARGE_ICON) are
supported. supported.
\todo The mounted directories for volumes can also have META:X:STD_ICON \todo The mounted directories for volumes can also have META:X:STD_ICON
attributes. Should those attributes override the icon returned attributes. Should those attributes override the icon returned
by ioctl(,B_GET_ICON,)? by ioctl(,B_GET_ICON,)?
\return \return
- \c B_OK: Everything went fine. - \c B_OK: Everything went fine.
- An error code otherwise. - An error code otherwise.
*/ */
status_t status_t
get_device_icon(const char *dev, void *icon, int32 size) get_device_icon(const char *device, void *icon, int32 size)
{ {
status_t err = dev && icon && (size == B_LARGE_ICON || size == B_MINI_ICON) if (device == NULL || icon == NULL
? B_OK : B_BAD_VALUE; || (size != B_LARGE_ICON && size != B_MINI_ICON))
return B_BAD_VALUE;
int fd = -1; int fd = open(device, O_RDONLY);
if (fd < 0)
return errno;
if (!err) { device_icon iconData = {size, icon};
fd = open(dev, O_RDONLY); if (ioctl(fd, B_GET_ICON, &iconData) != 0) {
err = fd != -1 ? B_OK : B_BAD_VALUE; close(fd);
return errno;
} }
if (!err) {
device_icon iconData = { size, icon }; close(fd);
err = ioctl(fd, B_GET_ICON, &iconData); return B_OK;
}
if (fd != -1) {
// If the file descriptor was open()ed, we need to close it
// regardless. Only if we haven't yet encountered any errors
// do we make note close()'s return value, however.
status_t error = close(fd);
if (!err)
err = error;
}
return err;
} }
// get_device_icon
/*! Retrieves an icon associated with a given device. /*! Retrieves an icon associated with a given device.
\param dev The path to the device. \param dev The path to the device.
\param icon A pointer to a pre-allocated BBitmap of the correct dimension \param icon A pointer to a pre-allocated BBitmap of the correct dimension
@@ -190,38 +189,118 @@ get_device_icon(const char *dev, void *icon, int32 size)
large icon). large icon).
\param which Specifies the size of the icon to be retrieved: \param which Specifies the size of the icon to be retrieved:
\c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon. \c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon.
\todo The mounted directories for volumes can also have META:X:STD_ICON \todo The mounted directories for volumes can also have META:X:STD_ICON
attributes. Should those attributes override the icon returned attributes. Should those attributes override the icon returned
by ioctl(,B_GET_ICON,)? by ioctl(,B_GET_ICON,)?
\return \return
- \c B_OK: Everything went fine. - \c B_OK: Everything went fine.
- An error code otherwise. - An error code otherwise.
*/ */
status_t status_t
get_device_icon(const char *dev, BBitmap *icon, icon_size which) get_device_icon(const char *device, BBitmap *icon, icon_size which)
{ {
// check parameters // check parameters
status_t error = (dev && icon ? B_OK : B_BAD_VALUE); if (device == NULL || icon == NULL)
return B_BAD_VALUE;
BRect rect; BRect rect;
if (error == B_OK) { if (which == B_MINI_ICON)
if (which == B_MINI_ICON) rect.Set(0, 0, 15, 15);
rect.Set(0, 0, 15, 15); else if (which == B_LARGE_ICON)
else if (which == B_LARGE_ICON) rect.Set(0, 0, 31, 31);
rect.Set(0, 0, 31, 31); else
else return B_BAD_VALUE;
error = B_BAD_VALUE;
if (icon->Bounds() != rect)
return B_BAD_VALUE;
uint8* data;
size_t size;
type_code type;
status_t status = get_device_icon(device, &data, &size, &type);
if (status == B_OK) {
status = BIconUtils::GetVectorIcon(data, size, icon);
delete[] data;
return status;
} }
// Vector icon was not available, try old one
// check whether icon size and bitmap dimensions do match // check whether icon size and bitmap dimensions do match
if (error == B_OK if (icon->Bounds() != rect || icon->ColorSpace() != B_CMAP8)
&& (icon->Bounds() != rect || icon->ColorSpace() != B_CMAP8)) { return B_BAD_VALUE;
error = B_BAD_VALUE;
void* iconData = icon->Bits();
size_t iconSize = icon->BitsLength();
if (icon->ColorSpace() != B_CMAP8) {
iconSize = (size_t)which * (size_t)which;
iconData = malloc(iconSize);
if (iconData == NULL)
return B_NO_MEMORY;
} }
// TODO: support bitmap with other color spaces!
// get the icon // get the icon
if (error == B_OK) status = get_device_icon(device, iconData, which);
error = get_device_icon(dev, icon->Bits(), which); if (status == B_OK && iconData != icon->Bits())
return error; icon->SetBits(iconData, iconSize, 0, B_CMAP8);
if (iconData != icon->Bits())
free(iconData);
return status;
} }
status_t
get_device_icon(const char *device, uint8** _data, size_t* _size,
type_code* _type)
{
if (device == NULL || _data == NULL || _size == NULL || _type == NULL)
return B_BAD_VALUE;
int fd = open(device, O_RDONLY);
if (fd < 0)
return errno;
// TODO: support B_GET_ICON_NAME!
#if 0
char name[B_FILE_NAME_LENGTH];
if (ioctl(fd, B_GET_ICON_NAME, name) == 0) {
close(fd);
return B_OK;
}
#endif
uint8 data[8192];
device_icon iconData = {sizeof(data), data};
status_t status = ioctl(fd, B_GET_VECTOR_ICON, &iconData,
sizeof(device_icon));
if (status != 0)
status = errno;
if (status == B_OK) {
*_data = new(std::nothrow) uint8[iconData.icon_size];
if (*_data == NULL)
status = B_NO_MEMORY;
}
if (status == B_OK) {
if (iconData.icon_size > (int32)sizeof(data)) {
iconData.icon_data = *_data;
status = ioctl(fd, B_GET_VECTOR_ICON, &iconData,
sizeof(device_icon));
if (status != 0)
status = errno;
} else
memcpy(*_data, data, iconData.icon_size);
*_size = iconData.icon_size;
*_type = B_VECTOR_ICON_TYPE;
}
close(fd);
return status;
}
+49 -37
View File
@@ -1,11 +1,12 @@
// ---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2002-2008, Haiku Inc. All Rights Reserved.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
// *
// File Name: Volume.cpp * Authors:
// * Tyler Dauwalder
// Description: BVolume class * Ingo Weinhold
// ---------------------------------------------------------------------- */
/*! /*!
\file Volume.h \file Volume.h
BVolume implementation. BVolume implementation.
@@ -25,17 +26,14 @@
#include <syscalls.h> #include <syscalls.h>
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
#include <fs_interface.h> # include <fs_interface.h>
#endif #endif
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {
#endif
/*! /*!
\class BVolume \class BVolume
\brief Represents a disk volume \brief Represents a disk volume
Provides an interface for querying information about a volume. Provides an interface for querying information about a volume.
The class is a simple wrapper for a \c dev_t and the function The class is a simple wrapper for a \c dev_t and the function
@@ -44,7 +42,7 @@ namespace OpenBeOS {
\author Vincent Dominguez \author Vincent Dominguez
\author <a href='mailto:[email protected]'>Ingo Weinhold</a> \author <a href='mailto:[email protected]'>Ingo Weinhold</a>
\version 0.0.0 \version 0.0.0
*/ */
@@ -115,7 +113,7 @@ BVolume::~BVolume()
*/ */
status_t status_t
BVolume::InitCheck(void) const BVolume::InitCheck(void) const
{ {
return fCStatus; return fCStatus;
} }
@@ -140,7 +138,7 @@ BVolume::SetTo(dev_t device)
error = errno; error = errno;
} }
// set the new value // set the new value
if (error == B_OK) if (error == B_OK)
fDevice = device; fDevice = device;
// set the init status variable // set the init status variable
fCStatus = error; fCStatus = error;
@@ -163,7 +161,7 @@ BVolume::Unset()
or -1, if the object is not properly initialized. or -1, if the object is not properly initialized.
*/ */
dev_t dev_t
BVolume::Device() const BVolume::Device() const
{ {
return fDevice; return fDevice;
} }
@@ -334,18 +332,36 @@ status_t
BVolume::GetIcon(BBitmap *icon, icon_size which) const BVolume::GetIcon(BBitmap *icon, icon_size which) const
{ {
// check initialization // check initialization
status_t error = (InitCheck() == B_OK ? B_OK : B_BAD_VALUE); if (InitCheck() != B_OK)
// get FS stat return B_NO_INIT;
// get FS stat for the device name
fs_info info; fs_info info;
if (error == B_OK && fs_stat_dev(fDevice, &info) != 0) if (fs_stat_dev(fDevice, &info) != 0)
error = errno; return errno;
// get the icon // get the icon
if (error == B_OK) return get_device_icon(info.device_name, icon, which);
error = get_device_icon(info.device_name, icon, which);
return error;
} }
// IsRemovable
status_t
BVolume::GetIcon(uint8** _data, size_t* _size, type_code* _type) const
{
// check initialization
if (InitCheck() != B_OK)
return B_NO_INIT;
// get FS stat for the device name
fs_info info;
if (fs_stat_dev(fDevice, &info) != 0)
return errno;
// get the icon
return get_device_icon(info.device_name, _data, _size, _type);
}
/*! \brief Returns whether the volume is removable. /*! \brief Returns whether the volume is removable.
\return \c true, when the object is properly initialized and the \return \c true, when the object is properly initialized and the
referred to volume is removable, \c false otherwise. referred to volume is removable, \c false otherwise.
@@ -516,16 +532,12 @@ BVolume::operator=(const BVolume &volume)
} }
// FBC // FBC
void BVolume::_TurnUpTheVolume1() {} void BVolume::_TurnUpTheVolume1() {}
void BVolume::_TurnUpTheVolume2() {} void BVolume::_TurnUpTheVolume2() {}
void BVolume::_TurnUpTheVolume3() {} void BVolume::_TurnUpTheVolume3() {}
void BVolume::_TurnUpTheVolume4() {} void BVolume::_TurnUpTheVolume4() {}
void BVolume::_TurnUpTheVolume5() {} void BVolume::_TurnUpTheVolume5() {}
void BVolume::_TurnUpTheVolume6() {} void BVolume::_TurnUpTheVolume6() {}
void BVolume::_TurnUpTheVolume7() {} void BVolume::_TurnUpTheVolume7() {}
void BVolume::_TurnUpTheVolume8() {} void BVolume::_TurnUpTheVolume8() {}
#ifdef USE_OPENBEOS_NAMESPACE
}
#endif
+50 -21
View File
@@ -384,29 +384,58 @@ BPartition::GetVolume(BVolume* volume) const
status_t status_t
BPartition::GetIcon(BBitmap* icon, icon_size which) const BPartition::GetIcon(BBitmap* icon, icon_size which) const
{ {
/* if (icon == NULL)
status_t error = (icon ? B_OK : B_BAD_VALUE); return B_BAD_VALUE;
if (error == B_OK) {
if (IsMounted()) { status_t error;
// mounted: get the icon from the volume
BVolume volume; if (IsMounted()) {
error = GetVolume(&volume); // mounted: get the icon from the volume
BVolume volume;
error = GetVolume(&volume);
if (error == B_OK)
error = volume.GetIcon(icon, which);
} else {
// not mounted: retrieve the icon ourselves
if (BDiskDevice* device = Device()) {
BPath path;
error = device->GetPath(&path);
// get the icon
if (error == B_OK) if (error == B_OK)
error = volume.GetIcon(icon, which); error = get_device_icon(path.Path(), icon, which);
} else { } else
// not mounted: retrieve the icon ourselves error = B_ERROR;
if (BDiskDevice* device = Device()) { }
// get the icon return error;
if (error == B_OK) }
error = get_device_icon(device->Path(), icon, which);
} else
error = B_ERROR; status_t
} BPartition::GetIcon(uint8** _data, size_t* _size, type_code* _type) const
{
if (_data == NULL || _size == NULL || _type == NULL)
return B_BAD_VALUE;
status_t error;
if (IsMounted()) {
// mounted: get the icon from the volume
BVolume volume;
error = GetVolume(&volume);
if (error == B_OK)
error = volume.GetIcon(_data, _size, _type);
} else {
// not mounted: retrieve the icon ourselves
if (BDiskDevice* device = Device()) {
BPath path;
error = device->GetPath(&path);
// get the icon
if (error == B_OK)
error = get_device_icon(path.Path(), _data, _size, _type);
} else
error = B_ERROR;
} }
return error; return error;
*/
// not implemented
return B_ERROR;
} }
@@ -1168,7 +1197,7 @@ BPartition::CanCreateChild() const
// GetChildCreationParameterEditor // GetChildCreationParameterEditor
status_t status_t
BPartition::GetChildCreationParameterEditor(const char* type, BPartition::GetChildCreationParameterEditor(const char* type,
BDiskDeviceParameterEditor** editor) const BDiskDeviceParameterEditor** editor) const
{ {
if (!fDelegate) if (!fDelegate)
+1 -1
View File
@@ -126,7 +126,7 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level)
// get icon // get icon
BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1),
B_CMAP8); B_RGBA32);
if (partition->GetIcon(icon, B_MINI_ICON) != B_OK) { if (partition->GetIcon(icon, B_MINI_ICON) != B_OK) {
delete icon; delete icon;
icon = NULL; icon = NULL;