Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Icon Services woes

Icon Services woes
Thread Tools
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Jun 27, 2002, 09:14 PM
 
Looking at Preview.app's info.plist, it appears to provide an icon for files of the type 'JPEG' and creator 'prvw':

<key>CFBundleSignature</key>
<string>prvw</string>
...
<key>CFBundleTypeOSTypes</key>
<array>
<string>JPEG</string>
</array>

However, if I call IconServices to get an IconRef to this icon:

GetIconRef(kOnAppropriateDisk, 'prvw', 'JPEG', &iconRef);

...it returns a generic document icon. This same code path *does* work for other applications such as GraphicConverter, PhotoShop, ImageReady, etc.

Yes Preview.app is in my /Applications dir -- and I've tried the constants kOnSystemDisk and kUserDomain without effect. I've also tried this for every file type that Preview.app purports to support, and it doesn't work.

So what am I doing wrong, or is IconServices still not quite complete?
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
Addicted to MacNN
Join Date: Mar 2001
Location: Seattle, WA
Status: Offline
Reply With Quote
Jun 27, 2002, 10:40 PM
 
I would bet not complete. Though I am just guessing...

But Moki as El Pres of Ambrosia don't you have contacts inside apple? Fire off a email and ask if it's not fully implemented, as what you are doing *should* work.
The spirit of resistance to government is so valuable on certain occasions, that I wish it always to be kept alive.
- Thomas Jefferson, 1787
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jun 29, 2002, 03:48 AM
 
Methinks I once saw something about getting icons in LaunchServices that might work...
Rick Roe
icons.cx | weblog
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jun 29, 2002, 07:52 AM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by juanvaldes:
<strong>But Moki as El Pres of Ambrosia don't you have contacts inside apple? Fire off a email and ask if it's not fully implemented, as what you are doing *should* work.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Well, he's probably a member of ADC and as such could use up a technical support incident, but since they cost $300 a pop or something extortionate like that I expect he'd probably prefer not to.

Anyway, I'm pretty sure I heard that Icon Services has some bugs under OS X. I'd suggest trying the LaunchServices calls first, though.
     
moki  (op)
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Jun 29, 2002, 06:41 PM
 
It turns out to be yet another limitation in the OS X Carbon APIs -- if IconServices will just return what icons are in the OS 9 desktop database file (if you have one), which of course won't include applications that doesn't include OS 9-style bundles (such as Cocoa apps).

As a (lame) work-around, I simply create a temporary file of the type/creator I want an icon to, and call GetIconRefFromFile() on it.

Silly, slow, and inefficient, but it works. :/
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jun 29, 2002, 08:04 PM
 
not very elegant, either, but you could open the (cocoa) app's Contents/Info.plist and then look at the key for CFBundleIconFile and assemble the path...

as i said, not very elegant, but should work...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:54 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2