From cf474cb4a0f3249cd686021e9af11f5394bbfc32 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 21 Nov 2017 18:23:55 +0100 Subject: [PATCH] Bug 790291 - Disallow shrinking message list to zero width --- src/mail/message-list.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mail/message-list.c b/src/mail/message-list.c index 95bb875822..0a1e80e839 100644 --- a/src/mail/message-list.c +++ b/src/mail/message-list.c @@ -2853,6 +2853,22 @@ ml_style_updated_cb (MessageList *message_list) } static void +message_list_get_preferred_width (GtkWidget *widget, + gint *out_minimum_width, + gint *out_natural_width) +{ + /* Chain up to parent's method. */ + GTK_WIDGET_CLASS (message_list_parent_class)->get_preferred_width (widget, out_minimum_width, out_natural_width); + + if (out_minimum_width && *out_minimum_width < 50) + *out_minimum_width = 50; + + if (out_natural_width && out_minimum_width && + *out_natural_width < *out_minimum_width) + *out_natural_width = *out_minimum_width; +} + +static void message_list_set_session (MessageList *message_list, EMailSession *session) { @@ -3552,6 +3568,7 @@ static void message_list_class_init (MessageListClass *class) { GObjectClass *object_class; + GtkWidgetClass *widget_class; if (!ml_drag_info[0].atom) { gint ii; @@ -3571,6 +3588,9 @@ message_list_class_init (MessageListClass *class) g_type_class_add_private (class, sizeof (MessageListPrivate)); + widget_class = GTK_WIDGET_CLASS (class); + widget_class->get_preferred_width = message_list_get_preferred_width; + object_class = G_OBJECT_CLASS (class); object_class->set_property = message_list_set_property; object_class->get_property = message_list_get_property; -- 2.11.4.GIT