From 737a8b3932524cfe233ba81e13f023c690ea4b98 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 19 Jun 2007 15:51:56 +0200 Subject: [PATCH] Cleanup activity closing --- sugar/activity/activity.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 1d3e33e8..5e5a3a5d 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -84,6 +84,7 @@ class ActivityToolbar(gtk.Toolbar): def _close_clicked_cb(self, button): self._activity.close() + self._activity.destroy() def _jobject_updated_cb(self, jobject): self.title.set_text(jobject['title']) @@ -182,8 +183,8 @@ class Activity(Window, gtk.Container): """ Window.__init__(self) - self.connect('destroy', self._destroy_cb) self.connect('realize', self._realize_cb) + self.connect('delete-event', self._delete_event_cb) self._active = False self._activity_id = handle.activity_id @@ -349,22 +350,18 @@ class Activity(Window, gtk.Container): wm.set_bundle_id(window.window, self.get_service_name()) wm.set_activity_id(window.window, self._activity_id) - def _destroy_cb(self, window): - """Destroys our ActivityService and sharing service""" + def _delete_event_cb(self, window, event): + self.close() + return False + + def close(self): if self._bus: del self._bus self._bus = None if self._shared_activity: self._shared_activity.leave() - def close(self): - if self._jobject: - try: - self.save() - except: - self.destroy() - raise - self.destroy() + self.save() def get_metadata(self): if self._jobject: