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()
45 int id = at.earliestID();
46 stderr.printf("%d\n", id);
49 string? label = zavai.clock.Alarm.getLabel(id);
51 stdout.printf("generic at job\n");
53 stdout.printf("zavai at job: %s\n", label);
56 zavai.clock.Alarm.schedule("now + 1 hour", "An\"\'\'\n\n\ttani blinda la supercazzola");
61 if (args.length > 1 && args[1] == "notify")
63 stdout.printf("NOTIFY\n");
65 dynamic DBus.Object zav;
67 sbus = DBus.Bus.get(DBus.BusType.SYSTEM);
68 } catch (DBus.Error e) {
69 stderr.printf("Cannot access system DBus bus: %s\n", e.message);
72 // see mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage
73 zav = sbus.get_object(
74 "org.enricozini.zavai",
75 "/org/enricozini/Zavai/Clock",
76 "org.enricozini.zavai.Alarm");
79 stdout.printf("NOTIFY %s\n", args[2]);
88 // Core infrastructure
89 zavai.config = new zavai.Config();
90 zavai.config.argv0 = args[0];
91 zavai.registry = new zavai.Registry();
93 zavai.app = new zavai.Zavai();
94 zavai.registry.register_resource("zavai", zavai.app);
96 // Additional infrastructure
104 zavai.clock.clock.schedule(new zavai.clock.Alarm(123456, "Second"));
105 zavai.clock.clock.schedule(new zavai.clock.Alarm(1234567, "Third"));
106 zavai.clock.clock.schedule(new zavai.clock.Alarm(12345, "First"));
107 zavai.clock.clock.check_alarms();
111 zavai.registry.register_menu("menu.main", new zavai.Menu("Main menu"));
113 var menu_gps = new zavai.Menu("GPS");
114 zavai.registry.register_menu("menu.gps", menu_gps);
115 zavai.registry.getmenu("menu.main").add_applet("menu.gps");
117 var menu_gsm = new zavai.Menu("GSM");
118 zavai.registry.register_menu("menu.gsm", menu_gsm);
119 zavai.registry.getmenu("menu.main").add_applet("menu.gsm");
121 var menu_misc = new zavai.Menu("Misc");
122 zavai.registry.register_menu("menu.misc", menu_misc);
123 zavai.registry.getmenu("menu.main").add_applet("menu.misc");
126 zavai.ui.main.init();
129 zavai.app.run_script(zavai.config.homedir + "/display init");
130 zavai.ui.power.init();
133 zavai.ui.calendar.init();
134 zavai.ui.debug.init();
136 //zavai.app.show_applet("menu.main");
137 zavai.app.show_applet("zavai.status");
140 zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 10, "Test second"));
141 zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 5, "Test first"));
142 zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 300, "Test third"));
145 //zavai.ui.power.power_menu.toggle();
147 // # Shutdown the main loop on SIGINT
148 // def on_kill(signum, frame):
150 // signal.signal(signal.SIGINT, on_kill)
151 // signal.signal(signal.SIGTERM, on_kill)
153 // zavai.info("Starting")
154 // app = registry.resource("app")
155 // app.connect("destroy", gtk.main_quit)
159 dynamic DBus.Object otime = zavai.registry.sbus.get_object(
160 "org.freesmartphone.otimed",
161 "/org/freesmartphone/Time/Alarm",
162 "org.freesmartphone.Time.Alarm");
165 otime.SetAlarm(time_t() + 10);
167 dynamic DBus.Object notification = zavai.registry.sbus.get_object(
168 "org.freesmartphone",
169 "org/freesmartphone/Notification",
170 "org.freesmartphone.Notification");
171 notification.Alarm += on_alarm;
177 // zavai.info("Shutting down")
178 zavai.registry.shutdown();