From 89efa7d1a41bd8651a6ffcf3c8273935bdb8a086 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Fri, 11 Dec 2009 10:30:23 -0200 Subject: [PATCH] Starting replies --- mitterlib/ui/ui_pygtk.py | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 27a0c3a..1328333 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -396,17 +396,13 @@ class Interface(object): self._delete_action.set_property('sensitive', False) self._delete_action.connect('activate', self._delete_message) action_group.add_action_with_accel(self._delete_action, 'Delete') - # TODO: Check the accelerator self._reply_action = gtk.Action('Reply', '_Reply', "Send a response to someone's else message", gtk.STOCK_REDO) self._reply_action.set_property('sensitive', False) - # TODO: Connect - # TODO: Connecting function should indicate in the status bar that - # a reply will be made + self._reply_action.connect('activate', self._reply_message) action_group.add_action_with_accel(self._reply_action, 'r') - # TODO: Find a better word (non-network related) to this self._repost_action = gtk.Action('Repost', 'Re_post', "Put someone's else message on your timeline", gtk.STOCK_CONVERT) @@ -762,17 +758,6 @@ class Interface(object): (model, iter) = self._grid.get_selection().get_selected() message = model.get_value(iter, 0) - if not self._connection.can_delete(message): - # Since we delete only one message, we don't need to worry about - # multiple networks here. - error_dialog = gtk.MessageDialog(parent=self._main_window, - type=gtk.MESSAGE_ERROR, - message_format='Message cannot be deleted', - buttons=gtk.BUTTONS_OK) - error_dialog.run() - error_dialog.destroy() - return - self._update_statusbar('Deleting message...') self._delete_iter = iter _log.debug('Deleting messing %d', message.id) @@ -782,6 +767,17 @@ class Interface(object): message) return + def _reply_message(self, widget, user_data=None): + """Reply to someone's else message.""" + (model, iter) = self._grid.get_selection().get_selected() + message = model.get_value(iter, 0) + + self._reply_label.set_text('Replying to %s' % (message.username)) + self._reply_message_id = message + self._update_text.grab_focus() + + return + # ------------------------------------------------------------ # Network related functions # ------------------------------------------------------------ @@ -906,8 +902,8 @@ class Interface(object): # This is the ugly bit for speeding up things and making # interthread communication. self._delete_iter = None - self._reply_message = None - self._repost_message = None + self._reply_message_id = None + self._repost_message_id = None return