Closed Bug 769122 Opened 13 years ago Closed 13 years ago

Use the system provided Bonjour icon

Categories

(Camino Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: phiw2, Assigned: alqahira)

Details

(Whiteboard: [camino-2.1.3])

Attachments

(2 files)

According to the Apple docs, the image is available as 'NSImageNameBonjour' https://developer.apple.com/library/mac/#documentation/userexperience/conceptual/applehiguidelines/SystemProvidedIcons/SystemProvidedIcons.html#//apple_ref/doc/uid/20000957-CH5-SW1 (this would get us the HiDPI image for free as well) I'm unsure if this applies to 10.5 and older, though.
From the NSImage docs, this is available in 10.5 and later. I think we just have to treat it the same way we do the folder icon (osFolderIcon in NSImage+Utils).
Oh, part of the reason we haven't done this is that the constant isn't available until the 10.5 SDK (Stuart was able to use the old "HFS Type Code" way with NSWorkspace because a folder is an NSWorkspace concept, but Bonjour isn't). If we did try to use the OS icon, the code would look something like this patch. However, either I'm not doing the constant lookup/declaration correctly in this patch (certainly possible), or my copy/paste of the osFooIcon method has bugs, because I'm getting the folder icon instead of the Bonjour one :-P
FWIW, I modified DragNDropOutlineView (see bug 768757) to return NSImageNameBonjour, and it does (32px by default, 16px if I setSize:), so 10.5 SDK on 10.5 definitely works correctly ;-) So that seems to imply that the constant declaration part of my code is wrong…
Attached patch FixSplinter Review
It occurred to me this afternoon while washing today's fruit and vegetable harvest that in the previous patch, I had defined (named) a constant so that the code would compile, but I had not actually specified the constant's value, which the OS isn't going to look up because, since I defined the constant, it's our constant, not the OS's. So I was effectively doing [NSImage imageNamed:@""], which apparently triggers the folder icon ;-) Per the NSImage docs (and NSImage.h), the value is the constant name minus the "ImageName" bit (so that the image can also be used in IB), so the value we want is "NSBonjour". This new patch WFM in both normal and 2x scale on 10.5, but a sanity-check on 10.6/10.7 would be great.
Assignee: nobody → alqahira
Status: NEW → ASSIGNED
Attachment #638148 - Flags: feedback?(phiw)
Comment on attachment 638148 [details] [diff] [review] Fix Works perfectly on 10.6 (normal mode) and 10.7 (normal mode and HiDPI mode); the OS provided icon is displayed in both (I replaced our rendezvous_icon.tiff with a specially crafted image to make sure). And the icon is correctly sized in both modes.
Attachment #638148 - Flags: feedback?(phiw) → feedback+
Comment on attachment 638148 [details] [diff] [review] Fix sr=smorgan
Attachment #638148 - Flags: superreview?(stuart.morgan+bugzilla) → superreview+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [camino-2.1.3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: