If you can't find an app's icon, get the generic 3 boxes icon.
Well this is embarrasing. If the app icon could not be found I wasn't filling out anything so the bitmap was displaying random garbage. Instead, if I can't find the icon, fill with the generic 3 boxes icon. No reason to call GetTrackerIcon because I know that it is an application and not some other MIME type.
This commit is contained in:
@@ -858,15 +858,22 @@ void
|
|||||||
TBarApp::FetchAppIcon(const char* signature, BBitmap* icon)
|
TBarApp::FetchAppIcon(const char* signature, BBitmap* icon)
|
||||||
{
|
{
|
||||||
app_info appInfo;
|
app_info appInfo;
|
||||||
|
icon_size size = icon->Bounds().IntegerHeight() >= 32
|
||||||
|
? B_LARGE_ICON : B_MINI_ICON;
|
||||||
|
bool foundIcon = false;
|
||||||
|
|
||||||
if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) {
|
if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) {
|
||||||
BFile file(&appInfo.ref, B_READ_ONLY);
|
BFile file(&appInfo.ref, B_READ_ONLY);
|
||||||
BAppFileInfo appMime(&file);
|
BAppFileInfo appMime(&file);
|
||||||
icon_size size = icon->Bounds().IntegerHeight() >= 32
|
if (appMime.GetIcon(icon, size) == B_OK)
|
||||||
? B_LARGE_ICON : B_MINI_ICON;
|
foundIcon = true;
|
||||||
|
}
|
||||||
if (appMime.GetIcon(icon, size) != B_OK)
|
|
||||||
appMime.GetTrackerIcon(icon, size);
|
if (!foundIcon) {
|
||||||
|
// Get the generic 3 boxes icon
|
||||||
|
BMimeType defaultAppMime;
|
||||||
|
defaultAppMime.SetTo(B_APP_MIME_TYPE);
|
||||||
|
defaultAppMime.GetIcon(icon, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user