2 * app_main - zavai main status display
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
28 public class StatusBar : Gtk.HBox
36 public class Clock : Gtk.VBox
38 protected Gtk.Label l_date;
39 protected Gtk.Label l_time;
43 l_date = new Gtk.Label("--");
44 l_date.modify_font(Pango.FontDescription.from_string("Sans 40"));
45 pack_start(l_date, false, false, 0);
46 l_time = new Gtk.Label("--:--");
47 l_time.modify_font(Pango.FontDescription.from_string("Sans 60"));
48 pack_start(l_time, false, false, 0);
50 zavai.clock.clock.minute_changed += on_minute_changed;
52 zavai.clock.clock.request("ui.main.clock");
55 private void on_minute_changed(long ts, zavai.clock.SourceType type)
57 string typetag = "unknown";
60 case zavai.clock.SourceType.GPS:
63 case zavai.clock.SourceType.SYSTEM:
68 var t = Time.local((time_t)ts);
69 l_date.set_text(t.format("%a %d %b"));
70 l_time.set_text("%2d:%02d (%s)".printf(t.hour, t.minute, typetag));
74 public class Status : Applet
76 public Gtk.HBox status_icons;
78 public AppletPushLink menu;
80 public Status(string label)
83 status_icons = new Gtk.HBox(false, 0);
85 menu = new AppletPushLink("menu.main");
87 pack_start(status_icons, false, false, 0);
88 pack_start(clock, false, false, 0);
89 pack_end(menu, false, false, 0);
97 status = new Status("Zavai");
98 zavai.registry.register_applet("zavai.status", status);