diff --git a/Makefile.am b/Makefile.am index 3ae1ba5b..dc2e4653 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,9 @@ ACLOCAL_AMFLAGS = -I m4 dbusconfdir = $(pkgdatadir) dbusconf_DATA = dbus-installed.conf -bin_SCRIPTS = \ - sugar-emulator +bin_SCRIPTS = \ + sugar-emulator \ + sugar-emulator-shutdown install-data-local: $(top_srcdir)/sugar/setup.py \ diff --git a/shell/data/kbdconfig b/shell/data/kbdconfig index f8340876..967361a6 100644 --- a/shell/data/kbdconfig +++ b/shell/data/kbdconfig @@ -7,3 +7,4 @@ c=close F12=!sugar-log-viewer +q=!sugar-emulator-shutdown diff --git a/sugar-emulator-shutdown b/sugar-emulator-shutdown new file mode 100755 index 00000000..c608d970 --- /dev/null +++ b/sugar-emulator-shutdown @@ -0,0 +1,24 @@ +#!/usr/bin/python + +# Copyright (C) 2006, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os +import signal + +if os.environ.has_key('SUGAR_XEPHYR_PID'): + pid = int(os.environ['SUGAR_XEPHYR_PID']) + os.kill(pid, signal.SIGTERM) diff --git a/sugar/__uninstalled__.py.in b/sugar/__uninstalled__.py.in index d6391a95..7593387e 100644 --- a/sugar/__uninstalled__.py.in +++ b/sugar/__uninstalled__.py.in @@ -17,5 +17,6 @@ sugar_python_path.append(os.path.join(sugar_source_dir, 'activities')) sugar_python_path.append(os.path.join(sugar_source_dir, 'services')) sugar_bin_path = [] +sugar_bin_path.append(os.path.join(sugar_source_dir)) sugar_bin_path.append(os.path.join(sugar_source_dir, 'shell')) sugar_bin_path.append(os.path.join(sugar_source_dir, 'services/presence')) diff --git a/sugar/emulator.py b/sugar/emulator.py index f1f0b3d9..638029ec 100644 --- a/sugar/emulator.py +++ b/sugar/emulator.py @@ -60,6 +60,7 @@ class Process: flags = gobject.SPAWN_SEARCH_PATH result = gobject.spawn_async(args, flags=flags, standard_output=standard_output) + self.pid = result[0] self._stdout = result[2] class MatchboxProcess(Process): @@ -92,6 +93,8 @@ class XephyrProcess(Process): def start(self): Process.start(self) os.environ['DISPLAY'] = ":%d" % (self._display) + os.environ['SUGAR_XEPHYR_PID'] = '%d' % self.pid + class XnestProcess(Process): def __init__(self):