ashchan / gmail-notifr

A RubyCocoa Gmail Notifier for Mac OS X

This URL has Read+Write access

ashchan (author)
Sun Jan 25 23:37:17 -0800 2009
commit  50de30edca79a967fb307d23f3e1db175f74c319
tree    af891931c52bee69ae53d3591b59a7793efaef44
parent  aae1ad9e57a1849e7af2ce9a379bf8683626a53b
gmail-notifr / GNGrowlController.rb
100644 34 lines (28 sloc) 0.705 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# GNGrowlController.rb
# Gmail Notifr
#
# Created by James Chan on 10/29/08.
# Copyright (c) 2008 ashchan.com. All rights reserved.
#
 
require 'osx/cocoa'
 
class GNGrowlController < OSX::NSObject
attr_accessor :app
def init
if super_init
@g = Growl::Notifier.sharedInstance
@g.delegate = self
@g.register('Gmail Notifr', ['new_messages'])
self
end
end
 
# delegate not working if :click_context not provided?
def growlNotifierClicked_context(sender, context)
@app.openInboxForAccount(context) if @app && context
end
 
def growlNotifierTimedOut_context(sender, context)
end
 
def notify(title, desc)
@g.notify('new_messages', title, desc, :click_context => title)
end
end