|
|
|
@ -836,7 +836,7 @@ class Interface(object):
|
|
|
|
|
"""Clear the text field.""" |
|
|
|
|
self._update_text.get_buffer().set_text('') |
|
|
|
|
|
|
|
|
|
self._delete_iter = None |
|
|
|
|
self._delete_info = None |
|
|
|
|
self._clear_reply() |
|
|
|
|
self._remove_count_status() |
|
|
|
|
|
|
|
|
@ -918,6 +918,8 @@ class Interface(object):
|
|
|
|
|
def _clear_posts(self, widget, user_data=None): |
|
|
|
|
"""Clear the list of posts from the grid.""" |
|
|
|
|
page = self._main_tabs.get_current_page() |
|
|
|
|
# we can't use self._get_current_grid() 'cause we actually need to |
|
|
|
|
# know the current grid to clear the counts |
|
|
|
|
if page == 0: |
|
|
|
|
# messages |
|
|
|
|
self._grid.get_model().clear() |
|
|
|
@ -930,7 +932,8 @@ class Interface(object):
|
|
|
|
|
|
|
|
|
|
def _delete_message(self, widget, user_data=None): |
|
|
|
|
"""Delete 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) |
|
|
|
|
|
|
|
|
|
confirm = gtk.MessageDialog(parent=self._main_window, |
|
|
|
@ -946,7 +949,7 @@ class Interface(object):
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
self._update_statusbar(_('Deleting message...')) |
|
|
|
|
self._delete_iter = iter |
|
|
|
|
self._delete_info = (grid, iter) |
|
|
|
|
_log.debug('Deleting messing %d', message.id) |
|
|
|
|
self._threads.add_work(self._post_delete_message, |
|
|
|
|
self._exception_delete_message, |
|
|
|
@ -985,7 +988,7 @@ class Interface(object):
|
|
|
|
|
(model, iter) = grid.get_selection().get_selected() |
|
|
|
|
message = model.get_value(iter, 0) |
|
|
|
|
|
|
|
|
|
self._favourite_iter = iter |
|
|
|
|
self._favourite_info = (grid, iter) |
|
|
|
|
|
|
|
|
|
if message.favourite: |
|
|
|
|
display = _('Removing message from %s from favorites...') |
|
|
|
@ -1294,9 +1297,10 @@ class Interface(object):
|
|
|
|
|
def _post_delete_message(self, widget, data): |
|
|
|
|
"""Called when the message is deleted successfully.""" |
|
|
|
|
_log.debug('Message deleted.') |
|
|
|
|
if self._delete_iter: |
|
|
|
|
self._grid.get_model().remove(self._delete_iter) |
|
|
|
|
self._delete_iter = None |
|
|
|
|
if self._delete_info: |
|
|
|
|
(grid, iter) = self._delete_info |
|
|
|
|
grid.get_model().remove(iter) |
|
|
|
|
self._delete_info = None |
|
|
|
|
self._update_statusbar(_('Message deleted.')) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
@ -1331,14 +1335,15 @@ class Interface(object):
|
|
|
|
|
def _post_favourite_message(self, widget, data): |
|
|
|
|
"""Called when the message was favourited successfully.""" |
|
|
|
|
_log.debug('Favourite status changed.') |
|
|
|
|
message = self._grid.get_model().get_value(self._favourite_iter, 0) |
|
|
|
|
(grid, iter) = self._favourite_info |
|
|
|
|
message = grid.get_model().get_value(iter, 0) |
|
|
|
|
if message.favourite: |
|
|
|
|
display = _('Message unfavorited.') |
|
|
|
|
else: |
|
|
|
|
display = _('Message favorited.') |
|
|
|
|
self._update_statusbar(display) |
|
|
|
|
message.favourite = not message.favourite |
|
|
|
|
self._favourite_iter = None |
|
|
|
|
self._favourite_info = None |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def _exception_favourite_message(self, widget, exception): |
|
|
|
@ -1391,9 +1396,9 @@ class Interface(object):
|
|
|
|
|
|
|
|
|
|
# This is the ugly bit for speeding up things and making |
|
|
|
|
# interthread communication. |
|
|
|
|
self._delete_iter = None |
|
|
|
|
self._delete_info = None |
|
|
|
|
self._reply_message_id = None |
|
|
|
|
self._favourite_iter = None |
|
|
|
|
self._favourite_info = None |
|
|
|
|
self._new_message_count = 0 |
|
|
|
|
self._new_replies_count = 0 |
|
|
|
|
|
|
|
|
|