Notify trackdir creation
[gregoa/zavai.git] / src / zavai
index 6844cab958b8489f9510d47d97dd4776c1c82243..b1dcfb7152603f66f2c80a7a41aa98b2c4fa6860 100755 (executable)
--- a/src/zavai
+++ b/src/zavai
@@ -28,11 +28,6 @@ import zavai
 
 VERSION="0.1"
 
-def warning(*args):
-    sys.stderr.write(" ".join(map(str, args)) + "\n")
-def info(*args):
-    sys.stderr.write(" ".join(map(str, args)) + "\n")
-
 class Parser(optparse.OptionParser):
     def __init__(self, *args, **kwargs):
         # Yes, in 2009 optparse from the *standard library* still uses old
@@ -51,28 +46,29 @@ parser.add_option("-v", "--verbose", action="store_true", help="verbose mode")
 
 (opts, args) = parser.parse_args()
 
-
 if not opts.verbose:
-    def info(*args):
-        pass
+    zavai.set_quiet()
 
 # Read configuration
-info("Loading configuration")
+zavai.info("Loading configuration")
 conf = zavai.read_config(nick="zavai")
 
 # Set up dbus
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+dbus_system_bus = dbus.SystemBus()
 
 # Set up zavai
 registry = zavai.Registry()
 
 # Register main factories
-registry.register("conf", lambda *args, **kw: conf)
-registry.register("app", zavai.Zavai)
-registry.register("menu", zavai.Menu)
+registry.register(dbus_system_bus, "dbus.system_bus")
+registry.register(conf, "conf")
+registry.register_factory(zavai.Zavai, "app")
+registry.register_factory(zavai.GPS, "gps")
+registry.register_factory(zavai.GPX, "gpx")
 
 # Load plugins
-info("Loading plugins")
+zavai.info("Loading plugins")
 for p in zavai.load_plugins(nick="zavai"):
     try:
         p.init(conf = conf, registry = registry)
@@ -89,12 +85,12 @@ def on_kill(signum, frame):
 signal.signal(signal.SIGINT, on_kill)
 signal.signal(signal.SIGTERM, on_kill)
 
-info("Starting")
+zavai.info("Starting")
 app = registry.resource("app")
 app.connect("destroy", gtk.main_quit)
 app.run()
 
-info("Shutting down")
+zavai.info("Shutting down")
 registry.shutdown()
 
 sys.exit(0)