[gnome-control-center] shell: Add support for mixed height list boxes in helper



commit 588928a94651bca29a5bf36c0298dc39066950e2
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 26 15:51:52 2014 +0200

    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 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/shell/list-box-helper.c b/shell/list-box-helper.c
index 3b4d5a2..3c68a1d 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);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]