[gtk+/wip/matthiasc/calendar] Fix a sizing corner case



commit 1e18a876ea2c59333809024c1b1526c43bd015f6
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 31 16:08:07 2015 -0400

    Fix a sizing corner case

 gtk/gtkdatechooserwidget.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkdatechooserwidget.c b/gtk/gtkdatechooserwidget.c
index b834c61..1be52a2 100644
--- a/gtk/gtkdatechooserwidget.c
+++ b/gtk/gtkdatechooserwidget.c
@@ -476,6 +476,7 @@ gtk_date_chooser_widget_init (GtkDateChooserWidget *calendar)
 {
   gint row, col;
   GDateTime *now;
+  GtkWidget *label;
 
   calendar->show_heading = TRUE;
   calendar->show_day_names = TRUE;
@@ -514,9 +515,19 @@ gtk_date_chooser_widget_init (GtkDateChooserWidget *calendar)
       gtk_grid_attach (GTK_GRID (calendar->grid), calendar->rows[row], -1, row, 1, 1);
     }
 
-  calendar->corner = gtk_label_new ("");
-  gtk_style_context_add_class (gtk_widget_get_style_context (calendar->corner), "weekday");
+  /* We are using a stack here to keep the week number column from shrinking
+   * when all the weeks are single-digit
+   */
+  calendar->corner = gtk_stack_new ();
   gtk_grid_attach (GTK_GRID (calendar->grid), calendar->corner, -1, -1, 1, 1);
+  label = gtk_label_new ("");
+  gtk_widget_show (label);
+  gtk_style_context_add_class (gtk_widget_get_style_context (label), "weekday");
+  gtk_container_add (GTK_CONTAINER (calendar->corner), label);
+
+  label = gtk_label_new ("99");
+  gtk_style_context_add_class (gtk_widget_get_style_context (label), "weeknum");
+  gtk_container_add (GTK_CONTAINER (calendar->corner), label);
 
   calendar->day_grid = gtk_grid_new ();
   gtk_widget_show (calendar->day_grid);


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