Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.4715
diff -u -r1.4715 ChangeLog
--- ChangeLog	14 Dec 2003 02:20:13 -0000	1.4715
+++ ChangeLog	14 Dec 2003 16:21:01 -0000
@@ -1,3 +1,23 @@
+2003-12-14  Jan Arne Petersen  <jpetersen@uni-bonn.de>
+
+	Add visible_rows property (the number of visible rows in a tree view
+	which is embedded in a scrolled window) to GtkTreeView (#129318).
+
+	* gtk/gtktreeview.c: (gtk_tree_view_class_init),
+	(gtk_tree_view_init), (gtk_tree_view_set_property),
+	(gtk_tree_view_get_property): add visible_rows property.
+	(gtk_tree_view_size_request_columns): compute maximum cell_height.
+	(gtk_tree_view_size_request): set aux_info->height which is used
+	by GtkScrolledWindow to determine the minimum child size.
+	(gtk_tree_view_set_visible_rows), (gtk_tree_view_get_visible_rows):
+	add gtk_tree_view_[sg]et_visible_rows methods.
+
+	* gtk/gtktreeview.h: add gtk_tree_view_[sg]et_visible_rows methods.
+
+	* gtk/gtktreeprivate.h: add visible_rows and cell_height to the
+	GtkTreeViewPrivate structure.
+
+
 2003-12-14  Tor Lillqvist  <tml@iki.fi>
 
 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be
Index: gtk/gtktreeprivate.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeprivate.h,v
retrieving revision 1.58
diff -u -r1.58 gtktreeprivate.h
--- gtk/gtktreeprivate.h	9 Sep 2003 23:13:38 -0000	1.58
+++ gtk/gtktreeprivate.h	14 Dec 2003 16:21:02 -0000
@@ -206,6 +206,10 @@
   GtkTreeViewSearchEqualFunc search_equal_func;
   gpointer search_user_data;
   GtkDestroyNotify search_destroy;
+
+  /* visible rows in a ScrolledWindow */
+  gint visible_rows;
+  gint cell_height;
 };
 
 /* cool ABI compat hack */
Index: gtk/gtktreeview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.c,v
retrieving revision 1.343
diff -u -r1.343 gtktreeview.c
--- gtk/gtktreeview.c	29 Nov 2003 06:16:11 -0000	1.343
+++ gtk/gtktreeview.c	14 Dec 2003 16:21:22 -0000
@@ -122,7 +122,8 @@
   PROP_REORDERABLE,
   PROP_RULES_HINT,
   PROP_ENABLE_SEARCH,
-  PROP_SEARCH_COLUMN
+  PROP_SEARCH_COLUMN,
+  PROP_VISIBLE_ROWS
 };
 
 static void     gtk_tree_view_class_init           (GtkTreeViewClass *klass);
@@ -597,6 +598,16 @@
 						       0,
 						       G_PARAM_READWRITE));
 
+    g_object_class_install_property (o_class,
+				     PROP_VISIBLE_ROWS,
+				     g_param_spec_int ("visible_rows",
+						       _("Visible rows"),
+						       _("The number of visible rows in a tree view which is embedded in a scrolled window"),
+						       0,
+						       G_MAXINT,
+						       0,
+						       G_PARAM_READWRITE));
+
   /* Style properties */
 #define _TREE_VIEW_EXPANDER_SIZE 10
 #define _TREE_VIEW_VERTICAL_SEPARATOR 2
@@ -1035,6 +1046,7 @@
   tree_view->priv->search_column = -1;
   tree_view->priv->search_dialog_position_func = gtk_tree_view_search_position_func;
   tree_view->priv->search_equal_func = gtk_tree_view_search_equal_func;
+  tree_view->priv->visible_rows = 0;
 }
 
 
@@ -1084,6 +1096,9 @@
     case PROP_SEARCH_COLUMN:
       gtk_tree_view_set_search_column (tree_view, g_value_get_int (value));
       break;
