Le mardi 10 janvier 2012 à 10:56 +0100, Fred Kiefer a écrit :
> On 10.01.2012 05:54, Eric Wasylishen wrote:
> > I didn't like the current approach either…  I just committed a
> > rewrite of how theme images are handled which gets rid of theme
> > proxies entirely, and eliminates the code in -[GSTheme activate] and
> > -[GSTheme deactivate] which were setting/restoring images.
> >
> > Now, when a name is set on an NSImage instance, it also subscribes to
> > the theme change notification. When an NSImage receives this
> > notification, it does the name-to-path lookup again that +[NSImage
> > imageNamed:] did, and reloads itself (discarding all reps) if the
> > path has changed.
> >
> > It's a fairly major change but I tested Gorm, GSTest, SimpleAgenda,
> > and tried switching between the GNUstep default theme, Neos, and
> > Etoile's Nesedah theme while the apps were running, and all images
> > seemed to update properly.
> 
> I am completely impressed by what you did here. On the other hand, I 
> cannot look at code without trying to find flaws in it. Sorry, I am just 
> made that way.
> 
> So this is what I found:
> 
> - After your code is verified by tests we should get rid of the complete 
> class GSThemeProxy.

And there is a duplicate #import <Foundation/NSNotification.h>

> - The code in [NSImage imageNamed:] could be simpified, not that the 
> proxy is gone. We don't need to get the same image we just created from 
> the dictionary.
> 
> - I don't quite understand what happens when we switch back from having 
> a theme to not using one. Will the standard GNUstep images get reused? 
> The question here is whether we send the notification 
> GSThemeDidActivateNotification when there is no theme at all.

I tested it (by adding NSLog) and it works : when going back from Neos
to native GNUstep theme, -themeDidActivate is called and the paths are
recomputed and the bitmaps loaded if needed.

Nitpicking : instead of registering for GSThemeDidActivateNotification
for every image (and getting x notifications), it would probably be more
efficient to register only once (but how ?) and check every image cached
in nameDict.

Anyway, this is a nice improvement of the code and of the user
experience, I like it when my computer seems faster :o)

Thanks,
Philippe


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to