1

I'm trying out chromium-tabs. I have an issue where the icon of a tab never gets properly updated after it gets created for the first time. In my CTTabContents subclass, I have:

- (void)tabDidBecomeSelected {
    NSLog(@"selected");
    [self setIcon:[NSImage imageNamed:@"default"]];
}

- (void)tabDidResignSelected {
    NSLog(@"resign selected");
    [self setIcon:[NSImage imageNamed:@"notification"]];
}

This should change the icon if the tab resigns its selected status to a different one. But it doesn't. The icon never changes. Note that I've tried the same exact calls in (id)initWithBaseTabContents:(CTTabContents *)baseContents andJid:(NSString *)jid andStatus:(NSString *)status where they work fine, so the calls fail only on an update of the icon later.

I've also made sure the functions are getting called (I see the log statements). What's the problem here? Also, is this the fork that Chrome actually uses? It obviously works in Chrome, which is strange... Am I doing something wrong?

I even tried doing [[[self.browser.windowController window] contentView] setNeedsDisplay:YES]; in the tabDidBecomeSelected functions, to force the whole window to redraw, in case their code for updating the icon fails, but still no luck.

houbysoft
  • 32,532
  • 24
  • 103
  • 156
  • I have no experience with the library, but just reading the source for that class on github, I can see why setIcon: will have no effect. It's just a synthesized setter. Strangely, there's an exposed property called "view". Can you try [self.view setNeedsDisplay] ? – danh Sep 08 '13 at 15:23
  • @danh: tried that already, but sadly the exposed view is the actual contents of the tab, not the icon. Also, it's not really a synthesized setter, it's actually a macro `_synthRetain` which is supposed to call `[browser_ updateTabStateForContent:self];` automatically to update the state of the tab, but it doesn't work. – houbysoft Sep 08 '13 at 15:27
  • @danh: and yes, I've also tried calling `[self.browser updateTabStateForContent:self];` manually, still no luck – houbysoft Sep 08 '13 at 15:28
  • Then you probably also checked that the two imageNamed images both refer to valid and _distinct_ images? – danh Sep 08 '13 at 15:32
  • @danh: yes, as I've mentioned, I tried placing the calls in the `init...` function. Replacing one with the other does yield different icons as expected. And if I put both of them there, the second one takes effect, again as expected... – houbysoft Sep 08 '13 at 15:35

0 Answers0