From 76222af12af7b5c8448a98f3e9c4289fd9f43e53 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 28 Sep 2012 18:19:31 +0000 Subject: [PATCH] * 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 --- src/factory.c | 7 +++++-- src/filesel.c | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/factory.c b/src/factory.c index 5451178c..005187df 100644 --- a/src/factory.c +++ b/src/factory.c @@ -1541,8 +1541,11 @@ void Draw_script_name(word x, word y, word index, byte highlighted) fg=(highlighted)?MC_Light:MC_Dark; bg=(highlighted)?MC_Dark:MC_Black; - Window_display_icon_sprite(x,y,current_item->Icon); - x+=8; + 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); diff --git a/src/filesel.c b/src/filesel.c index 28ec0306..9bfa242f 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -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 + char * home_dir = getenv("HOME"); 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;