~jconti/recent-notifications/trunk

« back to all changes in this revision

Viewing changes to recent_notifications/MessageList.py

  • Committer: Jason Conti
  • Date: 2011-02-25 23:34:25 UTC
  • Revision ID: jason.conti@gmail.com-20110225233425-sd2gvd9lxe5e01u0
Experiment with hiding the message window when it loses focus.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    self._message_icon_size = 32
49
49
    self._message_limit = 0
50
50
    self._filter_app = None
 
51
    self._popup_shown = False
51
52
 
52
53
    self.set_headers_visible(False)
53
54
    self.set_size_request(0, -1)
135
136
    clipboard = gtk.clipboard_get("CLIPBOARD")
136
137
 
137
138
    popup = gtk.Menu()
 
139
    popup.connect("selection-done", self.on_selection_done)
138
140
 
139
141
    copy_text_item = gtk.MenuItem(_("Copy Text"))
140
142
    copy_text_item.connect("activate", lambda *x: clipboard.set_text(body))
240
242
    else:
241
243
      return False
242
244
 
 
245
  def popup_shown(self):
 
246
    """Returns true if the popup is currently being shown"""
 
247
    return self._popup_shown
 
248
 
243
249
  def mark_as_read(self):
244
250
    """Marks the unread column as False for all the unread messages."""
245
251
    iter = self._liststore.get_iter_first()
283
289
        treeview.grab_focus()
284
290
        treeview.set_cursor(path, col, 0)
285
291
        popup = self.create_popup(path)
 
292
        self._popup_shown = True
286
293
        popup.popup(None, None, None, event.button, event.time)
287
294
      return True
288
295
 
 
296
  def on_selection_done(self, menushell):
 
297
    """Called when the popup menu selection is complete"""
 
298
    self._popup_shown = False
 
299
 
289
300
  def _message_data_func(self, column, cell, model, iter, *user_data):
290
301
    """Sets the cell text by substituting the row data into the message template."""
291
302
    summary = glib.markup_escape_text(model.get_value(iter, Column.SUMMARY))