Deleted done items
[gregoa/zavai.git] / src / app_calendar.vala
index 2c0c3cb604f6db7902fd6ba83bd55cd3a807fbd3..e35c2cd687da2d8915d00b4fa7fc358ba04fd848 100644 (file)
@@ -24,68 +24,31 @@ namespace calendar {
 
 public class Calendar : Applet
 {
-       protected Gtk.Calendar calendar;
-       protected Gtk.ScrolledWindow scroll;
-       protected Gtk.TextBuffer text_buffer;
-       protected Gtk.TextView text;
-
-       public Calendar()
-       {
-               _label = "Calendar";
-               calendar = new Gtk.Calendar();
-               calendar.day_selected += on_day_selected;
-               calendar.month_changed += on_month_changed;
-               pack_start(calendar, false, false, 0);
-
-               text_buffer = new Gtk.TextBuffer(null);
-               text = new Gtk.TextView.with_buffer(text_buffer);
-               text.wrap_mode = Gtk.WrapMode.WORD;
-               text.cursor_visible = false;
-               text.editable = false;
-               scroll = new Gtk.ScrolledWindow (null, null);
-               scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
-               scroll.add(text);
-               pack_start(scroll, true, true, 0);
-
-               on_month_changed();
-       }
-
-       private void on_month_changed()
-       {
-               calendar.clear_marks();
-               calendar.mark_day(1);
-       }
-
-       private void on_day_selected()
-       {
-               string day = "%02d/%02d/%04d".printf(calendar.day, calendar.month, calendar.year);
-               text_buffer.text = day;
-               Gtk.TextIter iter;
-               text_buffer.get_iter_at_offset(out iter, 0);
-               Gtk.TextMark mark = text_buffer.create_mark(null, iter, true);
-               text.scroll_mark_onscreen(mark);
-       }
-
-       public override void start()
-       {
-               // Go to current date
-               var now = Time.local(time_t());
-               calendar.year = now.year + 1900;
-               calendar.month = now.month;
-               calendar.day = now.day;
-       }
-       public override void stop()
-       {
-       }
+    protected widgets.Calendar calendar;
+
+    public Calendar()
+    {
+        _label = "Calendar";
+        calendar = new widgets.Calendar();
+        pack_start(calendar, true, true, 0);
+    }
+
+    public override void start()
+    {
+        calendar.show_today();
+    }
+    public override void stop()
+    {
+        calendar.flush();
+    }
 }
 
-Calendar calendar;
+public Calendar calendar;
 
 public void init()
 {
-       calendar = new Calendar();
-        zavai.registry.register_applet("ui.calendar", calendar);
-        zavai.registry.getmenu("menu.misc").add_applet("ui.calendar");
+    calendar = new Calendar();
+    zavai.menu_misc.add_applet(calendar);
 }
 
 }