[california/wip/725767-week] Show month numbers in month view (regression)



commit 4fcf50d8a202c344d94bfab2086da5be6c25fb12
Author: Jim Nelson <jim yorba org>
Date:   Thu May 22 11:54:35 2014 -0700

    Show month numbers in month view (regression)

 src/view/common/common-events-cell.vala |   12 ++++++++----
 src/view/month/month-cell.vala          |    5 +++--
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/view/common/common-events-cell.vala b/src/view/common/common-events-cell.vala
index 45dddcc..a6cc26b 100644
--- a/src/view/common/common-events-cell.vala
+++ b/src/view/common/common-events-cell.vala
@@ -14,7 +14,7 @@ namespace California.View.Common {
 internal abstract class EventsCell : Gtk.EventBox {
     public const string PROP_DATE = "date";
     public const string PROP_NEIGHBORS = "neighbors";
-    public const string PROP_TOP_LINE = "top-line";
+    public const string PROP_TOP_LINE_TEXT = "top-line-text";
     public const string PROP_TOP_LINE_RGBA = "top-line-rgba";
     public const string PROP_SELECTED = "selected";
     
@@ -61,7 +61,11 @@ internal abstract class EventsCell : Gtk.EventBox {
     /**
      * Color of { link top_line_text}.
      */
-    public Gdk.RGBA top_line_rgba { get; set; }
+    private Gdk.RGBA _top_line_rgba = Gdk.RGBA();
+    public Gdk.RGBA top_line_rgba {
+        get { return _top_line_rgba; }
+        set { _top_line_rgba = value; queue_draw(); }
+    }
     
     // to avoid lots of redraws, only queue_draw() if set changes value
     private bool _selected = false;
@@ -97,8 +101,7 @@ internal abstract class EventsCell : Gtk.EventBox {
         // class
         add(canvas);
         
-        notify[PROP_TOP_LINE].connect(queue_draw);
-        notify[PROP_TOP_LINE_RGBA].connect(queue_draw);
+        notify[PROP_TOP_LINE_TEXT].connect(queue_draw);
         
         Palette.instance.palette_changed.connect(queue_draw);
         Calendar.System.instance.is_24hr_changed.connect(on_24hr_changed);
@@ -583,6 +586,7 @@ internal abstract class EventsCell : Gtk.EventBox {
         int right_text_margin = Palette.TEXT_MARGIN_PX + (right_effect != CapEffect.NONE ? 3 : 0);
         
         Pango.Layout layout = create_pango_layout(text);
+        // Use normal font for very top line, small font for all others (see get_line_top_y())
         layout.set_font_description((line_number < 0)
             ? Palette.instance.normal_font
             : Palette.instance.small_font);
diff --git a/src/view/month/month-cell.vala b/src/view/month/month-cell.vala
index ed41744..cc21f3a 100644
--- a/src/view/month/month-cell.vala
+++ b/src/view/month/month-cell.vala
@@ -27,12 +27,14 @@ internal class Cell : Common.EventsCell {
         notify[PROP_DATE].connect(update_top_line);
         
         owner.notify[Grid.PROP_FIRST_OF_WEEK].connect(on_first_of_week_changed);
+        owner.owner.notify[Controller.PROP_SHOW_OUTSIDE_MONTH].connect(update_top_line);
         
         update_top_line();
     }
     
     ~Cell() {
         owner.notify[Grid.PROP_FIRST_OF_WEEK].disconnect(on_first_of_week_changed);
+        owner.owner.notify[Controller.PROP_SHOW_OUTSIDE_MONTH].disconnect(update_top_line);
     }
     
     protected override Common.EventsCell? get_cell_for_date(Calendar.Date cell_date) {
@@ -72,14 +74,13 @@ internal class Cell : Common.EventsCell {
     }
     
     private void update_top_line() {
-         if (owner.owner.show_outside_month) {
+         if (!owner.owner.show_outside_month && !(date in owner.month_of_year)) {
             top_line_text = null;
             
             return;
         }
         
         top_line_text = date.day_of_month.informal_number;
-        
         top_line_rgba = (date in owner.month_of_year)
             ? Palette.instance.day_in_range
             : Palette.instance.day_outside_range;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]