Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/Makefile.am14
-rw-r--r--bin/Makefile.in33
-rw-r--r--bin/sugar9
-rw-r--r--bin/sugar-backup11
-rw-r--r--bin/sugar-control-panel6
-rw-r--r--bin/sugar-control-panel.in26
-rw-r--r--bin/sugar-emulator136
-rw-r--r--bin/sugar-emulator.in26
-rw-r--r--bin/sugar-launch17
-rw-r--r--bin/sugar-session170
-rw-r--r--bin/sugar-shell34
-rw-r--r--bin/sugar-shell-service32
-rw-r--r--bin/sugar-shell-service.in32
-rw-r--r--bin/sugar-shell.in34
-rw-r--r--bin/sugar-ui-check161
-rw-r--r--bin/sugar.in18
16 files changed, 509 insertions, 250 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am
index ca6ddef..05a9215 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,14 +1,14 @@
-bin_SCRIPTS = \
- sugar \
+python_scripts = \
sugar-activity \
- sugar-backup \
sugar-control-panel \
sugar-emulator \
sugar-install-bundle \
sugar-launch \
- sugar-shell \
- sugar-shell-service
+ sugar-session \
+ sugar-ui-check
-EXTRA_DIST = $(bin_SCRIPTS) sugar.in
+bin_SCRIPTS = \
+ sugar \
+ $(python_scripts)
-DISTCLEANFILES = sugar
+EXTRA_DIST = $(python_scripts) sugar.in
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 8c1ac15..140a78a 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -32,16 +32,13 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = bin
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/sugar-control-panel.in $(srcdir)/sugar-emulator.in \
- $(srcdir)/sugar-shell-service.in $(srcdir)/sugar-shell.in \
$(srcdir)/sugar.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
-CONFIG_CLEAN_FILES = sugar sugar-control-panel sugar-emulator \
- sugar-shell sugar-shell-service
+CONFIG_CLEAN_FILES = sugar
am__installdirs = "$(DESTDIR)$(bindir)"
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(bin_SCRIPTS)
@@ -71,6 +68,9 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+GCONFTOOL = @GCONFTOOL@
+GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
+GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -185,21 +185,23 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-bin_SCRIPTS = \
- sugar \
+python_scripts = \
sugar-activity \
- sugar-backup \
sugar-control-panel \
sugar-emulator \
sugar-install-bundle \
sugar-launch \
- sugar-shell \
- sugar-shell-service
+ sugar-session \
+ sugar-ui-check
+
+bin_SCRIPTS = \
+ sugar \
+ $(python_scripts)
-EXTRA_DIST = $(bin_SCRIPTS) sugar.in
-DISTCLEANFILES = sugar
+EXTRA_DIST = $(python_scripts) sugar.in
all: all-am
.SUFFIXES:
@@ -234,14 +236,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
sugar: $(top_builddir)/config.status $(srcdir)/sugar.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-sugar-control-panel: $(top_builddir)/config.status $(srcdir)/sugar-control-panel.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-sugar-emulator: $(top_builddir)/config.status $(srcdir)/sugar-emulator.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-sugar-shell: $(top_builddir)/config.status $(srcdir)/sugar-shell.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-sugar-shell-service: $(top_builddir)/config.status $(srcdir)/sugar-shell-service.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@@ -321,7 +315,6 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/bin/sugar b/bin/sugar
deleted file mode 100644
index 88e478a..0000000
--- a/bin/sugar
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-export SUGAR_THEME=sugar-xo
-
-if [ -f /etc/olpc-security ] ; then
- exec dbus-launch --exit-with-session --config-file=/etc/dbus-1/session-olpc.conf sugar-shell
-else
- exec dbus-launch --exit-with-session sugar-shell
-fi
diff --git a/bin/sugar-backup b/bin/sugar-backup
deleted file mode 100644
index c90da63..0000000
--- a/bin/sugar-backup
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import time
-
-i = 0
-while i <= 100:
- time.sleep(0.5)
- sys.stdout.write('%d\n' % i)
- sys.stdout.flush()
- i += 5
diff --git a/bin/sugar-control-panel b/bin/sugar-control-panel
index a440a85..a97e3c0 100644
--- a/bin/sugar-control-panel
+++ b/bin/sugar-control-panel
@@ -17,9 +17,11 @@
import sys
-sys.path.insert(0, '/home/marco/sucrose-0.82/install/share/sugar/shell')
+from jarabe import config
-from controlpanel.cmd import main
+sys.path.append(config.ext_path)
+
+from jarabe.controlpanel.cmd import main
main()
diff --git a/bin/sugar-control-panel.in b/bin/sugar-control-panel.in
deleted file mode 100644
index 922f95c..0000000
--- a/bin/sugar-control-panel.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2008, 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 sys
-
-sys.path.insert(0, '@prefix@/share/sugar/shell')
-
-from controlpanel.cmd import main
-
-main()
-
-
diff --git a/bin/sugar-emulator b/bin/sugar-emulator
index dfc5e9c8..8c0aa8e 100644
--- a/bin/sugar-emulator
+++ b/bin/sugar-emulator
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2008, Red Hat, Inc.
+# Copyright (C) 2006-2008, 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
@@ -15,12 +15,138 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-import sys
+import os
+import random
+import subprocess
+import time
+from optparse import OptionParser
-sys.path.insert(0, '/home/marco/sucrose-0.82/install/share/sugar/shell')
+import gtk
+import gobject
-from emulator import main
+from sugar import env
-main()
+def _run_xephyr(display, dpi, dimensions):
+ cmd = [ 'Xephyr' ]
+ cmd.append(':%d' % display)
+ cmd.append('-ac')
+
+ if dimensions is not None:
+ cmd.append('-screen')
+ cmd.append(dimensions)
+ elif gtk.gdk.screen_width() < 1200 or gtk.gdk.screen_height() < 900:
+ cmd.append('-fullscreen')
+ else:
+ cmd.append('-screen')
+ cmd.append('%dx%d' % (1200, 900))
+
+ if dpi is None:
+ dpi = gtk.settings_get_default().get_property('gtk-xft-dpi') / 1024
+ if dpi > 0:
+ cmd.append('-dpi')
+ cmd.append('%d' % dpi)
+
+ result = gobject.spawn_async(cmd, flags=gobject.SPAWN_SEARCH_PATH)
+ pid = result[0]
+
+ os.environ['DISPLAY'] = ":%d" % (display)
+ os.environ['SUGAR_EMULATOR_PID'] = str(pid)
+
+def _check_xephyr(display):
+ result = subprocess.call(['xdpyinfo', '-display', ':%d' % display],
+ stdout=open(os.devnull, "w"),
+ stderr=open(os.devnull, "w"))
+ return result == 0
+
+def _start_xephyr(dpi, dimensions):
+ # FIXME evil workaround until F10 Xephyr is fixed
+ if os.path.exists('/etc/fedora-release'):
+ if open('/etc/fedora-release').read().startswith('Fedora release 10'):
+ _run_xephyr(random.randint(100, 500), dpi, dimensions)
+ return
+
+ for display in range(100, 110):
+ if not _check_xephyr(display):
+ _run_xephyr(display, dpi, dimensions)
+
+ tries = 10
+ while tries > 0:
+ if _check_xephyr(display):
+ return
+ else:
+ tries -= 1
+ time.sleep(0.1)
+
+def _start_matchbox():
+ cmd = ['matchbox-window-manager']
+
+ cmd.extend(['-use_titlebar', 'no'])
+ cmd.extend(['-theme', 'sugar'])
+
+ gobject.spawn_async(cmd, flags=gobject.SPAWN_SEARCH_PATH)
+
+def _setup_env():
+ os.environ['SUGAR_EMULATOR'] = 'yes'
+ os.environ['GABBLE_LOGFILE'] = os.path.join(
+ env.get_profile_path(), 'logs', 'telepathy-gabble.log')
+ os.environ['SALUT_LOGFILE'] = os.path.join(
+ env.get_profile_path(), 'logs', 'telepathy-salut.log')
+ os.environ['STREAM_ENGINE_LOGFILE'] = os.path.join(
+ env.get_profile_path(), 'logs', 'telepathy-stream-engine.log')
+ path = os.path.join(os.environ.get("HOME"), '.i18n')
+ if os.path.exists(path):
+ fd = open(path, "r")
+ lines = fd.readlines()
+ fd.close()
+ language_env_variable = None
+ lang_env_variable = None
+
+ for line in lines:
+ if line.startswith("LANGUAGE="):
+ lang = line[9:].replace('"', '')
+ language_env_variable = lang.strip()
+ elif line.startswith("LANG="):
+ lang_env_variable = line[5:].replace('"', '')
+
+ # There might be cases where .i18n may not contain a LANGUAGE field
+ if language_env_variable is not None:
+ os.environ['LANGUAGE'] = language_env_variable
+ if lang_env_variable is not None:
+ os.environ['LANG'] = lang_env_variable
+
+def main():
+ """Script-level operations"""
+
+ parser = OptionParser()
+ parser.add_option('-d', '--dpi', dest='dpi', type="int",
+ help='Emulator dpi')
+ parser.add_option('-s', '--scaling', dest='scaling',
+ help='Sugar scaling in %')
+ parser.add_option('-i', '--dimensions', dest='dimensions',
+ help='Emulator dimensions (ex. 1200x900)')
+ (options, args) = parser.parse_args()
+
+ _setup_env()
+
+ _start_xephyr(options.dpi, options.dimensions)
+
+ if options.scaling:
+ os.environ['SUGAR_SCALING'] = options.scaling
+
+ command = ['dbus-launch', 'dbus-launch', '--exit-with-session']
+
+ if not args:
+ command.append('sugar')
+ else:
+ _start_matchbox()
+
+ if args[0].endswith('.py'):
+ command.append('python')
+
+ command.append(args[0])
+
+ os.execlp(*command)
+
+main()
diff --git a/bin/sugar-emulator.in b/bin/sugar-emulator.in
deleted file mode 100644
index 1ee6fc5..0000000
--- a/bin/sugar-emulator.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2008, 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 sys
-
-sys.path.insert(0, '@prefix@/share/sugar/shell')
-
-from emulator import main
-
-main()
-
-
diff --git a/bin/sugar-launch b/bin/sugar-launch
index 7765ff1..68fe613 100644
--- a/bin/sugar-launch
+++ b/bin/sugar-launch
@@ -18,10 +18,11 @@
import os
import sys
+import dbus
from optparse import OptionParser
from sugar.activity import activityfactory
-from sugar.activity.registry import get_registry
+from sugar.bundle.activitybundle import ActivityBundle
usage = "usage: %prog [options] activity"
parser = OptionParser(usage)
@@ -30,15 +31,17 @@ parser.add_option("-d", "--debug", action="store_true", dest="debug",
(options, args) = parser.parse_args()
if len(args) == 0:
- print 'You need to specify the activity name or part of it.'
+ print 'You need to specify the activity bundle_id.'
sys.exit(1)
-registry = get_registry()
-activities = registry.find_activity(args[0])
-if len(activities) == 0:
- print 'Activity not found.'
+bus = dbus.SessionBus()
+proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell')
+path = dbus.Interface(proxy, 'org.laptop.Shell').GetBundlePath(args[0])
+if not path:
+ print 'Cannot find %s bundle.' % args[0]
+ sys.exit(1)
-activity = activities[0]
+activity = ActivityBundle(path)
cmd_args = activityfactory.get_command(activity)
def _which(exec_file):
diff --git a/bin/sugar-session b/bin/sugar-session
new file mode 100644
index 0000000..fc10eb8
--- /dev/null
+++ b/bin/sugar-session
@@ -0,0 +1,170 @@
+#!/usr/bin/env 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 sys
+import time
+
+if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
+ print '%r STARTUP: Starting the shell' % time.time()
+ sys.stdout.flush()
+
+import shutil
+import gettext
+import logging
+
+import gconf
+import gtk
+import gobject
+import dbus.glib
+
+gtk.gdk.threads_init()
+dbus.glib.threads_init()
+
+from sugar import logger
+from sugar import env
+
+from jarabe.desktop.homewindow import HomeWindow
+from jarabe.model import sound
+from jarabe.view import launcher
+from jarabe import intro
+from jarabe import config
+
+def cleanup_logs():
+ """Clean up the log directory, moving old logs into a numbered backup
+ directory. We only keep `_MAX_BACKUP_DIRS` of these backup directories
+ around; the rest are removed."""
+ logs_dir = env.get_logs_path()
+ if not os.path.isdir(logs_dir):
+ os.makedirs(logs_dir)
+
+ backup_logs = []
+ backup_dirs = []
+ for f in os.listdir(logs_dir):
+ path = os.path.join(logs_dir, f)
+ if os.path.isfile(path):
+ backup_logs.append(f)
+ elif os.path.isdir(path):
+ backup_dirs.append(path)
+
+ if len(backup_dirs) > 3:
+ backup_dirs.sort()
+ root = backup_dirs[0]
+ for f in os.listdir(root):
+ os.remove(os.path.join(root, f))
+ os.rmdir(root)
+
+ if len(backup_logs) > 0:
+ name = str(int(time.time()))
+ backup_dir = os.path.join(logs_dir, name)
+ os.mkdir(backup_dir)
+ for log in backup_logs:
+ source_path = os.path.join(logs_dir, log)
+ dest_path = os.path.join(backup_dir, log)
+ os.rename(source_path, dest_path)
+
+def start_ui_service():
+ from jarabe.view.service import UIService
+
+ ui_service = UIService()
+ ui_service.start()
+
+def start_session_manager():
+ from jarabe.model.session import get_session_manager
+
+ session_manager = get_session_manager()
+ session_manager.start()
+
+def unfreeze_dcon_cb():
+ logging.debug('STARTUP: unfreeze_dcon_cb')
+ from jarabe.model import screen
+
+ screen.set_dcon_freeze(0)
+
+def setup_frame_cb():
+ logging.debug('STARTUP: setup_frame_cb')
+ from jarabe import frame
+ frame.get_view()
+
+def setup_keyhandler_cb():
+ logging.debug('STARTUP: setup_keyhandler_cb')
+ from jarabe.view import keyhandler
+ from jarabe import frame
+ keyhandler.setup(frame.get_view())
+
+def setup_journal_cb():
+ logging.debug('STARTUP: setup_journal_cb')
+ from jarabe.journal import journalactivity
+ journalactivity.start()
+
+def show_software_updates_cb(home_window):
+ logging.debug('STARTUP: show_software_updates_cb')
+ if os.path.isfile(os.path.expanduser('~/.sugar-update')):
+ home_window.get_home_box().show_software_updates_alert()
+
+def setup_notification_service_cb():
+ from jarabe.model import notifications
+ notifications.init()
+
+def setup_file_transfer_cb():
+ from jarabe.model import filetransfer
+ filetransfer.init()
+
+def main():
+ cleanup_logs()
+ logger.start('shell')
+
+ intro.check_profile()
+
+ client = gconf.client_get_default()
+ timezone = client.get_string('/desktop/sugar/date/timezone')
+
+ if timezone is not '':
+ os.environ['TZ'] = timezone
+
+ start_ui_service()
+ start_session_manager()
+
+ sound.restore()
+
+ sys.path.append(config.ext_path)
+
+ gettext.bindtextdomain('sugar', config.locale_path)
+ gettext.textdomain('sugar')
+
+ icons_path = os.path.join(config.data_path, 'icons')
+ gtk.icon_theme_get_default().append_search_path(icons_path)
+
+ launcher.setup()
+
+ home_window = HomeWindow()
+ home_window.show()
+
+ gobject.idle_add(unfreeze_dcon_cb)
+ gobject.idle_add(setup_frame_cb)
+ gobject.idle_add(setup_keyhandler_cb)
+ gobject.idle_add(setup_journal_cb)
+ gobject.idle_add(setup_notification_service_cb)
+ gobject.idle_add(setup_file_transfer_cb)
+ gobject.idle_add(show_software_updates_cb, home_window)
+
+ try:
+ gtk.main()
+ except KeyboardInterrupt:
+ print 'Ctrl+C pressed, exiting...'
+
+main()
diff --git a/bin/sugar-shell b/bin/sugar-shell
deleted file mode 100644
index b11c33e..0000000
--- a/bin/sugar-shell
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2008, 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 sys
-
-if os.environ.has_key('SUGAR_THEME'):
- theme = os.environ['SUGAR_THEME']
-else:
- theme = 'sugar'
-
-os.environ['GTK2_RC_FILES'] = '/home/marco/sucrose-0.82/install/share/sugar/data/%s.gtkrc' % theme
-
-sys.path.insert(0, '/home/marco/sucrose-0.82/install/share/sugar/shell')
-
-from main import main
-
-main()
-
-
diff --git a/bin/sugar-shell-service b/bin/sugar-shell-service
deleted file mode 100644
index 5df21a8..0000000
--- a/bin/sugar-shell-service
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2008, 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 sys
-from os import environ
-
-if not environ.has_key('SUGAR_ACTIVITIES'):
- environ['SUGAR_ACTIVITIES'] = '/home/marco/sucrose-0.82/install/share/sugar/activities:' \
- '/home/marco/sucrose-0.82/install/lib64/sugar/activities:' \
- '/home/marco/sucrose-0.82/install/lib/sugar/activities'
-
-sys.path.insert(0, '/home/marco/sucrose-0.82/install/share/sugar/service')
-
-from main import main
-
-main()
-
-
diff --git a/bin/sugar-shell-service.in b/bin/sugar-shell-service.in
deleted file mode 100644
index 49c2764..0000000
--- a/bin/sugar-shell-service.in
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2008, 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 sys
-from os import environ
-
-if not environ.has_key('SUGAR_ACTIVITIES'):
- environ['SUGAR_ACTIVITIES'] = '@prefix@/share/sugar/activities:' \
- '@prefix@/lib64/sugar/activities:' \
- '@prefix@/lib/sugar/activities'
-
-sys.path.insert(0, '@prefix@/share/sugar/service')
-
-from main import main
-
-main()
-
-
diff --git a/bin/sugar-shell.in b/bin/sugar-shell.in
deleted file mode 100644
index 55a25a7..0000000
--- a/bin/sugar-shell.in
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2008, 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 sys
-
-if os.environ.has_key('SUGAR_THEME'):
- theme = os.environ['SUGAR_THEME']
-else:
- theme = 'sugar'
-
-os.environ['GTK2_RC_FILES'] = '@prefix@/share/sugar/data/%s.gtkrc' % theme
-
-sys.path.insert(0, '@prefix@/share/sugar/shell')
-
-from main import main
-
-main()
-
-
diff --git a/bin/sugar-ui-check b/bin/sugar-ui-check
new file mode 100644
index 0000000..4d71796
--- /dev/null
+++ b/bin/sugar-ui-check
@@ -0,0 +1,161 @@
+#!/usr/bin/env python
+# Copyright (C) 2008, 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 logging
+import os
+import sys
+import subprocess
+import time
+
+import dbus
+import gobject
+import gtk
+import wnck
+
+from sugar import wm
+
+from jarabe.model.shell import get_sugar_window_type
+from sugar.bundle.activitybundle import ActivityBundle
+from jarabe import config
+
+checks_queue = []
+checks_failed = []
+checks_succeeded = []
+
+def get_dbus_version():
+ p = subprocess.Popen(['dbus-daemon', '--version'], stdout=subprocess.PIPE)
+
+ output = p.communicate()[0]
+ first_line = output.split('\n')[0]
+
+ return first_line.split(' ')[-1]
+
+class Check(object):
+ def __init__(self):
+ self.name = None
+ self.succeeded = False
+ self.start_time = None
+ self.max_time = None
+ self.timeout = None
+
+ def start(self):
+ logging.info('Start %s check.' % self.name)
+
+ self.start_time = time.time()
+
+ def get_failed(self):
+ if self.max_time and self.start_time:
+ if time.time() - self.start_time > self.max_time:
+ return True
+ return False
+
+ failed = property(get_failed)
+
+class ShellCheck(Check):
+ def __init__(self):
+ Check.__init__(self)
+
+ self.name = 'Shell'
+ self.max_time = 30
+
+ def start(self):
+ Check.start(self)
+
+ screen = wnck.screen_get_default()
+ screen.connect('window-opened', self._window_opened_cb)
+
+ def _window_opened_cb(self, screen, window):
+ if window.get_window_type() == wnck.WINDOW_DESKTOP:
+ self.succeeded = True
+
+class ActivityCheck(Check):
+ def __init__(self, bundle_id):
+ Check.__init__(self)
+
+ self.name = bundle_id
+ self.max_time = 120
+
+ def start(self):
+ Check.start(self)
+
+ self.launch_activity()
+
+ screen = wnck.screen_get_default()
+ screen.connect('window-opened', self._window_opened_cb)
+
+ def launch_activity(self):
+ from sugar.activity import activityfactory
+
+ bus = dbus.SessionBus()
+ proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell')
+ iface = dbus.Interface(proxy, 'org.laptop.Shell')
+ path = iface.GetBundlePath(self.name)
+
+ if path:
+ activityfactory.create(ActivityBundle(path))
+ else:
+ logging.error('Cannot find activity %s.' % self.name)
+
+ def _window_opened_cb(self, screen, window):
+ if wm.get_bundle_id(window) == self.name and \
+ get_sugar_window_type(window) != 'launcher':
+ self.succeeded = True
+
+def _timeout_cb():
+ check = checks_queue[0]
+ if check.failed:
+ logging.info('%s check failed.' % (check.name))
+ checks_failed.append(checks_queue.pop(0))
+ elif check.succeeded:
+ logging.info('%s check succeeded.' % (check.name))
+ checks_succeeded.append(checks_queue.pop(0))
+ else:
+ return True
+
+ if len(checks_queue) > 0:
+ checks_queue[0].start()
+ else:
+ gtk.main_quit()
+
+ return True
+
+def main():
+ os.environ['GTK2_RC_FILES'] = os.path.join(config.data_path, 'sugar-100.gtkrc')
+
+ logging.basicConfig(level=logging.INFO,
+ format='%(asctime)s %(levelname)s %(message)s')
+
+ checks_queue.append(ShellCheck())
+
+ if get_dbus_version() >= '1.2.1':
+ # FIXME needs to get a list of the installed activities
+ checks_queue.append(ActivityCheck('org.laptop.Log'))
+ checks_queue.append(ActivityCheck('org.laptop.Chat'))
+ checks_queue.append(ActivityCheck('org.laptop.WebActivity'))
+ checks_queue.append(ActivityCheck('org.laptop.Pippy'))
+ checks_queue.append(ActivityCheck('org.laptop.Terminal'))
+ checks_queue.append(ActivityCheck('org.laptop.AbiWordActivity'))
+
+ checks_queue[0].start()
+ gobject.timeout_add(500, _timeout_cb)
+
+ gtk.main()
+
+ if len(checks_failed) > 0:
+ sys.exit(1)
+
+main()
diff --git a/bin/sugar.in b/bin/sugar.in
index 88e478a..af7f6b2 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -1,9 +1,17 @@
#!/bin/sh
-export SUGAR_THEME=sugar-xo
+if test -z "$SUGAR_SCALING"; then
+ export SUGAR_SCALING=100
+fi
+
+export GTK2_RC_FILES="@prefix@/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc"
-if [ -f /etc/olpc-security ] ; then
- exec dbus-launch --exit-with-session --config-file=/etc/dbus-1/session-olpc.conf sugar-shell
-else
- exec dbus-launch --exit-with-session sugar-shell
+if ! test -f "$GTK2_RC_FILES"; then
+ echo "sugar: ERROR: Gtk theme for scaling $SUGAR_SCALING not available."
+ exit 1
fi
+
+matchbox-window-manager -use_titlebar no -theme sugar \
+ -kbdconfig @prefix@/share/sugar/data/kbdconfig &
+
+exec sugar-session