--- /dev/null
+diff -ruN paroli.orig/data/paroli-contacts.desktop paroli/data/paroli-contacts.desktop
+--- paroli.orig/data/paroli-contacts.desktop 2009-02-02 14:20:01.000000000 +0100
++++ paroli/data/paroli-contacts.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -1,16 +1,13 @@
+ [Desktop Entry]
+-Name=People
+-Name[fr]=Calculatrice
+-Name[it]=Calcolatrice
+-Name[ru]=Калькулятор
+-Name[sv]=Miniräknare
++GenericName=Contacts
++Name=Contacts
+ Encoding=UTF-8
+ Version=1.0
+-Comment=Paroli Dialer
++Comment=Paroli Contacts
+ StartupNotify=false
+ Exec=dbus-send --system --print-reply --dest=org.tichy.launcher /Launcher org.tichy.Launcher.Launch string:Paroli-Contacts
+-Icon=openmoko-calculator
+-Terminal=true
++Icon=/usr/share/icons/paroli/paroli-contacts.png
++Terminal=false
+ Type=Application
+ SingleInstance=true
+-Categories=GTK;Application;Office;
+\ No newline at end of file
++Categories=Telephony;TelephonyTools
+diff -ruN paroli.orig/data/parolid.desktop paroli/data/parolid.desktop
+--- paroli.orig/data/parolid.desktop 1970-01-01 01:00:00.000000000 +0100
++++ paroli/data/parolid.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -0,0 +1,13 @@
++[Desktop Entry]
++GenericName=Paroli
++Name=Paroli
++Encoding=UTF-8
++Version=1.0
++Comment=Paroli Daemon
++StartupNotify=false
++Exec=parolid
++Icon=/usr/share/icons/paroli/parolid.png
++Terminal=false
++Type=Application
++SingleInstance=true
++Categories=Telephony;TelephonyTools
+diff -ruN paroli.orig/data/paroli-dialer.desktop paroli/data/paroli-dialer.desktop
+--- paroli.orig/data/paroli-dialer.desktop 2009-02-02 14:20:01.000000000 +0100
++++ paroli/data/paroli-dialer.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -1,16 +1,13 @@
+ [Desktop Entry]
+-Name=Tele
+-Name[fr]=Calculatrice
+-Name[it]=Calcolatrice
+-Name[ru]=Калькулятор
+-Name[sv]=Miniräknare
++GenericName=Dialer
++Name=Dialer
+ Encoding=UTF-8
+ Version=1.0
+ Comment=Paroli Dialer
+ StartupNotify=false
+ Exec=dbus-send --system --print-reply --dest=org.tichy.launcher /Launcher org.tichy.Launcher.Launch string:Paroli-Dialer
+-Icon=openmoko-calculator
+-Terminal=true
++Icon=/usr/share/icons/paroli/paroli-dialer.png
++Terminal=false
+ Type=Application
+ SingleInstance=true
+-Categories=GTK;Application;Office;
+\ No newline at end of file
++Categories=Telephony;TelephonyTools
+diff -ruN paroli.orig/data/paroli-i-o.desktop paroli/data/paroli-i-o.desktop
+--- paroli.orig/data/paroli-i-o.desktop 1970-01-01 01:00:00.000000000 +0100
++++ paroli/data/paroli-i-o.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -0,0 +1,13 @@
++[Desktop Entry]
++GenericName=I/O
++Name=I/O
++Encoding=UTF-8
++Version=1.0
++Comment=Paroli I/O
++StartupNotify=false
++Exec=dbus-send --system --print-reply --dest=org.tichy.launcher /Launcher org.tichy.Launcher.Launch string:Paroli-I/O
++Icon=openmoko-calculator
++Terminal=true
++Type=Application
++SingleInstance=true
++Categories=GTK;Application;Office;
+diff -ruN paroli.orig/data/paroli-io.desktop paroli/data/paroli-io.desktop
+--- paroli.orig/data/paroli-io.desktop 2009-02-02 14:20:01.000000000 +0100
++++ paroli/data/paroli-io.desktop 1970-01-01 01:00:00.000000000 +0100
+@@ -1,16 +0,0 @@
+-[Desktop Entry]
+-Name=I/O
+-Name[fr]=Calculatrice
+-Name[it]=Calcolatrice
+-Name[ru]=Калькулятор
+-Name[sv]=Miniräknare
+-Encoding=UTF-8
+-Version=1.0
+-Comment=Paroli I/O
+-StartupNotify=false
+-Exec=dbus-send --system --print-reply --dest=org.tichy.launcher /Launcher org.tichy.Launcher.Launch string:Paroli-I/O
+-Icon=openmoko-calculator
+-Terminal=true
+-Type=Application
+-SingleInstance=true
+-Categories=GTK;Application;Office;
+\ No newline at end of file
+diff -ruN paroli.orig/data/paroli-launcher.desktop paroli/data/paroli-launcher.desktop
+--- paroli.orig/data/paroli-launcher.desktop 2009-02-02 14:20:01.000000000 +0100
++++ paroli/data/paroli-launcher.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -1,11 +1,13 @@
+ [Desktop Entry]
+-Name=PLauncher
+-TryExec=paroli-launcher
+-Icon=tichy
+ GenericName=paroli-launcher
++Name=PLauncher
++Encoding=UTF-8
++Version=1.0
+ Comment=Paroli Launcher
+ StartupNotify=false
+ Exec=paroli-launcher
++Icon=/usr/share/icons/paroli/paroli-launcher.png
+ Terminal=false
+ Type=Application
+-Categories=Office;
++SingleInstance=true
++Categories=Telephony;TelephonyTools
+diff -ruN paroli.orig/data/paroli-msgs.desktop paroli/data/paroli-msgs.desktop
+--- paroli.orig/data/paroli-msgs.desktop 2009-02-02 14:20:01.000000000 +0100
++++ paroli/data/paroli-msgs.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -1,16 +1,13 @@
+ [Desktop Entry]
+-Name=Msgs
+-Name[fr]=Calculatrice
+-Name[it]=Calcolatrice
+-Name[ru]=Калькулятор
+-Name[sv]=Miniräknare
++GenericName=Messages
++Name=Messages
+ Encoding=UTF-8
+ Version=1.0
+ Comment=Paroli Messages
+ StartupNotify=false
+ Exec=dbus-send --system --print-reply --dest=org.tichy.launcher /Launcher org.tichy.Launcher.Launch string:Paroli-Msgs
+-Icon=openmoko-calculator
+-Terminal=true
++Icon=/usr/share/icons/paroli/paroli-msgs.png
++Terminal=false
+ Type=Application
+ SingleInstance=true
+-Categories=GTK;Application;Office;
+\ No newline at end of file
++Categories=Telephony;TelephonyTools
+diff -ruN paroli.orig/data/tele.desktop paroli/data/tele.desktop
+--- paroli.orig/data/tele.desktop 1970-01-01 01:00:00.000000000 +0100
++++ paroli/data/tele.desktop 2009-02-02 14:24:26.000000000 +0100
+@@ -0,0 +1,13 @@
++[Desktop Entry]
++GenericName=Tele
++Name=Tele
++Encoding=UTF-8
++Version=1.0
++Comment=Paroli Tele
++StartupNotify=false
++Exec=dbus-send --system --print-reply --dest=org.tichy.launcher /Launcher org.tichy.Launcher.Launch string:Tele
++Icon=/usr/share/icons/paroli/tele.png
++Terminal=false
++Type=Application
++SingleInstance=true
++Categories=Telephony;TelephonyTools
+diff -ruN paroli.orig/paroli-scripts/paroli paroli/paroli-scripts/paroli
+--- paroli.orig/paroli-scripts/paroli 2009-02-02 14:20:01.000000000 +0100
++++ paroli/paroli-scripts/paroli 1970-01-01 01:00:00.000000000 +0100
+@@ -1,188 +0,0 @@
+-#!/usr/bin/python
+-#
+-# Paroli
+-#
+-# copyright 2008 Openmoko
+-#
+-# This file is part of Paroli.
+-#
+-# Paroli 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 3 of the License, or
+-# (at your option) any later version.
+-#
+-# Paroli 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 Paroli. If not, see <http://www.gnu.org/licenses/>.
+-
+-"""Paroli main script
+-
+-This script will load all the paroli plugins, then init the services,
+-and finally run the application 'Paroli-Launcher'
+-"""
+-
+-# All the needed system modules
+-import sys
+-import os
+-from optparse import OptionParser
+-import ConfigParser
+-import logging
+-
+-# This is to make sure that we use the local tichy lib if run from the
+-# test directory
+-sys.path.insert(0, '../paroli-core/')
+-sys.path.insert(0, '../paroli-graphics-backend/')
+-
+-import tichy
+-
+-logger = logging.getLogger('')
+-
+-
+-def parse_options():
+- """Parse the command line options
+-
+- :Returns: the OptionParser result object
+- """
+- parser = OptionParser()
+- parser.add_option("", "--cfgfile", dest="cfg_file",
+- help="specigy the configuration file to use",
+- metavar="FILE", default=None)
+- parser.add_option("", "--show-services", dest='show_services',
+- action='store_true', default=False,
+- help="print some info about the services and exit")
+-
+- (options, args) = parser.parse_args()
+- return options
+-
+-
+-def setup_logging():
+- """Set up two logging handlers, one in the log file, one in the
+- stdoutput"""
+- logging.basicConfig(
+- level=logging.DEBUG,
+- format='%(asctime)s %(name)-8s %(levelname)-8s %(message)s',
+- filename='/tmp/paroli.log', filemode='w')
+-
+- formatter = logging.Formatter(
+- '%(name)-8s %(levelname)-8s %(message)s')
+- stream_log = logging.StreamHandler()
+- stream_log.setFormatter(formatter)
+- stream_log.setLevel(logging.INFO)
+- logger.addHandler(stream_log)
+-
+-
+-def parse_config(cfg_file=None):
+- """parse the config files
+-
+- We look into 3 locations : first the local dir, then /etc/paroli/,
+- then the home directory
+-
+- :Parameters:
+-
+- cfg_file : str | None
+- the configuartion file to use, or None for default config
+- files
+-
+- :Returns: the ConfigParser object
+- """
+- config = ConfigParser.SafeConfigParser()
+- if not cfg_file:
+- local_path = "./paroli.cfg"
+- system_path = "/etc/paroli/paroli.cfg"
+- home_path = os.path.expanduser("~/.paroli/paroli.cfg")
+- files = [local_path, system_path, home_path]
+- else:
+- files = cfg_file.split(':')
+- for path in files:
+- logger.info("read config file %s", path)
+- config.read(path)
+- return config
+-
+-
+-class InitAll(tichy.Tasklet):
+- """Perform all basic initialization of services"""
+-
+- def run(self):
+- # Register on the GSM Network
+- gsm_service = tichy.Service('GSM')
+- yield gsm_service.init()
+- # Set SIM info
+- gsm_sim = tichy.Service('SIM')
+- yield gsm_sim.set_info()
+- # Get all the contacts
+- contacts = tichy.Service('Contacts')
+- yield contacts.init()
+- messages_service = tichy.Service('Messages')
+- yield messages_service.init()
+-
+- # Finally we can start to listen for incoming calls
+- logger.info("start AutoAnswerCall")
+- yield AutoAnswerCall()
+-
+-class AutoAnswerCall(tichy.Tasklet):
+-
+- def run(self):
+- # We don't create any window, just run in the background...
+- # warning; that would only work with gtk or etk backend...
+- gsm_service = tichy.Service('GSM')
+- while True:
+- call = yield tichy.Wait(gsm_service, 'incoming-call')
+- logger.info("got incoming call")
+- caller_service = tichy.Service('Caller')
+- yield caller_service.call(None, call)
+-
+-
+-if __name__ == '__main__':
+- options = parse_options()
+-
+- setup_logging()
+- config = parse_config(cfg_file=options.cfg_file)
+-
+- logger.info("init gui")
+- tichy.init_gui(None)
+-
+- # We import all the modules into the plugin directory
+- default_plugins_path = '/usr/share/tichy/plugins'
+- plugins_dir = config.get('plugins', 'path', default_plugins_path)
+- plugins_dirs = plugins_dir.split(':')
+- for plugins_dir in plugins_dirs:
+- try:
+- logger.info("try to load plugins in %s", plugins_dir)
+- tichy.plugins.import_all(plugins_dir)
+- except IOError:
+- logger.info("failed to load plugins in %s", plugins_dir)
+-
+- # Set all the default services
+- if config.has_option('services', 'defaults'):
+- defaults = config.get('services', 'defaults').split(',')
+- for default in defaults:
+- if not default:
+- continue
+- service, name = default.strip().split(':')
+- logger.info("set service %s to %s", service, name)
+- tichy.Service.set_default(service, name)
+-
+- if options.show_services:
+- from tichy.service import print_infos
+- print_infos()
+- sys.exit(0)
+-
+- def on_done():
+- """called when the main application quit"""
+- tichy.mainloop.quit()
+-
+- logger.info("start InitAll")
+- InitAll().start()
+-
+- logger.info("start launcher application")
+- launcher = tichy.Application.find_by_name('Paroli-Launcher')
+- # '01' for standalone and advanced-mode
+- launcher(None, '01').start(callback=on_done)
+-
+- logger.info("starting mainloop")
+- tichy.mainloop.run()
+- logger.info("quit")
+diff -ruN paroli.orig/paroli-scripts/parolid paroli/paroli-scripts/parolid
+--- paroli.orig/paroli-scripts/parolid 1970-01-01 01:00:00.000000000 +0100
++++ paroli/paroli-scripts/parolid 2009-02-02 14:20:41.000000000 +0100
+@@ -0,0 +1,289 @@
++#!/usr/bin/python
++#
++# Paroli
++#
++# copyright 2008 Openmoko
++# Guillaume Chereau (charlie@openmoko.org)
++#
++# This file is part of Paroli.
++#
++# Paroli 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 3 of the License, or
++# (at your option) any later version.
++#
++# Paroli 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 Paroli. If not, see <http://www.gnu.org/licenses/>.
++
++"""DBus launcher paroli main script
++
++This script will load all the plugins, then start a DBus server
++listening that we can use to start any application.
++
++It is still experimental.
++
++To use it, start it (./launcher.py), then use for example dbus-send to
++start an application, e.g. : dbus-send --session \
++--dest='org.tichy.launcher' /Launcher --print-reply \
++org.tichy.Launcher.Launch string:Contacts
++
++Note for neo : We need to remember to set DISPLAY=:0 even when we call
++the dbus method !
++"""
++
++#import time
++
++#print time.ctime()
++
++import os
++import sys
++import dbus
++import dbus.service
++from optparse import OptionParser
++import logging
++#import profile
++#print time.ctime()
++
++# This is to make sure that we use the local tichy lib if run from the
++# test directory
++sys.path.insert(0, '../paroli-core/')
++sys.path.insert(0, '../paroli-graphics-backend/')
++
++#def profiling():
++import tichy
++
++#profile.run('profiling()','mirko.txt')
++
++#print time.ctime()
++
++logger = logging.getLogger('')
++
++
++def parse_options():
++ """Parse the command line options
++
++ :Returns: the OptionParser result object
++ """
++ parser = OptionParser()
++ parser.add_option("", "--experimental",
++ action='store_true', dest="experimental",
++ help="Use experimental features",
++ default=False)
++ parser.add_option("", "--session",
++ action='store_const', dest='bus',
++ help="Connect to the session bus",
++ const='session', default='system')
++ parser.add_option("", "--launch", dest='launch',
++ help="launch an applet using DBus",
++ metavar="APPLICATION",
++ default=None)
++ parser.add_option("", "--cfgfile", dest="cfg_file",
++ help="specigy the configuration file to use",
++ metavar="FILE", default=None)
++ parser.add_option("", "--show-services", dest='show_services',
++ action='store_true', default=False,
++ help="print some info about the services and exit")
++
++ (options, args) = parser.parse_args()
++ return options
++
++
++def setup_logging():
++ """Set up two logging handlers, one in the log file, one in the
++ stdoutput"""
++ logging.basicConfig(
++ level=logging.DEBUG,
++ format='%(asctime)s %(name)-8s %(levelname)-8s %(message)s',
++ filename='/tmp/paroli.log', filemode='w')
++
++ formatter = logging.Formatter(
++ '%(filename)s %(lineno)d %(name)-8s %(levelname)-8s %(message)s')
++ stream_log = logging.StreamHandler()
++ stream_log.setFormatter(formatter)
++ stream_log.setLevel(logging.INFO)
++ logger.addHandler(stream_log)
++
++
++class InitAll(tichy.Tasklet):
++ """Perform all basic initialization of services"""
++
++ def run(self):
++
++ storage_service = tichy.Service('TeleCom')
++ #print "storage in p-launcher"
++ yield storage_service.init()
++
++ # Register on the GSM Network
++ gsm_service = tichy.Service('GSM')
++ yield gsm_service.init()
++ # Set SIM info
++ gsm_sim = tichy.Service('SIM')
++ yield gsm_sim.set_info()
++ # Get all the contacts
++ contacts = tichy.Service('Contacts')
++ yield contacts.init()
++ messages_service = tichy.Service('Messages')
++ yield messages_service.init()
++
++ caller_service = tichy.Service('TeleCaller')
++ yield caller_service.init()
++
++ audio_service = tichy.Service('Audio')
++ yield audio_service.init()
++
++ # Finally we can start to listen for incoming calls
++ logger.info("start AutoAnswerCall")
++ yield AutoAnswerCall()
++
++
++class AutoAnswerCall(tichy.Tasklet):
++
++ def run(self):
++ # We don't create any window, just run in the background...
++ # warning; that would only work with gtk or etk backend...
++ gsm_service = tichy.Service('GSM')
++ while True:
++ call = yield tichy.Wait(gsm_service, 'incoming-call')
++ logger.info("got incoming call")
++ caller_service = tichy.Service('TeleCaller')
++ yield caller_service.call("None", call)
++
++
++class Launcher(dbus.service.Object):
++ """Launch applets via DBus call
++
++ example, to launch the Contacts application, using dbus-send :
++ dbus-send --system --dest='org.tichy' /Launcher --print-reply \
++ org.tichy.Launcher.Launch string:Contacts
++ """
++
++ def __init__(self, *args, **kargs):
++ super(Launcher, self).__init__(*args, **kargs)
++ self.screen = None
++ logger.info("registered applications :")
++ for app in tichy.Application.subclasses:
++ if app.name:
++ logger.info("- %s", app.name)
++
++ @dbus.service.method("org.tichy.Launcher", "s")
++ def Launch(self, name):
++ """Launch a registered tichy application by name"""
++ logger.info("launch %s", name)
++ for app in tichy.Application.subclasses:
++ if app.name == name:
++ self.launch(app).start()
++ break
++ else:
++ logger.error("no application named %s", name)
++
++ @tichy.tasklet.tasklet
++ def launch(self, app):
++ """Actually launch the application"""
++ kill_on_close = False
++ if not self.screen:
++ self.screen = self.create_screen()
++ kill_on_close = False
++ try:
++ yield app(None)
++ except Exception, ex:
++ logger.error("application %s failed : %s", app.name, ex)
++ import traceback
++ logger.error(traceback.format_exc())
++ if kill_on_close:
++ self.screen.destroy()
++ self.screen = None
++
++ def create_screen(self):
++ #window = tichy.gui.Window(480,580)
++ #window.show()
++ window = None
++ return window
++
++ @dbus.service.method("org.tichy.Launcher")
++ def Quit(self):
++ """Quit tichy"""
++ logger.info("quit mainloop")
++ tichy.mainloop.quit()
++
++
++def launch(name, options):
++ """Use dbus to call the launcher"""
++ if options.bus == 'system':
++ bus = dbus.SystemBus()
++ else:
++ bus = dbus.SessionBus()
++ launcher = bus.get_object('org.tichy.launcher', '/Launcher')
++ launcher = dbus.Interface(launcher, 'org.tichy.Launcher')
++ launcher.Launch(options.launch)
++
++
++if __name__ == '__main__':
++ options = parse_options()
++
++ if options.launch:
++ launch(options.launch, options)
++ sys.exit(0)
++
++ setup_logging()
++ tichy.config.parse(cfg_file=options.cfg_file)
++
++ logger.info("init gui")
++ tichy.init_gui(None)
++
++ # We import all the modules into the plugin directory
++ default_plugins_path = '/usr/share/tichy/plugins'
++ plugins_dir = tichy.config.get('plugins', 'path', default_plugins_path)
++ plugins_dirs = plugins_dir.split(':')
++ for plugins_dir in plugins_dirs:
++ print plugins_dir
++ try:
++ logger.info("try to load plugins in %s", plugins_dir)
++ tichy.plugins.import_all(plugins_dir)
++ except IOError:
++ logger.info("failed to load plugins in %s", plugins_dir)
++
++ # Set all the default services
++ defaults = tichy.config.get('services', 'defaults', None)
++ if defaults:
++ defaults = defaults.split(',')
++ for default in defaults:
++ if not default:
++ continue
++ service, name = default.strip().split(':')
++ logger.info("set service %s to %s", service, name)
++ tichy.Service.set_default(service, name)
++
++ if options.show_services:
++ from tichy.service import print_infos
++ print_infos()
++ sys.exit(0)
++ if tichy.config.getboolean('dbus','activated', False):
++ logger.info("connect to dbus")
++ if options.bus == 'system':
++ bus = dbus.SystemBus(mainloop=tichy.mainloop.dbus_loop)
++ else:
++ bus = dbus.SessionBus(mainloop=tichy.mainloop.dbus_loop)
++ bus_name = dbus.service.BusName('org.tichy.launcher', bus)
++
++ logger.info("start launcher service")
++ launcher = Launcher(bus, '/Launcher')
++
++ logger.info("start InitAll")
++ InitAll().start()
++
++ app_name = tichy.config.get('autolaunch', 'application', None)
++ if app_name:
++ standalone = tichy.config.getboolean('standalone', 'activated', False)
++ for app in tichy.Application.subclasses:
++ if app.name == app_name:
++ app("None", standalone=standalone).start()
++
++
++ logger.info("starting mainloop")
++ tichy.mainloop.run()
++ logger.info("quit")
+diff -ruN paroli.orig/paroli-scripts/paroli-launcher paroli/paroli-scripts/paroli-launcher
+--- paroli.orig/paroli-scripts/paroli-launcher 2009-02-02 14:20:01.000000000 +0100
++++ paroli/paroli-scripts/paroli-launcher 1970-01-01 01:00:00.000000000 +0100
+@@ -1,289 +0,0 @@
+-#!/usr/bin/python
+-#
+-# Paroli
+-#
+-# copyright 2008 Openmoko
+-# Guillaume Chereau (charlie@openmoko.org)
+-#
+-# This file is part of Paroli.
+-#
+-# Paroli 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 3 of the License, or
+-# (at your option) any later version.
+-#
+-# Paroli 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 Paroli. If not, see <http://www.gnu.org/licenses/>.
+-
+-"""DBus launcher paroli main script
+-
+-This script will load all the plugins, then start a DBus server
+-listening that we can use to start any application.
+-
+-It is still experimental.
+-
+-To use it, start it (./launcher.py), then use for example dbus-send to
+-start an application, e.g. : dbus-send --session \
+---dest='org.tichy.launcher' /Launcher --print-reply \
+-org.tichy.Launcher.Launch string:Contacts
+-
+-Note for neo : We need to remember to set DISPLAY=:0 even when we call
+-the dbus method !
+-"""
+-
+-#import time
+-
+-#print time.ctime()
+-
+-import os
+-import sys
+-import dbus
+-import dbus.service
+-from optparse import OptionParser
+-import logging
+-#import profile
+-#print time.ctime()
+-
+-# This is to make sure that we use the local tichy lib if run from the
+-# test directory
+-sys.path.insert(0, '../paroli-core/')
+-sys.path.insert(0, '../paroli-graphics-backend/')
+-
+-#def profiling():
+-import tichy
+-
+-#profile.run('profiling()','mirko.txt')
+-
+-#print time.ctime()
+-
+-logger = logging.getLogger('')
+-
+-
+-def parse_options():
+- """Parse the command line options
+-
+- :Returns: the OptionParser result object
+- """
+- parser = OptionParser()
+- parser.add_option("", "--experimental",
+- action='store_true', dest="experimental",
+- help="Use experimental features",
+- default=False)
+- parser.add_option("", "--session",
+- action='store_const', dest='bus',
+- help="Connect to the session bus",
+- const='session', default='system')
+- parser.add_option("", "--launch", dest='launch',
+- help="launch an applet using DBus",
+- metavar="APPLICATION",
+- default=None)
+- parser.add_option("", "--cfgfile", dest="cfg_file",
+- help="specigy the configuration file to use",
+- metavar="FILE", default=None)
+- parser.add_option("", "--show-services", dest='show_services',
+- action='store_true', default=False,
+- help="print some info about the services and exit")
+-
+- (options, args) = parser.parse_args()
+- return options
+-
+-
+-def setup_logging():
+- """Set up two logging handlers, one in the log file, one in the
+- stdoutput"""
+- logging.basicConfig(
+- level=logging.DEBUG,
+- format='%(asctime)s %(name)-8s %(levelname)-8s %(message)s',
+- filename='/tmp/paroli.log', filemode='w')
+-
+- formatter = logging.Formatter(
+- '%(filename)s %(lineno)d %(name)-8s %(levelname)-8s %(message)s')
+- stream_log = logging.StreamHandler()
+- stream_log.setFormatter(formatter)
+- stream_log.setLevel(logging.INFO)
+- logger.addHandler(stream_log)
+-
+-
+-class InitAll(tichy.Tasklet):
+- """Perform all basic initialization of services"""
+-
+- def run(self):
+-
+- storage_service = tichy.Service('TeleCom')
+- #print "storage in p-launcher"
+- yield storage_service.init()
+-
+- # Register on the GSM Network
+- gsm_service = tichy.Service('GSM')
+- yield gsm_service.init()
+- # Set SIM info
+- gsm_sim = tichy.Service('SIM')
+- yield gsm_sim.set_info()
+- # Get all the contacts
+- contacts = tichy.Service('Contacts')
+- yield contacts.init()
+- messages_service = tichy.Service('Messages')
+- yield messages_service.init()
+-
+- caller_service = tichy.Service('TeleCaller')
+- yield caller_service.init()
+-
+- audio_service = tichy.Service('Audio')
+- yield audio_service.init()
+-
+- # Finally we can start to listen for incoming calls
+- logger.info("start AutoAnswerCall")
+- yield AutoAnswerCall()
+-
+-
+-class AutoAnswerCall(tichy.Tasklet):
+-
+- def run(self):
+- # We don't create any window, just run in the background...
+- # warning; that would only work with gtk or etk backend...
+- gsm_service = tichy.Service('GSM')
+- while True:
+- call = yield tichy.Wait(gsm_service, 'incoming-call')
+- logger.info("got incoming call")
+- caller_service = tichy.Service('TeleCaller')
+- yield caller_service.call("None", call)
+-
+-
+-class Launcher(dbus.service.Object):
+- """Launch applets via DBus call
+-
+- example, to launch the Contacts application, using dbus-send :
+- dbus-send --system --dest='org.tichy' /Launcher --print-reply \
+- org.tichy.Launcher.Launch string:Contacts
+- """
+-
+- def __init__(self, *args, **kargs):
+- super(Launcher, self).__init__(*args, **kargs)
+- self.screen = None
+- logger.info("registered applications :")
+- for app in tichy.Application.subclasses:
+- if app.name:
+- logger.info("- %s", app.name)
+-
+- @dbus.service.method("org.tichy.Launcher", "s")
+- def Launch(self, name):
+- """Launch a registered tichy application by name"""
+- logger.info("launch %s", name)
+- for app in tichy.Application.subclasses:
+- if app.name == name:
+- self.launch(app).start()
+- break
+- else:
+- logger.error("no application named %s", name)
+-
+- @tichy.tasklet.tasklet
+- def launch(self, app):
+- """Actually launch the application"""
+- kill_on_close = False
+- if not self.screen:
+- self.screen = self.create_screen()
+- kill_on_close = False
+- try:
+- yield app(None)
+- except Exception, ex:
+- logger.error("application %s failed : %s", app.name, ex)
+- import traceback
+- logger.error(traceback.format_exc())
+- if kill_on_close:
+- self.screen.destroy()
+- self.screen = None
+-
+- def create_screen(self):
+- #window = tichy.gui.Window(480,580)
+- #window.show()
+- window = None
+- return window
+-
+- @dbus.service.method("org.tichy.Launcher")
+- def Quit(self):
+- """Quit tichy"""
+- logger.info("quit mainloop")
+- tichy.mainloop.quit()
+-
+-
+-def launch(name, options):
+- """Use dbus to call the launcher"""
+- if options.bus == 'system':
+- bus = dbus.SystemBus()
+- else:
+- bus = dbus.SessionBus()
+- launcher = bus.get_object('org.tichy.launcher', '/Launcher')
+- launcher = dbus.Interface(launcher, 'org.tichy.Launcher')
+- launcher.Launch(options.launch)
+-
+-
+-if __name__ == '__main__':
+- options = parse_options()
+-
+- if options.launch:
+- launch(options.launch, options)
+- sys.exit(0)
+-
+- setup_logging()
+- tichy.config.parse(cfg_file=options.cfg_file)
+-
+- logger.info("init gui")
+- tichy.init_gui(None)
+-
+- # We import all the modules into the plugin directory
+- default_plugins_path = '/usr/share/tichy/plugins'
+- plugins_dir = tichy.config.get('plugins', 'path', default_plugins_path)
+- plugins_dirs = plugins_dir.split(':')
+- for plugins_dir in plugins_dirs:
+- print plugins_dir
+- try:
+- logger.info("try to load plugins in %s", plugins_dir)
+- tichy.plugins.import_all(plugins_dir)
+- except IOError:
+- logger.info("failed to load plugins in %s", plugins_dir)
+-
+- # Set all the default services
+- defaults = tichy.config.get('services', 'defaults', None)
+- if defaults:
+- defaults = defaults.split(',')
+- for default in defaults:
+- if not default:
+- continue
+- service, name = default.strip().split(':')
+- logger.info("set service %s to %s", service, name)
+- tichy.Service.set_default(service, name)
+-
+- if options.show_services:
+- from tichy.service import print_infos
+- print_infos()
+- sys.exit(0)
+- if tichy.config.getboolean('dbus','activated', False):
+- logger.info("connect to dbus")
+- if options.bus == 'system':
+- bus = dbus.SystemBus(mainloop=tichy.mainloop.dbus_loop)
+- else:
+- bus = dbus.SessionBus(mainloop=tichy.mainloop.dbus_loop)
+- bus_name = dbus.service.BusName('org.tichy.launcher', bus)
+-
+- logger.info("start launcher service")
+- launcher = Launcher(bus, '/Launcher')
+-
+- logger.info("start InitAll")
+- InitAll().start()
+-
+- app_name = tichy.config.get('autolaunch', 'application', None)
+- if app_name:
+- standalone = tichy.config.getboolean('standalone', 'activated', False)
+- for app in tichy.Application.subclasses:
+- if app.name == app_name:
+- app("None", standalone=standalone).start()
+-
+-
+- logger.info("starting mainloop")
+- tichy.mainloop.run()
+- logger.info("quit")
+diff -ruN paroli.orig/setup.py paroli/setup.py
+--- paroli.orig/setup.py 2009-02-02 14:20:01.000000000 +0100
++++ paroli/setup.py 2009-02-02 14:33:41.000000000 +0100
+@@ -84,14 +84,15 @@
+ author_email='mirko@openmoko.org',
+ package_dir = {'': 'paroli-core'},
+ packages = ['tichy', 'tichy.gui_paroli'],
+- scripts= ['paroli-scripts/paroli-launcher'],
++ scripts= ['paroli-scripts/parolid'],
+ # XXX: Those locations may not work on the neo !
+ data_files = [('applications',
+- ['data/paroli-launcher.desktop',
+- 'data/paroli-io.desktop',
++ ['data/parolid.desktop',
++ 'data/paroli-i-o.desktop',
+ 'data/paroli-contacts.desktop',
+ 'data/paroli-msgs.desktop',
+- 'data/paroli-dialer.desktop']),
++ 'data/paroli-dialer.desktop',
++ 'data/tele.desktop']),
+ (os.path.join(sys.prefix, 'share/pixmaps/'),
+ ['data/tichy']),
+ ('../../etc/paroli/', ['data/paroli.cfg'])] \