* Brush factory: Drive entries in fileselector don't have an icon on some platforms

* File selector: remove BeOS quirk for getting home directory (the OS was fixed), and try to guess the drive type for UNIX OSes (untested)

Fixes #492.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2015 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2012-09-28 18:19:31 +00:00
parent 26613ec440
commit 76222af12a
2 changed files with 18 additions and 8 deletions

View File

@ -1541,9 +1541,12 @@ void Draw_script_name(word x, word y, word index, byte highlighted)
fg=(highlighted)?MC_Light:MC_Dark;
bg=(highlighted)?MC_Dark:MC_Black;
if (current_item->Icon != ICON_NONE)
{
Window_display_icon_sprite(x,y,current_item->Icon);
x+=8;
}
}
Print_in_window(x, y, current_item->Short_name, fg,bg);

View File

@ -635,11 +635,7 @@ void Read_list_of_drives(T_Fileselector *list, byte name_length)
struct mount_entry* mount_points_list;
struct mount_entry* next;
#if defined(__BEOS__) || defined(__HAIKU__)
char * home_dir = getenv("$HOME");
#else
char * home_dir = getenv("HOME");
#endif
Add_element_to_list(list, "/", Format_filename("/",name_length,2), 2, ICON_NONE);
list->Nb_directories++;
if(home_dir)
@ -652,9 +648,20 @@ void Read_list_of_drives(T_Fileselector *list, byte name_length)
while(mount_points_list != NULL)
{
byte icon = ICON_NONE;
if (strcmp(mount_points_list->me_type, "cd9660") == 0)
icon = ICON_CDROM;
else if (strcmp(mount_points_list->me_type, "nfs") == 0)
icon = ICON_NETWORK;
else if (strcmp(mount_points_list->me_type, "msdos") == 0)
icon = ICON_FLOPPY_3_5; // Only a guess...
else if (strcmp(mount_points_list->me_type, "ext2fs") == 0)
icon = ICON_HDD; // Only a guess...
if(mount_points_list->me_dummy == 0 && strcmp(mount_points_list->me_mountdir,"/") && strcmp(mount_points_list->me_mountdir,"/home"))
{
Add_element_to_list(list, mount_points_list->me_mountdir, Format_filename(mount_points_list->me_mountdir, name_length, 2), 2, ICON_NONE);
Add_element_to_list(list, mount_points_list->me_mountdir,
Format_filename(mount_points_list->me_mountdir, name_length, 2), 2, icon);
list->Nb_directories++;
}
next = mount_points_list -> me_next;