[gnome-calendar] Marked current month in GcalYearView



commit 3e84d62a8c258153a49460916e6e6d3eb2dfc745
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Fri Nov 30 19:48:02 2012 -0500

    Marked current month in GcalYearView
    
    Added docs about it.

 doc/Views            |    2 ++
 src/gcal-year-view.c |   27 ++++++++++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/doc/Views b/doc/Views
index 551fedf..de1f314 100644
--- a/doc/Views
+++ b/doc/Views
@@ -8,6 +8,8 @@ Here, I'll place some notes about views
    should be marked as is_date views
 
  - For marking current unit:
+   View will draw with selected_color the font of the current unit, so:
+      December, 14, or the hour (in day view) will be drawn in a different color.
    View will provide a two pixels mark for the current unit in every view.
    So:
       week-view will mark the day of week of the current date, no matters
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 91230ce..0b0e84e 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -1031,11 +1031,6 @@ gcal_year_view_draw_grid (GcalYearView *view,
 
   gtk_style_context_restore (context);
 
-  cairo_set_source_rgb (cr,
-                        ligther_color.red,
-                        ligther_color.green,
-                        ligther_color.blue);
-
   /* drawing new-event mark */
   if (priv->start_mark_cell != -1 &&
       priv->end_mark_cell != -1)
@@ -1092,11 +1087,24 @@ gcal_year_view_draw_grid (GcalYearView *view,
       cairo_restore (cr);
     }
 
+  cairo_set_source_rgb (cr,
+                        ligther_color.red,
+                        ligther_color.green,
+                        ligther_color.blue);
+
   /* drawing grid text */
   for (i = 0; i < 2; i++)
     {
       for (j = 0; j < 6; j++)
         {
+          if (priv->date->month == i * 6 + j + 1)
+            {
+              cairo_set_source_rgb (cr,
+                                    selected_color.red,
+                                    selected_color.green,
+                                    selected_color.blue);
+            }
+
           pango_layout_set_text (layout, gcal_get_month_name (i * 6 + j), -1);
           pango_cairo_update_layout (cr, layout);
           pango_layout_get_pixel_size (layout, &font_width, &font_height);
@@ -1105,6 +1113,15 @@ gcal_year_view_draw_grid (GcalYearView *view,
                          (alloc->width / 6) * j + header_padding.left,
                          start_grid_y + padding->top + i * (alloc->height - start_grid_y) / 2);
           pango_cairo_show_layout (cr, layout);
+
+          if (priv->date->month == i * 6 + j + 1)
+            {
+              cairo_set_source_rgb (cr,
+                                    ligther_color.red,
+                                    ligther_color.green,
+                                    ligther_color.blue);
+
+            }
         }
     }
   /* free the layout object */



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