From 588928a94651bca29a5bf36c0298dc39066950e2 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 26 Jun 2014 15:51:52 +0200 Subject: [PATCH] shell: Add support for mixed height list boxes in helper This fixes problems with the networks list boxes in the sharing panel which have mixed heights. --- shell/list-box-helper.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/shell/list-box-helper.c b/shell/list-box-helper.c index 3b4d5a27c..3c68a1d35 100644 --- a/shell/list-box-helper.c +++ b/shell/list-box-helper.c @@ -55,10 +55,17 @@ cc_list_box_adjust_scrolling (GtkListBox *listbox) if (n_rows >= MAX_ROWS_VISIBLE) { - gint row_height; + gint total_row_height = 0; + GList *l; + guint i; - gtk_widget_get_preferred_height (GTK_WIDGET (children->data), &row_height, NULL); - gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled_window), row_height * MAX_ROWS_VISIBLE); + for (l = children, i = 0; l != NULL && i < MAX_ROWS_VISIBLE; l = l->next, i++) { + gint row_height; + gtk_widget_get_preferred_height (GTK_WIDGET (l->data), &row_height, NULL); + total_row_height += row_height; + } + + gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled_window), total_row_height); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); }