Browse Source

Generic grid functions, in the hope they will work for a "replies" grid.

master
Julio Biason 15 years ago
parent
commit
5f9b221b87
  1. 20
      mitterlib/ui/ui_pygtk.py

20
mitterlib/ui/ui_pygtk.py

@ -640,11 +640,11 @@ class Interface(object):
self._reply_label.set_text('') self._reply_label.set_text('')
return return
def _url_popup(self, path, event): def _url_popup(self, widget, path, event):
"""Builds the popup with URLs in the cell pointed by *path*. Requires """Builds the popup with URLs in the cell pointed by *path*. Requires
the *event* that the widget received.""" the *event* that the widget received."""
iter = self._grid.get_model().get_iter(path) iter = widget.get_model().get_iter(path)
message = self._grid.get_model().get_value(iter, 0) message = widget.get_model().get_value(iter, 0)
popup = gtk.Menu() popup = gtk.Menu()
@ -952,22 +952,22 @@ class Interface(object):
# not right click # not right click
return False return False
path = self._grid.get_path_at_pos(event.x, event.y) path = widget.get_path_at_pos(event.x, event.y)
if not path: if not path:
return False return False
(path, _, _, _) = path (path, _, _, _) = path
return self._url_popup(path, event) return self._url_popup(widget, path, event)
return True return True
def _message_popup(self, widget, event, user_data=None): def _message_popup(self, widget, event, user_data=None):
"""Builds the popup with the URLs in the message.""" """Builds the popup with the URLs in the message."""
_log.debug('Popup') _log.debug('Popup')
(path, _) = self._grid.get_cursor() (path, _) = widget.get_cursor()
if not path: if not path:
return True return True
return self._url_popup(path, event) return self._url_popup(widget, path, event)
def _open_url(self, widget, user_data=None): def _open_url(self, widget, user_data=None):
"""Opens an URL (used mostly from popup menu items.)""" """Opens an URL (used mostly from popup menu items.)"""
@ -976,12 +976,12 @@ class Interface(object):
def _mark_message_read(self, widget, user_data=None): def _mark_message_read(self, widget, user_data=None):
"""Mark a message as read when it's selected.""" """Mark a message as read when it's selected."""
(path, _) = self._grid.get_cursor() (path, _) = widget.get_cursor()
if not path: if not path:
return True return True
iter = self._grid.get_model().get_iter(path) iter = widget.get_model().get_iter(path)
message = self._grid.get_model().get_value(iter, 0) message = widget.get_model().get_value(iter, 0)
if message.read: if message.read:
return True return True

Loading…
Cancel
Save