FileTypes : IconView for non-applications fixes
IconView is now only setting the icon with BAppFileInfo when the file is an application, otherwise relies on BNodeInfo. This avoids adding ressources within data files. The IconView also wasn't populated correctly when used on data files (by opposition to application binaries). It now loads the same icon that is shown in Tracker.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "FileTypes.h"
|
||||
#include "IconView.h"
|
||||
#include "MimeTypeListView.h"
|
||||
|
||||
@@ -1026,12 +1027,12 @@ IconView::Update()
|
||||
if (file.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
BAppFileInfo info;
|
||||
BNodeInfo info;
|
||||
if (info.SetTo(&file) != B_OK)
|
||||
return;
|
||||
|
||||
icon = Icon::AllocateBitmap(fIconSize);
|
||||
if (icon != NULL && info.GetIconForType(fType.Type(), icon,
|
||||
if (icon != NULL && info.GetTrackerIcon(icon,
|
||||
(icon_size)fIconSize) != B_OK) {
|
||||
delete icon;
|
||||
return;
|
||||
@@ -1234,15 +1235,26 @@ IconView::_SetIcon(BBitmap* large, BBitmap* mini, const uint8* data,
|
||||
if (fHasRef) {
|
||||
BFile file(&fRef, B_READ_WRITE);
|
||||
|
||||
BAppFileInfo info(&file);
|
||||
info.SetInfoLocation(B_USE_ATTRIBUTES);
|
||||
if (info.InitCheck() == B_OK) {
|
||||
if (large != NULL || force)
|
||||
info.SetIconForType(fType.Type(), large, B_LARGE_ICON);
|
||||
if (mini != NULL || force)
|
||||
info.SetIconForType(fType.Type(), mini, B_MINI_ICON);
|
||||
if (data != NULL || force)
|
||||
info.SetIconForType(fType.Type(), data, size);
|
||||
if (is_application(file)) {
|
||||
BAppFileInfo info(&file);
|
||||
if (info.InitCheck() == B_OK) {
|
||||
if (large != NULL || force)
|
||||
info.SetIconForType(fType.Type(), large, B_LARGE_ICON);
|
||||
if (mini != NULL || force)
|
||||
info.SetIconForType(fType.Type(), mini, B_MINI_ICON);
|
||||
if (data != NULL || force)
|
||||
info.SetIconForType(fType.Type(), data, size);
|
||||
}
|
||||
} else {
|
||||
BNodeInfo info(&file);
|
||||
if (info.InitCheck() == B_OK) {
|
||||
if (large != NULL || force)
|
||||
info.SetIcon(large, B_LARGE_ICON);
|
||||
if (mini != NULL || force)
|
||||
info.SetIcon(mini, B_MINI_ICON);
|
||||
if (data != NULL || force)
|
||||
info.SetIcon(data, size);
|
||||
}
|
||||
}
|
||||
// the icon shown will be updated using node monitoring
|
||||
} else if (fHasType) {
|
||||
|
||||
Reference in New Issue
Block a user