diff --git a/mitterlib/ui/helpers/gtk_messagegrid.py b/mitterlib/ui/helpers/gtk_messagegrid.py index 16bfcc9..d6469c0 100644 --- a/mitterlib/ui/helpers/gtk_messagegrid.py +++ b/mitterlib/ui/helpers/gtk_messagegrid.py @@ -21,11 +21,14 @@ import gobject import gtk import logging import pango +import re from cgi import escape as html_escape +import timesince + # ---------------------------------------------------------------------- -# String with the format to the message +# Constants for the message # ---------------------------------------------------------------------- MESSAGE_FORMAT = ('%(favourite_star)s' '%(full_name)s ' @@ -37,6 +40,7 @@ MESSAGE_FORMAT = ('%(favourite_star)s' '\n' '%(message)s\n' '%(message_age)s') +URL_RE = re.compile(r'(https?://[^\s\n\r]+)', re.I) # ---------------------------------------------------------------------- # Logging @@ -316,7 +320,7 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject): iter = model.get_iter_first() path = model.get_path(iter) - width = win_width - 85 # 48 = icon size + width = size - 85 # 48 = icon size # TODO: Find out where those 37 pixels came from and/or if they # are platform specific. @@ -331,13 +335,13 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject): def update(self, messages): """Update the grid with new messages.""" - self._grid.freeze() + self._grid.freeze_notify() store = self._grid.get_model() for message in messages: message.read = False store.prepend([message]) store.sort_column_changed() - self._grid.thaw() + self._grid.thaw_notify() self._grid.queue_draw() return @@ -363,3 +367,8 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject): self.count = 0 return + + def queue_draw(self): + """Make the grid to be redraw when possible.""" + # we need this 'cause _grid is not exposed. + self._grid.queue_draw()