[Sugar-devel] [PATCH sugar] FileTransfer: handle cancellation cleanly, OLPC #11065

Simon Schampijer simon at schampijer.de
Mon Sep 19 14:42:17 EDT 2011


When a file transfer has been canceled (the sender quits
before the receiver transferred it) we show a cancellation
message and the option to dismiss the transfer status
palette.

The behavior for a cancelation by the sender is a bit
different in telepathy as noted in [1]. You do only
get the cancellation message and the option to dismiss
the transfer status palette once you ackepted the
transfer. The same behavior is true in Empathy.

The cancellation message is the same as in Empathy.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=20621

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/jarabe/frame/activitiestray.py |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index 1c1205a..a1d13c9 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -630,12 +630,16 @@ class IncomingTransferPalette(BaseTransferPalette):
             for item in self.menu.get_children():
                 self.menu.remove(item)
 
-            menu_item = MenuItem(_('Resume'), icon_name='dialog-cancel')
-            menu_item.connect('activate', self.__resume_activate_cb)
-            self.menu.append(menu_item)
-            menu_item.show()
-
-            self.update_progress()
+            if self.file_transfer.reason_last_change == \
+                    filetransfer.FT_REASON_REMOTE_STOPPED:
+                menu_item = MenuItem(_('Dismiss'), icon_name='dialog-cancel')
+                menu_item.connect('activate', self.__dismiss_activate_cb)
+                self.menu.append(menu_item)
+                menu_item.show()
+                text = _('The other participant canceled the file transfer')
+                label = gtk.Label(text)
+                self.set_content(label)
+                label.show()
 
     def __accept_activate_cb(self, menu_item):
         #TODO: figure out the best place to get rid of that temp file
@@ -662,9 +666,6 @@ class IncomingTransferPalette(BaseTransferPalette):
     def __cancel_activate_cb(self, menu_item):
         self.file_transfer.cancel()
 
-    def __resume_activate_cb(self, menu_item):
-        self.file_transfer.resume()
-
     def __dismiss_activate_cb(self, menu_item):
         self.emit('dismiss-clicked')
 
-- 
1.7.4.4



More information about the Sugar-devel mailing list