2008-06-06 19:13:10 +02:00
|
|
|
# Copyright (C) 2008, Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the
|
|
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
# Boston, MA 02111-1307, USA.
|
|
|
|
|
2008-10-28 14:19:01 +01:00
|
|
|
"""
|
|
|
|
UNSTABLE. Used only internally by jarabe.
|
|
|
|
"""
|
|
|
|
|
2008-06-06 19:13:10 +02:00
|
|
|
import os
|
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
from gi.repository import SugarExt
|
2008-06-06 19:13:10 +02:00
|
|
|
|
2009-08-25 21:12:40 +02:00
|
|
|
|
2012-11-14 23:07:40 +01:00
|
|
|
class XSMPClient(SugarExt.ClientXSMP):
|
|
|
|
pass
|
2008-06-06 19:13:10 +02:00
|
|
|
|
2009-08-25 21:12:40 +02:00
|
|
|
|
2008-06-06 20:13:27 +02:00
|
|
|
class SessionManager(object):
|
2009-08-25 21:12:40 +02:00
|
|
|
|
2008-06-06 19:13:10 +02:00
|
|
|
def __init__(self):
|
2011-11-15 19:29:07 +01:00
|
|
|
address = SugarExt.xsmp_init()
|
2008-06-06 19:13:10 +02:00
|
|
|
os.environ['SESSION_MANAGER'] = address
|
2011-11-15 19:29:07 +01:00
|
|
|
SugarExt.xsmp_run()
|
2008-06-06 19:13:10 +02:00
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
self.session = SugarExt.Session.create_global()
|
2008-06-06 19:13:10 +02:00
|
|
|
|
|
|
|
def start(self):
|
|
|
|
self.session.start()
|
|
|
|
self.session.connect('shutdown_completed',
|
|
|
|
self.__shutdown_completed_cb)
|
|
|
|
|
2008-06-10 23:45:24 +02:00
|
|
|
def initiate_shutdown(self):
|
2008-06-06 19:13:10 +02:00
|
|
|
self.session.initiate_shutdown()
|
|
|
|
|
|
|
|
def shutdown_completed(self):
|
2011-11-15 19:29:07 +01:00
|
|
|
SugarExt.xsmp_shutdown()
|
2008-06-06 19:13:10 +02:00
|
|
|
|
|
|
|
def __shutdown_completed_cb(self, session):
|
|
|
|
self.shutdown_completed()
|