~gtg-user/gtg/gmail-like-ui

« back to all changes in this revision

Viewing changes to GTG/plugins/notification_area/notification_area.py

  • Committer: Luca Invernizzi
  • Date: 2010-01-04 15:11:22 UTC
  • Revision ID: invernizzi.l@gmail.com-20100104151122-yo7tt8e5131dpad7
- NotificationArea Icon now shortens long tasks
- bug fixing in NotificationArea
- fixed disaligments in pluginmanager

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
    DEFAULT_PREFERENCES = {"start_minimized": False}
29
29
    PLUGIN_NAME = "notification_area"
 
30
    MAX_TITLE_LEN = 30
30
31
    
31
32
    def __init__(self):
32
33
        self.minimized = False
73
74
            browser.open_task(tid)
74
75
 
75
76
    def add_menu_task(self, tid, task = None):
76
 
        """Adds a task in the menu"""
 
77
        """Adds a task in the menu, trimming the title if necessary"""
77
78
        if task == None:
78
79
            task = self.plugin_api.get_task(tid)
79
 
        menu_item = gtk.ImageMenuItem(task.get_title())
 
80
        title = task.get_title()[0:self.MAX_TITLE_LEN]
 
81
        if len(title)== self.MAX_TITLE_LEN:
 
82
            title = title + "..."
 
83
        menu_item = gtk.ImageMenuItem(title)
80
84
        menu_item.connect('activate', self.open_task, tid)
81
85
        self.menu.append(menu_item)
82
86
        self.tasks_in_menu[tid] = menu_item
102
106
    def deactivate(self, plugin_api):
103
107
        self.statusicon.set_visible(False)
104
108
        self.plugin_api.get_browser().start_minimized = False
105
 
        plugin_api.unregister_filter_cb(self.doable_tasks_filter)
106
109
    
107
110
    def onTaskOpened(self, plugin_api):
108
111
        pass