Web activity: quit the GTK main loop when activity is destroyed

Fixes #4603 .

In GTK activities, this is done by _ActivitySession when the activity
unregisters itself, in _complete_close method.

Making the web activity aware of session logout will be handled in
another patch for the shell, see http://bugs.sugarlabs.org/ticket/4611
This commit is contained in:
Manuel Quiñones 2013-08-21 13:23:13 -03:00
parent c8fa6bd694
commit d45560e3c7

View File

@ -44,6 +44,7 @@ class WebActivity(Gtk.Window):
self.connect("key-press-event", self._key_press_event_cb) self.connect("key-press-event", self._key_press_event_cb)
self.connect('realize', self._realize_cb) self.connect('realize', self._realize_cb)
self.connect('destroy', self._destroy_cb)
context = WebKit2.WebContext.get_default() context = WebKit2.WebContext.get_default()
context.register_uri_scheme("activity", self._app_scheme_cb, None) context.register_uri_scheme("activity", self._app_scheme_cb, None)
@ -69,6 +70,10 @@ class WebActivity(Gtk.Window):
SugarExt.wm_set_bundle_id(xid, self._bundle_id) SugarExt.wm_set_bundle_id(xid, self._bundle_id)
SugarExt.wm_set_activity_id(xid, str(self._activity_id)) SugarExt.wm_set_activity_id(xid, str(self._activity_id))
def _destroy_cb(self, window):
self.destroy()
Gtk.main_quit()
def _loading_changed_cb(self, web_view, load_event): def _loading_changed_cb(self, web_view, load_event):
if load_event == WebKit2.LoadEvent.FINISHED: if load_event == WebKit2.LoadEvent.FINISHED:
key = os.environ["SUGAR_APISOCKET_KEY"] key = os.environ["SUGAR_APISOCKET_KEY"]