home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / deskbar-applet / handlers / galago.py < prev    next >
Encoding:
Python Source  |  2006-08-29  |  1.5 KB  |  48 lines

  1. from gettext import gettext as _
  2.  
  3. import gnomevfs
  4. import deskbar, deskbar.Indexer
  5. import deskbar.Handler
  6. import deskbar.Match
  7. from deskbar.defs import VERSION
  8.  
  9. # FIXME: Waiting for python bindings of galago. This class is not ready
  10. HANDLERS = {
  11.     "GalagoHandler" : {
  12.         "name": "Instant Messaging (IM) Buddies",
  13.         "description": "Send messages to your buddies by typing their name",
  14.         "requirements": lambda: (deskbar.Handler.HANDLER_IS_NOT_APPLICABLE, "Waiting for python bindings of galago. Should allow to send IM by typing name.", None),
  15.         "version": VERSION,
  16.     }
  17. }
  18.  
  19. class GalagoMatch(deskbar.Match.Match):
  20.     def __init__(self, backend, name, email):
  21.         deskbar.Match.Match.__init__(self, backend, name)
  22.         
  23.         self._email = email
  24.         
  25.     def action(self, text=None):
  26.         gnomevfs.url_show("mailto:"+self._email)
  27.         
  28.     def get_category(self):
  29.         return "people"
  30.     
  31.     def get_verb(self):
  32.         return "Send Email to %s" % "<b>%(name)s</b>"
  33.         
  34. class GalagoHandler(deskbar.Handler.Handler):
  35.     def __init__(self):
  36.         deskbar.Handler.Handler.__init__(self, "mail.png")    
  37.         self._indexer = deskbar.Indexer.Indexer()
  38.     
  39.     def initialize(self):
  40.         # FIXME: Dummy entries        
  41.         #self._indexer.add("William Gates III <billg@microsoft.com>", GalagoMatch(self, "William Gates III", "billg@microsoft.com"))
  42.         #self._indexer.add("Steve Ballmer <steve@microsoft.com>", GalagoMatch(self, "Steve Ballmer", "steve@microsoft.com"))
  43.         #self._indexer.add("Bill Joy <bjoy@sun.com>", GalagoMatch(self, "Bill Joy", "bjoy@sun.com"))
  44.         pass
  45.         
  46.     def query(self, query):
  47.         return self._indexer.look_up(query)[:5]
  48.