diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index 2b45a31..319ff48 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -266,6 +266,7 @@ mail_shell_sidebar_get_preferred_width (GtkWidget *widget,
 	PangoLayout *layout;
 	PangoRectangle ink_rect;
 	GtkBorder padding;
+	GtkStyleContext *context;
 	gint border;
 	gint sidebar_width;
 	gint screen_width;
@@ -281,7 +282,8 @@ mail_shell_sidebar_get_preferred_width (GtkWidget *widget,
 	pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
 	g_object_unref (layout);
 
-	gtk_style_context_get_padding (gtk_widget_get_style_context (widget), 0, &padding);
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
 
 	screen_width = guess_screen_width (sidebar);
 
