[gtk/wip/baedert/for-master: 2/5] calendar: Try to avoid changing size when changing the year
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 2/5] calendar: Try to avoid changing size when changing the year
- Date: Tue, 4 Feb 2020 16:27:46 +0000 (UTC)
commit 2fb1ad250a3fe7ed8963ae19c63d33f1584ede5d
Author: Timm Bäder <mail baedert org>
Date: Tue Feb 4 12:29:54 2020 +0100
calendar: Try to avoid changing size when changing the year
gtk/gtkcalendar.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 8ae3086945..289d2b769e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -655,6 +655,7 @@ gtk_calendar_init (GtkCalendar *calendar)
#endif
GdkContentFormats *formats;
GtkDropTarget *dest;
+ int min_year_width;
gtk_widget_set_can_focus (widget, TRUE);
@@ -776,6 +777,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]