}
}
+public class Next30 : Gtk.ScrolledWindow
+{
+ protected Gtk.ListStore model;
+ protected Gtk.TreeView list;
+
+ public Next30()
+ {
+ set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+ model = new Gtk.ListStore(2, typeof(string), typeof(string));
+ list = new Gtk.TreeView.with_model(model);
+ list.insert_column_with_attributes (-1, "Day", new Gtk.CellRendererText(), "text", 0);
+ list.insert_column_with_attributes (-1, "Notes", new Gtk.CellRendererText(), "text", 1);
+ add(list);
+ }
+
+ public void clear()
+ {
+ model.clear();
+ }
+
+ public void add_day(string day, string notes)
+ {
+ Gtk.TreeIter iter;
+ model.append (out iter);
+ model.set(iter, 0, day);
+ model.set(iter, 1, notes);
+ }
+}
+
public class Calendar : Gtk.VBox
{
protected Gtk.Calendar calendar;
protected FileNotes month_notes;
protected FileNotes day_notes;
protected FileNotes general_notes;
+ protected Next30 next_30;
protected int cur_year;
protected int cur_month;
protected int cur_day;
general_notes = new FileNotes();
general_notes.load(zavai.config.homedir + "/cal/notes.txt");
notebook.append_page(general_notes, new Gtk.Label("General"));
- notebook.append_page(new Gtk.Label("TODO"), new Gtk.Label("Next 30"));
+ next_30 = new Next30();
+ notebook.append_page(next_30, new Gtk.Label("Next 30"));
pack_start(notebook, true, true, 0);
string mpath = month_path(cur_year, cur_month);
month_notes.load(mpath + "/00.txt");
+
+ next_30.clear();
+ Date date = Date();
+ date.set_dmy((DateDay)cur_day, cur_month, (DateYear)cur_year);
+ var buffer = new char[64];
+ for (uint i = 0; i < 30; ++i)
+ {
+ path = day_path(date.get_year(), date.get_month(), date.get_day());
+ string text;
+ if (!FileUtils.test (path, FileTest.IS_REGULAR))
+ text = "";
+ else
+ {
+ try {
+ FileUtils.get_contents(path, out text);
+ } catch (FileError e) {
+ text = "";
+ }
+ }
+ date.strftime(buffer, "%d %a");
+ next_30.add_day((string)buffer, text);
+ date.add_days(1);
+ }
}
public void flush()