[Adium-devl] -[AIAccountMenu menuNeedsUpdate:] - why do we need to rebuild the menus so often?

Andreas Monitzer am at adiumx.com
Tue Nov 20 22:35:35 UTC 2007


On Nov 20, 2007, at 21:16, Evan Schoenberg wrote:

> Every time a command+key combination is pressed,  menuNeedsUpdate:  
> is called on the delegates of each item in the various menu bar  
> menus. This includes the account menu items.  This triggers a  
> rebuild of the submenus in -[AIAccountMenu menuNeedsUpdate:]
>
> We're therefore rebuilding the submenus off the account menu items  
> really, really often - practically polling for changes to the  
> account-specific menu items.  I assume this has to do with xmpp  
> server-provided actions, since it was added along with those.  Is  
> there a better way we could approach this, such as finding out when  
> a change is needed and flipping a flag to rebuild next time it's  
> needed?

I added this due to a very problematic issue with PEP. Adium did only  
refresh the account menu right after connecting. However, the prpl  
doesn't know yet wether the server supports PEP, so it doesn't know  
what items to display in the menu. Additionally, there may be ad-hoc  
commands, which can't be decided yet either.
One more thing are ad-hoc commands of the clients connected to the  
same account. Those are dynamic, since other clients can go online and  
offline at will.
Basically, the only better solution would be to implement some kind of  
notification when the menu changes right into libpurple. I didn't dare  
to implement that, but I guess it would be fairly simple using the IPC  
mechanism (that's what I used for the CDSA-plugin).

andy





More information about the devel mailing list