summaryrefslogtreecommitdiff
path: root/gtk/gtkcalendar.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-02-04 12:29:54 +0100
committerMatthias Clasen <mclasen@redhat.com>2020-02-07 13:16:32 -0500
commita437162f6d80fe737150e2b909e331ee1de9b78a (patch)
tree14acfe1517f718a90e8d31e672f98aaad55453b5 /gtk/gtkcalendar.c
parent9ecd448682d61e4814ea2519cc3d93c84729c4ea (diff)
downloadgtk+-a437162f6d80fe737150e2b909e331ee1de9b78a.tar.gz
calendar: Try to avoid changing size when changing the year
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r--gtk/gtkcalendar.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 20b3d6f0c1..80d99b1e6a 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -652,6 +652,7 @@ gtk_calendar_init (GtkCalendar *calendar)
#endif
GdkContentFormats *formats;
GtkDropTarget *dest;
+ int min_year_width;
gtk_widget_set_can_focus (widget, TRUE);
@@ -773,6 +774,12 @@ gtk_calendar_init (GtkCalendar *calendar)
set_month (calendar, tm->tm_mon);
set_year (calendar, 1900 + tm->tm_year);
+ /* We just initialized the year label, now add some space to it so
+ * changing the year does not increase the calendar width */
+ gtk_widget_measure (priv->year_label, GTK_ORIENTATION_HORIZONTAL, -1,
+ &min_year_width, NULL, NULL, NULL);
+ gtk_widget_set_size_request (priv->year_label, min_year_width + 10, -1);
+
for (i=0;i<31;i++)
priv->marked_date[i] = FALSE;