Dashwar can now displays a status item in the menu bar whenever you have a waiting game. The title changes to the number of waiting games you have. When no games need your attention, the status item goes away.
Getting the icon to display took awhile. Widgets aren't self-contained applications. As such, when you try to get the resource path programmatically, it ends up looking inside DashboardClient, the program that runs widgets. The widget plugin, which contains all the Cocoa stuff I'm doing for the status item (different from the Javascript of the rest of the widget), is its own bundle. This means it has its own folder that contains its own resources, mainly the image I wanted to use for the menu icon. Luckily, finding the bundle for the plugin, and subsequently the resource folder for that bundle in code wasn't too hard.
Another problem arose when sending data from Javascript to Objective-C. Conversion from basic Javascript types to Cocoa types should happen automatically, and for the most part, it is. Strings change to instances of NSString and numbers to NSNumber, but arrays, which should become NSArray objects remain WebScriptObject instances, the type for not-so-basic objects passed from Javascript. Of course, instead of trying to figure out why they weren't passing correctly, I decided to just send it one object at a time. I've wasted enough time trying to fix this kind of problem in other projects to know when to let go.
I had to provide a preference for displaying the status item, but that was only a minor headache. I'm quickly closing in on the end of my feature list, and I can't remember the last time that's happened.
No comments:
Post a Comment