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