[haiku-commits] haiku: hrev44004 - src/apps/deskbar

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 12 Apr 2012 04:11:10 +0200 (CEST)

hrev44004 adds 1 changeset to branch 'master'
old head: 3c5763274a1c6fd3b1676fc3c48ef4abdd8daec0
new head: b97545d7ab75350992fc786512a9cc4b1eeeb16e

----------------------------------------------------------------------------

b97545d: 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.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44004
Commit:      b97545d7ab75350992fc786512a9cc4b1eeeb16e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b97545d
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Thu Apr 12 02:06:18 2012 UTC

----------------------------------------------------------------------------

1 files changed, 12 insertions(+), 5 deletions(-)
src/apps/deskbar/BarApp.cpp |   17 ++++++++++++-----

----------------------------------------------------------------------------

diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 974dcfb..da2ad04 100644
--- a/src/apps/deskbar/BarApp.cpp
+++ b/src/apps/deskbar/BarApp.cpp
@@ -858,15 +858,22 @@ void
 TBarApp::FetchAppIcon(const char* signature, BBitmap* icon)
 {
        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) {
                BFile file(&appInfo.ref, B_READ_ONLY);
                BAppFileInfo appMime(&file);
-               icon_size size = icon->Bounds().IntegerHeight() >= 32
-                       ? B_LARGE_ICON : B_MINI_ICON;
-
-               if (appMime.GetIcon(icon, size) != B_OK)
-                       appMime.GetTrackerIcon(icon, size);
+               if (appMime.GetIcon(icon, size) == B_OK)
+                       foundIcon = true;
+       }
+       
+       if (!foundIcon) {
+               // Get the generic 3 boxes icon
+               BMimeType defaultAppMime;
+               defaultAppMime.SetTo(B_APP_MIME_TYPE);
+               defaultAppMime.GetIcon(icon, size);
        }
 }
 


Other related posts:

  • » [haiku-commits] haiku: hrev44004 - src/apps/deskbar - jscipione