Implemented month notes
authorEnrico Zini <enrico@enricozini.org>
Fri, 6 Nov 2009 23:30:54 +0000 (23:30 +0000)
committerEnrico Zini <enrico@enricozini.org>
Fri, 6 Nov 2009 23:30:54 +0000 (23:30 +0000)
src/widgets/calendar.vala

index d27a91c245d12878ca7b95f90779f21f12e6a8c6..f9046bfaefa9d18242cece8af24a4e0b8539a74c 100644 (file)
@@ -106,6 +106,7 @@ public class Calendar : Gtk.VBox
 {
        protected Gtk.Calendar calendar;
        protected Gtk.Notebook notebook;
+       protected FileNotes month_notes;
        protected FileNotes day_notes;
        protected int cur_year;
        protected int cur_month;
@@ -123,6 +124,8 @@ public class Calendar : Gtk.VBox
 
                day_notes = new FileNotes();
                notebook.append_page(day_notes, new Gtk.Label("Day notes"));
+               month_notes = new FileNotes();
+               notebook.append_page(month_notes, new Gtk.Label("Month notes"));
 
                pack_start(notebook, true, true, 0);
 
@@ -146,6 +149,7 @@ public class Calendar : Gtk.VBox
                flush();
                calendar.clear_marks();
                string mpath = month_path(calendar.year, calendar.month + 1);
+               month_notes.load(mpath + "/00.txt");
                Dir dir;
                try {
                        dir = Dir.open(mpath);
@@ -166,15 +170,21 @@ public class Calendar : Gtk.VBox
 
        private void on_day_selected()
        {
-               flush();
-               cur_year = calendar.year; cur_month = calendar.month + 1; cur_day = calendar.day;
+               cur_year = calendar.year;
+               cur_month = calendar.month + 1;
+               cur_day = calendar.day;
+
                string path = day_path(cur_year, cur_month, cur_day);
                day_notes.load(path);
+
+               string mpath = month_path(cur_year, cur_month);
+               month_notes.load(mpath + "/00.txt");
        }
 
        public void flush()
        {
                day_notes.save();
+               month_notes.save();
        }
 
        public void show_today()