2 * zavai - simple interface to the OpenMoko (or to the FSO stack)
4 * Copyright (C) 2009 Enrico Zini <enrico@enricozini.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 //string VERSION = "0.1";
25 static int main (string[] args) {
28 // parser = Parser(usage="usage: %prog [options]",
29 // version="%prog "+ VERSION,
30 // description="Simple interactive interface for the OpenMoko")
31 // parser.add_option("-v", "--verbose", action="store_true", help="verbose mode")
33 // (opts, args) = parser.parse_args()
35 // if not opts.verbose:
38 // # Read configuration
39 // zavai.info("Loading configuration")
40 // conf = zavai.Config()
44 // Core infrastructure
45 zavai.config = new zavai.Config();
46 zavai.registry = new zavai.Registry();
47 zavai.app = new zavai.Zavai();
49 zavai.registry.register_resource("zavai", zavai.app);
51 // Additional infrastructure
59 zavai.clock.clock.schedule(new zavai.clock.Alarm(123456, "Second"));
60 zavai.clock.clock.schedule(new zavai.clock.Alarm(1234567, "Third"));
61 zavai.clock.clock.schedule(new zavai.clock.Alarm(12345, "First"));
62 zavai.clock.clock.check_alarms();
66 zavai.registry.register_menu("menu.main", new zavai.Menu("Main menu"));
68 var menu_gps = new zavai.Menu("GPS");
69 zavai.registry.register_menu("menu.gps", menu_gps);
70 zavai.registry.getmenu("menu.main").add_applet("menu.gps");
72 var menu_gsm = new zavai.Menu("GSM");
73 zavai.registry.register_menu("menu.gsm", menu_gsm);
74 zavai.registry.getmenu("menu.main").add_applet("menu.gsm");
76 var menu_misc = new zavai.Menu("Misc");
77 zavai.registry.register_menu("menu.misc", menu_misc);
78 zavai.registry.getmenu("menu.main").add_applet("menu.misc");
84 zavai.app.run_script(zavai.config.homedir + "/display init");
85 zavai.ui.power.init();
88 zavai.ui.calendar.init();
89 zavai.ui.polygen.init();
90 zavai.ui.debug.init();
92 //zavai.app.show_applet("menu.main");
93 zavai.app.show_applet("zavai.status");
96 zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 10, "Test second"));
97 zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 5, "Test first"));
98 zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 300, "Test third"));
101 //zavai.ui.power.power_menu.toggle();
103 // # Shutdown the main loop on SIGINT
104 // def on_kill(signum, frame):
106 // signal.signal(signal.SIGINT, on_kill)
107 // signal.signal(signal.SIGTERM, on_kill)
109 // zavai.info("Starting")
110 // app = registry.resource("app")
111 // app.connect("destroy", gtk.main_quit)
115 dynamic DBus.Object otime = zavai.registry.sbus.get_object(
116 "org.freesmartphone.otimed",
117 "/org/freesmartphone/Time/Alarm",
118 "org.freesmartphone.Time.Alarm");
121 otime.SetAlarm(time_t() + 10);
123 dynamic DBus.Object notification = zavai.registry.sbus.get_object(
124 "org.freesmartphone",
125 "org/freesmartphone/Notification",
126 "org.freesmartphone.Notification");
127 notification.Alarm += on_alarm;
133 // zavai.info("Shutting down")
134 zavai.registry.shutdown();