+    case PROP_VISIBLE_ROWS:
+      gtk_tree_view_set_visible_rows (tree_view, g_value_get_int (value));
+      break;
     default:
       break;
     }
@@ -1128,6 +1143,9 @@
     case PROP_SEARCH_COLUMN:
       g_value_set_int (value, tree_view->priv->search_column);
       break;
+    case PROP_VISIBLE_ROWS:
+      g_value_set_int (value, tree_view->priv->visible_rows);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1504,6 +1522,7 @@
   GList *list;
 
   tree_view->priv->header_height = 0;
+  tree_view->priv->cell_height = 0;
 
   if (tree_view->priv->model)
     {
@@ -1511,6 +1530,7 @@
         {
           GtkRequisition requisition;
           GtkTreeViewColumn *column = list->data;
+	  gint height;
 
 	  if (column->button == NULL)
 	    continue;
@@ -1520,6 +1540,9 @@
           gtk_widget_size_request (column->button, &requisition);
 	  column->button_request = requisition.width;
           tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height);
+
+	  gtk_tree_view_column_cell_get_size (column, NULL, NULL, NULL, NULL, &height);
+	  tree_view->priv->cell_height = MAX (tree_view->priv->cell_height, height);
         }
     }
 }
@@ -1586,6 +1609,7 @@
 {
   GtkTreeView *tree_view;
   GList *tmp_list;
+  GtkWidgetAuxInfo *aux_info;
 
   g_return_if_fail (GTK_IS_TREE_VIEW (widget));
 
@@ -1602,6 +1626,10 @@
   requisition->width = tree_view->priv->width;
   requisition->height = tree_view->priv->height + TREE_VIEW_HEADER_HEIGHT (tree_view);
 
+  aux_info =_gtk_widget_get_aux_info (widget, TRUE);
+  aux_info->height = TREE_VIEW_HEADER_HEIGHT (tree_view) + 
+	  	     tree_view->priv->cell_height * tree_view->priv->visible_rows;
+
   tmp_list = tree_view->priv->children;
 
   while (tmp_list)
@@ -11798,4 +11826,39 @@
   tree_view->priv->edited_column = column;
 
   gtk_cell_editable_remove_widget (column->editable_widget);
+}
+
+/**
+ * gtk_tree_view_set_visible_rows:
+ * @tree_view: A #GtkTreeView
+ * @rows: 
+ *
+ */
+void
+gtk_tree_view_set_visible_rows (GtkTreeView *tree_view,
+			        gint         rows)
+{
+  g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+  g_return_if_fail (rows >= 0);
+
+  if (tree_view->priv->visible_rows != rows)
+    {
+      tree_view->priv->visible_rows = rows;
+      g_object_notify (G_OBJECT (tree_view), "visible_rows");
+      gtk_widget_queue_resize (GTK_WIDGET (tree_view));
+    } 
+}
+
+/**
+ * gtk_tree_view_get_visible_rows:
+ * @tree_view: A #GtkTreeView
+ * @rows: 
+ *
+ */
+gint
+gtk_tree_view_get_visible_rows (GtkTreeView *tree_view)
+{
+  g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), 0);
+
+  return tree_view->priv->visible_rows;
 }
Index: gtk/gtktreeview.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.h,v
retrieving revision 1.57
diff -u -r1.57 gtktreeview.h
--- gtk/gtktreeview.h	26 Nov 2002 21:28:01 -0000	1.57
+++ gtk/gtktreeview.h	14 Dec 2003 16:21:23 -0000
@@ -302,6 +302,10 @@
 								gpointer                    search_user_data,
 								GtkDestroyNotify            search_destroy);
 
+void                   gtk_tree_view_set_visible_rows              (GtkTreeView               *tree_view,
+								    gint                       rows);
+gboolean               gtk_tree_view_get_visible_rows              (GtkTreeView               *tree_view);
+
 /* This function should really never be used.  It is just for use by ATK.
  */
 typedef void (* GtkTreeDestroyCountFunc)  (GtkTreeView             *tree_view,
