Browse Source

Get the current grid before any message operations. Fixes #185

master
Julio Biason 15 years ago
parent
commit
24f9851ca4
  1. 19
      mitterlib/ui/ui_pygtk.py

19
mitterlib/ui/ui_pygtk.py

@ -766,6 +766,14 @@ class Interface(object):
iter = model.iter_next(iter)
return
def _get_current_grid(self):
"""Return the grid of the current selected tab."""
page = self._main_tabs.get_current_page()
if page == 0:
return self._grid
elif page == 1:
return self._replies
# ------------------------------------------------------------
# Widget callback functions
@ -782,7 +790,7 @@ class Interface(object):
suffix = ''
# TODO: gettext to properly use "characters"/"character"
text = '%d characters %s' % (count, prefix)
text = '%d characters %s' % (count, suffix)
self._statusbar.push(self._remove_count_status(), text)
self._update_sensitivity(not (count == 0))
@ -925,7 +933,8 @@ class Interface(object):
def _reply_message(self, widget, user_data=None):
"""Reply to someone else's message."""
(model, iter) = self._grid.get_selection().get_selected()
grid = self._get_current_grid()
(model, iter) = grid.get_selection().get_selected()
message = model.get_value(iter, 0)
self._update_text.get_buffer().set_text(
self._connection.reply_prefix(message))
@ -936,7 +945,8 @@ class Interface(object):
def _repost_message(self, widget, user_data=None):
"""Repost someone else's message on your timeline."""
(model, iter) = self._grid.get_selection().get_selected()
grid = self._get_current_grid()
(model, iter) = grid.get_selection().get_selected()
message = model.get_value(iter, 0)
self._update_statusbar('Reposting %s message...' %
(message.username))
@ -948,7 +958,8 @@ class Interface(object):
def _favourite_message(self, widget, user_data=None):
"""Toggle the favourite status of a message."""
(model, iter) = self._grid.get_selection().get_selected()
grid = self._get_current_grid()
(model, iter) = grid.get_selection().get_selected()
message = model.get_value(iter, 0)
self._favourite_iter = iter

Loading…
Cancel
Save