[gnome-calendar] year-view: Change week numbers style



commit 1e2a0d1a3d2fce8ea1253dfa15747d1d8bcb18e4
Author: Isaque Galdino <igaldino gmail com>
Date:   Fri Feb 19 20:17:44 2016 -0200

    year-view: Change week numbers style
    
    Week numbers in year view was using a small and very light style and
    that was making difficult for users to be able to read it.
    
    After a few conversation with gnome-design team, they proposed the best
    approach it would be to use the same style as gnome-shell panel does.
    
    The week numbers style was changed to be as close as possible to the
    gnome-shell panel.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759354

 data/theme/gtk-styles.css |    7 +++++--
 src/gcal-year-view.c      |   12 +++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/data/theme/gtk-styles.css b/data/theme/gtk-styles.css
index da62b39..a2b20e1 100644
--- a/data/theme/gtk-styles.css
+++ b/data/theme/gtk-styles.css
@@ -104,8 +104,11 @@ calendar-view.second-view-header {
 }
 
 .year-navigator.week-numbers {
-    color: alpha(@theme_fg_color, 0.2);
-    font: 6;
+    font-size: 70%;
+    font-weight: bold;
+    border-radius: 2px;
+    background-color: alpha(@theme_fg_color, 0.55);
+    color: @theme_bg_color;
 }
 
 /* these two are supposed be changed in sync with .calendar-view */
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 4070f35..3f35de5 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -29,6 +29,7 @@
 #define NAVIGATOR_CELL_HEIGHT 210
 #define SIDEBAR_PREFERRED_WIDTH 200
 #define VISUAL_CLUES_SIDE 3.0
+#define WEEK_NUMBER_PADDING 3.0
 
 typedef struct
 {
@@ -843,11 +844,16 @@ draw_month_grid (GcalYearView *year_view,
 
       pango_layout_set_text (layout, nr_week, -1);
       pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
-      box_padding_top = (box_side - layout_height) / 2 > 0 ? (box_side - layout_height) / 2 : 0;
-      box_padding_start = ((box_side / 2) - layout_width) / 2 > 0 ? ((box_side / 2) - layout_width) / 2 : 0;
+      box_padding_top = (box_side - layout_height) / 2.0 > 0 ? (box_side - layout_height) / 2.0 : 0;
+      box_padding_start = (box_side - layout_width) / 2.0 > 0 ? (box_side - layout_width) / 2.0 : 0;
+
+      gtk_render_background (context, cr,
+                             box_side * (- 0.5) + x + sw * WEEK_NUMBER_PADDING + year_view->k * (8 * 
box_side + WEEK_NUMBER_PADDING * 2),
+                             box_side * (i + 1) + y + WEEK_NUMBER_PADDING,
+                             box_side - WEEK_NUMBER_PADDING * 2, box_side - WEEK_NUMBER_PADDING * 2);
 
       gtk_render_layout (context, cr,
-                         x + sw * box_padding_start + year_view->k * (8 * box_side - layout_width),
+                         box_side * (- 0.5) + x + sw * box_padding_start + year_view->k * (9 * box_side - 
layout_width),
                          box_side * (i + 1) + y + box_padding_top,
                          layout);
 


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