Closed Bug 357516 Opened 18 years ago Closed 16 years ago

Favicons (site icons) on alternates in menus don't update

Categories

(Camino Graveyard :: Toolbars & Menus, defect)

All
macOS
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stuart.morgan+bugzilla, Assigned: chris)

References

Details

Attachments

(1 file, 3 obsolete files)

Favicons on menu items don't update in all the alternates, so it's easy to get into a situation where the favicons on menu items change as you press Command or Command-Shift. Right now it's just bookmarks, but it will presumably affect history as well once the history-with-alternates stuff lands.
[4:45pm] smorgan: IIRC, it only affects things that have changed since you launched STR: 1. Go to a site in your bookmarks which you know has a favicon but which currently is not cached (e.g., manually add http://live.gnome.org/Epiphany/MozillaBugs to your bookmarks, then visit it) 2. Open your bookmarks menu and hold down Cmd or Cmd-Shift and watch the icon disappear
Summary: Favicons on alternates in menus don't update → Favicons (site icons) on alternates in menus don't update
When creating the alternate items, the menu icon might need to be set. Or are they actually removed from the main menuitem as well, and for good?
Attached patch Fix v1.0 (obsolete) — Splinter Review
Updates the bookmark and the next two NSMenuItems (for Cmd and Cmd+Shift). This also fixes titles for alternates not being updated. Looks like this 2 year old bug *will* get fixed.
Assignee: nobody → trendyhendy2000
Status: NEW → ASSIGNED
Attachment #351673 - Flags: review?(cl-bugs-new)
Hardware: Macintosh → All
Comment on attachment 351673 [details] [diff] [review] Fix v1.0 Looks good to me. Minor nit: periods at the end of the comments, since they're complete sentences. r=me with that addressed.
Attachment #351673 - Flags: superreview?(stuart.morgan+bugzilla)
Attachment #351673 - Flags: review?(cl-bugs-new)
Attachment #351673 - Flags: review+
Comment on attachment 351673 [details] [diff] [review] Fix v1.0 >+ for (unsigned int i = 0; i < 3; i++) I really don't like having the number of alternates hard-coded like this. Instead, make an updateCommandKeyAlternatesForMenuItem: method in NSMenu+Utils and walk forward as long as the subsequent items have the same key equivalent but different key modifiers. That gets the alternates in a generic way. > Looks like this 2 year old bug *will* get fixed. This isn't actually the bug people are unhappy about, BTW; the link in that post was to the wrong bug.
Attachment #351673 - Flags: superreview?(stuart.morgan+bugzilla) → superreview-
Attached patch Fix v1.1 (obsolete) — Splinter Review
Moves the updating to our NSMenu category. Will now update all the alternates that have the same represented object.
Attachment #351673 - Attachment is obsolete: true
Attachment #353491 - Flags: review?(cl-bugs-new)
Comment on attachment 353491 [details] [diff] [review] Fix v1.1 >Index: camino/src/extensions/NSMenu+Utils.h >=================================================================== >+// Updates the command and shift-command alternate menu items for a given menu >+// item. Returns the number of alternates updated. Is there a reason we would care about the number of alternates we just updated? I can see how it's useful for the method you copied from, but I don't see the point here. Seems like a (void) would be better. I'd also reword the comment to "Update the Command and Command-Shift alternate menu items for a given menu item." If there's a reason to have it return the number of alternates, replace the period with a comma, and continue, "and return the number of alternates updated." >+ if (itemIndex == -1) return 0; It might be useful to explain, in a comment, why this should return early, since it's not quite as self-documenting as Objective-C is supposed to be :-p (It may also be that I don't understand how alternates work as well as I should.) >+ return altIndex-itemIndex-1; If there's a reason to keep this as an (int) method, this would be clearer if expressed as: return (altIndex - itemIndex - 1); I'm going to r- this for now, pending an answer to the (int) vs (void) question.
Attachment #353491 - Flags: review?(cl-bugs-new) → review-
Attached patch Fix v1.2 (obsolete) — Splinter Review
Yeah, good point about the int vs void thing. This simplifies the method greatly. The -1 thing will probably never happen, but indexOfItem does return that value if the item can't be found, and it may just prevent a bug in the future.
Attachment #353491 - Attachment is obsolete: true
Attachment #353633 - Flags: review?(cl-bugs-new)
Attachment #353633 - Flags: superreview?(mikepinkerton)
Attachment #353633 - Flags: review?(cl-bugs-new)
Attachment #353633 - Flags: review+
Comment on attachment 353633 [details] [diff] [review] Fix v1.2 >Index: camino/src/extensions/NSMenu+Utils.m >=================================================================== >RCS file: /cvsroot/mozilla/camino/src/extensions/NSMenu+Utils.m,v >retrieving revision 1.21 >diff -u -8 -r1.21 NSMenu+Utils.m >--- camino/src/extensions/NSMenu+Utils.m 11 Jun 2008 17:57:57 -0000 1.21 >+++ camino/src/extensions/NSMenu+Utils.m 18 Dec 2008 07:00:13 -0000 >@@ -337,16 +337,35 @@ > [altMenuItem setRepresentedObject:representedObject]; > [altMenuItem setImage:image]; > [self insertItem:altMenuItem atIndex:(itemIndex + 2)]; > [altMenuItem release]; > > return 2; > } > >+- (void)updateCommandKeyAlternatesForMenuItem:(NSMenuItem *)inMenuItem >+{ >+ int itemIndex = [self indexOfItem:inMenuItem]; >+ // indexOfItem will return -1 if the item is not in the menu >+ if (itemIndex == -1) return; How about this: // If the item is not in this menu, there's nothing to update. if (itemIndex == -1) return; r=me with or without the return on a separate line; I don't think we have an established style for that, but I personally prefer it on a separate line as it's easier to read that way.
Attachment #353633 - Flags: superreview?(mikepinkerton) → superreview+
Patch with cl's comments incorporated.
Attachment #353633 - Attachment is obsolete: true
Checked in on cvs trunk; thanks!
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: