Show the number of unacknowledged log entries
authorEnrico Zini <enrico@enricozini.org>
Sat, 27 Mar 2010 22:23:44 +0000 (22:23 +0000)
committerEnrico Zini <enrico@enricozini.org>
Sat, 27 Mar 2010 22:23:44 +0000 (22:23 +0000)
src/app_main.vala

index c8933c251ef54c7cd699b4f768eb38322e34055b..5eb37fa5fb43f1278e5d5c8fb43cabcf3dfe7d2d 100644 (file)
@@ -43,6 +43,7 @@ public class Clock : Gtk.VBox
     protected zavai.clock.SourceType last_time_type;
     protected time_t last_deadline;
     protected string last_deadline_label;
+    protected Log log;
 
     construct
     {
@@ -66,6 +67,9 @@ public class Clock : Gtk.VBox
         l_deadline.set_justify(Gtk.Justification.CENTER);
         pack_start(l_deadline, false, false, 0);
 
+        log = new Log();
+        pack_start(log, false, false, 0);
+
         zavai.clock.clock.minute_changed += on_minute_changed;
         zavai.clock.clock.schedule_changed += on_schedule_changed;
         on_schedule_changed(zavai.clock.clock.next_alarm());
@@ -407,6 +411,44 @@ public class AddRelativeDeadline : AddDeadline
     }
 }
 
+public class Log : Gtk.VBox
+{
+    protected Gtk.Label l_info;
+    protected Gtk.Button l_info_button;
+
+    construct
+    {
+        l_info = new Gtk.Label("");
+        // l_info.modify_font(Pango.FontDescription.from_string("Sans 60"));
+        pack_start(l_info, false, false, 0);
+
+        l_info_button = new Gtk.Button();
+        l_info_button.set_image(l_info);
+        l_info_button.relief = Gtk.ReliefStyle.NONE;
+        // l_info_button.clicked += on_date_clicked;
+        pack_start(l_info_button, false, false, 0);
+
+        //zavai.clock.clock.minute_changed += on_minute_changed;
+        //zavai.clock.clock.schedule_changed += on_schedule_changed;
+        //on_schedule_changed(zavai.clock.clock.next_alarm());
+
+        //zavai.clock.clock.request("ui.main.clock");
+        refresh();
+    }
+
+    public void refresh()
+    {
+        int count = 0;
+        zavai.log.log.list_entries((d, f) => {
+            ++count;
+            return true;
+        });
+        l_info.set_text("%d log entries".printf(count));
+        l_info_button.set_sensitive(count != 0);
+        //zavai.log.Log l = zavai.log.log.load(args[2]);
+    }
+}
+
 /*
 public class AddDailyDeadline : Applet
 {