@ -494,7 +494,6 @@ class Interface(object):
def _clear_text ( self , widget ) :
def _clear_text ( self , widget ) :
""" Clear the text field. """
""" Clear the text field. """
self . _delete_info = None
self . _clear_reply ( )
self . _clear_reply ( )
self . _update_field . hide ( )
self . _update_field . hide ( )
@ -537,9 +536,10 @@ 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. """
( grid , counter ) = self . _grids [ self . _main_tabs . get_current_page ( ) ]
page = self . _main_tabs . get_current_page ( )
( model , iter ) = grid . get_selection ( ) . get_selected ( )
message = self . _main_tabs . get_nth_page ( page ) . selected
message = model . get_value ( iter , 0 )
if not message :
return
confirm = gtk . MessageDialog ( parent = self . _main_window ,
confirm = gtk . MessageDialog ( parent = self . _main_window ,
type = gtk . MESSAGE_QUESTION ,
type = gtk . MESSAGE_QUESTION ,
@ -554,7 +554,6 @@ class Interface(object):
return False
return False
self . _update_statusbar ( _ ( ' Deleting message... ' ) )
self . _update_statusbar ( _ ( ' Deleting message... ' ) )
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 ,
@ -857,13 +856,11 @@ class Interface(object):
return
return
### Results for the delete message call
### Results for the delete message call
def _post_delete_message ( self , widget , data ) :
def _post_delete_message ( self , widget , message ) :
""" 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_info :
# any grid can take care of deleting the message
( grid , iter ) = self . _delete_info
MessageGrid . delete ( message )
grid . get_model ( ) . remove ( iter )
self . _delete_info = None
self . _update_statusbar ( _ ( ' Message deleted. ' ) )
self . _update_statusbar ( _ ( ' Message deleted. ' ) )
return
return
@ -895,18 +892,14 @@ class Interface(object):
return
return
### Results from the favorite call
### Results from the favorite call
def _post_favorite_message ( self , widget , data ) :
def _post_favorite_message ( self , widget , status ) :
""" Called when the message was favorited successfully. """
""" Called when the message was favorited successfully. """
_log . debug ( ' Favorite status changed. ' )
_log . debug ( ' Favorite status changed. ' )
( grid , iter ) = self . _favorite_info
if status :
message = grid . get_model ( ) . get_value ( iter , 0 )
if message . favorite :
display = _ ( ' Message unfavorited. ' )
else :
display = _ ( ' Message favorited. ' )
display = _ ( ' Message favorited. ' )
else :
display = _ ( ' Message unfavorited. ' )
self . _update_statusbar ( display )
self . _update_statusbar ( display )
message . favorite = not message . favorite
self . _favorite_info = None
return
return
def _exception_favorite_message ( self , widget , exception ) :
def _exception_favorite_message ( self , widget , exception ) :
@ -957,9 +950,7 @@ 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_info = None
self . _reply_message_id = None
self . _reply_message_id = None
self . _favorite_info = None
return
return