Try to cleanup the activity destruction mess.

This commit is contained in:
Marco Pesenti Gritti 2007-10-15 23:47:02 +02:00
parent fc98263bb3
commit c975b11606
2 changed files with 18 additions and 33 deletions

View File

@ -5,4 +5,3 @@
<Alt>n=next <Alt>n=next
<Alt>p=prev <Alt>p=prev
<Alt>c=close <Alt>c=close
<Alt>f=fullscreen

View File

@ -130,7 +130,6 @@ class ActivityToolbar(gtk.Toolbar):
def _stop_clicked_cb(self, button): def _stop_clicked_cb(self, button):
self._activity.close() self._activity.close()
self._activity.destroy()
def _jobject_updated_cb(self, jobject): def _jobject_updated_cb(self, jobject):
self.title.set_text(jobject['title']) self.title.set_text(jobject['title'])
@ -260,8 +259,7 @@ class Activity(Window, gtk.Container):
util.set_proc_title(proc_title) util.set_proc_title(proc_title)
self.connect('realize', self._realize_cb) self.connect('realize', self._realize_cb)
self.connect('delete-event', self._delete_event_cb) self.connect('delete-event', self.__delete_event_cb)
self.connect('window-state-event', self._window_state_event_cb)
self._active = False self._active = False
self._activity_id = handle.activity_id self._activity_id = handle.activity_id
@ -269,10 +267,10 @@ class Activity(Window, gtk.Container):
self._shared_activity = None self._shared_activity = None
self._share_id = None self._share_id = None
self._join_id = None self._join_id = None
self._can_close = True
self._preview = None self._preview = None
self._updating_jobject = False self._updating_jobject = False
self._closing = False self._closing = False
self._deleting = False
self._max_participants = 0 self._max_participants = 0
self._invites_queue = [] self._invites_queue = []
@ -345,9 +343,6 @@ class Activity(Window, gtk.Container):
else: else:
logging.debug("Unknown share scope %r" % share_scope) logging.debug("Unknown share scope %r" % share_scope)
def _window_state_event_cb(self, window, event):
logging.info(event.new_window_state)
def do_set_property(self, pspec, value): def do_set_property(self, pspec, value):
if pspec.name == 'active': if pspec.name == 'active':
if self._active != value: if self._active != value:
@ -597,35 +592,26 @@ class Activity(Window, gtk.Container):
self._internal_share_cb) self._internal_share_cb)
self._pservice.share_activity(self, private=private) self._pservice.share_activity(self, private=private)
def close(self):
self._preview = self._get_preview()
self.save()
if self._shared_activity:
self._shared_activity.leave()
if self._updating_jobject:
self._closing = True
else:
self.destroy()
def _realize_cb(self, window): def _realize_cb(self, window):
wm.set_bundle_id(window.window, self.get_bundle_id()) wm.set_bundle_id(window.window, self.get_bundle_id())
wm.set_activity_id(window.window, self._activity_id) wm.set_activity_id(window.window, self._activity_id)
def _delete_event_cb(self, window, event): def __delete_event_cb(self, widget, event):
if self._can_close: self.close()
self.close() return True
return False
else:
return True
def close(self):
self._closing = True
if self._bus:
del self._bus
self._bus = None
if self._shared_activity:
self._shared_activity.leave()
self._preview = self._get_preview()
self.save()
def destroy(self):
if self._updating_jobject:
# Delay destruction
self.hide()
else:
Window.destroy(self)
def get_metadata(self): def get_metadata(self):
if self._jobject: if self._jobject: