Documentation | StorageKit | Mime
SYNOPSIS
Perl
use HaikuR1::Mime qw(get_device_icon B_LARGE_ICON); my $bitmap = get_device_icon($device_name, B_LARGE_ICON);
Python
from HaikuR1.Mime import get_device_icon, B_LARGE_ICON bitmap = get_device_icon(device_name, B_LARGE_ICON)
DESCRIPTION
Exposes the mime function and constants.
For more information on Mime, see the Haiku Book class description.
FUNCTIONS
Icons
get_device_icon
get_named_icon
Gets the indicated icon. The versions that take an icon size return the icon as a Bitmap. The other versions return two items: the raw data and the icon type. (At the moment, type is always 'B_VECTOR_ICON_TYPE.)
The Bitmap versions actually call the raw data versions and convert the data
into a Bitmap. If no vector icon is found, get_device_icon
will also check
for legacy icons.
Note that named icons are stored in one of four directories: B_USER_NONPACKAGED_DATA_DIRECTORY, B_USER_DATA_DIRECTORY, B_SYSTEM_NONPACKAGED_DATA_DIRECTORY, and B_SYSTEM_DATA_DIRECTORY (and they are checked in this order).
Perl
get_device_icon($device, $which); get_device_icon($device); get_named_icon($name, $which); get_named_icon($name);
Python
get_device_icon(device, which) get_device_icon(device) get_named_icon(name, which) get_named_icon(name)
device
A string, the name of the device (not the name of the volume). You can get the device name for a path by running
df
in the Terminal.)name
A string, the name of the desired icon.
which
An integer, one of the icon size constants.
MIME info
update_mime_info
create_app_meta_mime
update_mime_info
updates the MIME info for one or more files.
create_app_meta_mime
creates an entry in the File Types database for an
application.
Perl
update_mime_info($path, $recursive, $synchronous, $force); create_app_meta_mime($path, $recursive, $synchronous, $force);
Python
update_mime_info(path,recursive,synchronous,force) create_app_meta_mime(path,recursive,synchronous,force)
path
A file or directory; if the empty value is passed, all files are updated, or all File Types entries are created for all applications.
recursive
An integer; if non-zero and
path
indicates a directory, the directory is updated recursively. (This is currently ignored bycreate_app_meta_mime
.)synchronous
An integer; if non-zero, the function doesn't return until the action is complete, and the function may generate an error; if
0
, the function returns immediately.force
An integer, one of the force constants.
CONSTANTS
Force
Perl
use HaikuR1::Mime qw(:force)
Python
Python does not support export tags.
- B_UPDATE_MIME_INFO_NO_FORCE
- B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE
- B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL
Icon size
Perl
use HaikuR1::Mime qw(:icon_size)
Python
Python does not support export tags.
- B_LARGE_ICON
- B_MINI_ICON