[MacRuby-devel] A little NSStatusBar app - Gmail Notifr

James Chen ashchan at gmail.com
Fri Nov 19 15:01:05 PST 2010


Thank you for your help, Josh.

The project used to use a generated Security.bridgesupport, then I decided
to build it on the nightly build (0.8) with BS Preview. I found ^v parameter
is supported in 0.8 (but not in 0.7). The API we discussed require several
more complicated pointer parameters I haven't figured out how to construct
these parameters yet.

Fortunately to change an item's password in keychain, we can use a simpler
API, and that makes the app almost work  now. So I think I can update the
app logic first for now.

James

Sent from my iPhone

On 2010/11/20, at 4:39, Joshua Ballanco <jballanc at gmail.com> wrote:

Hey James,

The C API for the Keychain is not annotated with a bridge support file by
default in SnowLeopard, so the first thing you'll need to do is install the
BridgeSupport preview. Then you need to know what to put in for the 4
parameters to the method call, which unfortunately is not documented at
developer.apple.com (at least, not that I could find). There is, however,
headerdoc for the method in
/System/Library/Frameworks/Security.framework/Headers/SecKeychainItem.h:

 /*!
         @function SecKeychainItemModifyAttributesAndData
         @abstract Updates an existing keychain item after changing its
attributes or data.
         @param itemRef A reference to the keychain item to modify.
         @param attrList The list of attributes to modify, along with their
new values. Pass NULL if you don't need to modify any attributes.
         @param length The length of the buffer pointed to by data.
         @param data Pointer to a buffer containing the data to store. Pass
NULL if you don't need to modify the data.
         @result A result code. See "Security Error Codes" (SecBase.h).
         @discussion The keychain item is written to the keychain's
permanent data store. If the keychain item has not previously been added to
a keychain, a call to the SecKeychainItemModifyContent function does nothing
and returns
 noErr.
 */

So, I'm not sure if that's what you're looking for. Hopefully it's at least
a start. The projects look awesome, and if/when I have some more time I'd
love to help you out :-)

Cheers,

Josh

On Fri, Nov 19, 2010 at 9:36 AM, James Chen <ashchan at gmail.com> wrote:

> Hi guys,
>
> Gmail Notifr was originally written in RubyCocoa, which runs as a little
> NSStatusBar app and checks your gmail feeds at specified intervals. I
> started updating it to MacRuby last month.
>
> Most changes were just simply updating method_arg1_arg2 to
> method(arg1:arg2). Since this app saves account/password in Keychain, I also
> extracted the keychain access code to a separate project. Still have some
> difficulties on Security.framework's C methods. I also need to make the
> growl notification work later.
>
> I know many guys are interested in how to make menu bar (NSStatusBar)
> application so I guess this in progress project might help a little. The
> project repository is: https://github.com/ashchan/gmail-notifr , and the
> keychain access wrapper project is here:
> https://github.com/ashchan/macruby-keychain-wrapper .
>
> Regarding the C methods calling, the keychain wrapper has to access this
> API:
>
>     SecKeychainItemModifyAttributesAndData
>
> It would be really great if anyone knows how to construct
> SecKeychainAttributeList and other necessary parameters for this API and
> offers some help.
>
> ---
> James Chen
> ashchan.com | @ashchan <http://twitter.com/ashchan>
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel at lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101120/431d517e/attachment-0001.html>


More information about the MacRuby-devel mailing list