Don't call gtk_tree_view_scroll_to_cell() on an empty tree view. It

2004-04-21  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
	Don't call gtk_tree_view_scroll_to_cell() on an empty tree view.
	It doesn't like that.  (#140642, Christian Persch)
This commit is contained in:
Matthias Clasen 2004-04-21 21:47:53 +00:00 committed by Matthias Clasen
parent 8d30ad2838
commit c4ed9dc78c
6 changed files with 30 additions and 7 deletions

View File

@ -1,5 +1,9 @@
2004-04-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Don't call gtk_tree_view_scroll_to_cell() on an empty tree view.
It doesn't like that. (#140642, Christian Persch)
* demos/gtk-demo/expander.c (do_expander): A new demo.
* demos/gtk-demo/Makefile.am (demos): Add expander.c.

View File

@ -1,5 +1,9 @@
2004-04-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Don't call gtk_tree_view_scroll_to_cell() on an empty tree view.
It doesn't like that. (#140642, Christian Persch)
* demos/gtk-demo/expander.c (do_expander): A new demo.
* demos/gtk-demo/Makefile.am (demos): Add expander.c.

View File

@ -1,5 +1,9 @@
2004-04-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Don't call gtk_tree_view_scroll_to_cell() on an empty tree view.
It doesn't like that. (#140642, Christian Persch)
* demos/gtk-demo/expander.c (do_expander): A new demo.
* demos/gtk-demo/Makefile.am (demos): Add expander.c.

View File

@ -1,5 +1,9 @@
2004-04-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Don't call gtk_tree_view_scroll_to_cell() on an empty tree view.
It doesn't like that. (#140642, Christian Persch)
* demos/gtk-demo/expander.c (do_expander): A new demo.
* demos/gtk-demo/Makefile.am (demos): Add expander.c.

View File

@ -1,5 +1,9 @@
2004-04-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
Don't call gtk_tree_view_scroll_to_cell() on an empty tree view.
It doesn't like that. (#140642, Christian Persch)
* demos/gtk-demo/expander.c (do_expander): A new demo.
* demos/gtk-demo/Makefile.am (demos): Add expander.c.

View File

@ -1098,7 +1098,7 @@ gboolean
_gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
{
gint x, y;
gint items, height, x_border, y_border;
gint matches, items, height, x_border, y_border;
GdkScreen *screen;
gint monitor_num;
GdkRectangle monitor;
@ -1112,9 +1112,9 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
x += x_border;
y += 2 * y_border;
items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
items = MIN (items, 15);
items = MIN (matches, 15);
gtk_tree_view_column_cell_get_size (completion->priv->column, NULL,
NULL, NULL, NULL, &height);
@ -1164,17 +1164,20 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
{
y += height;
above = FALSE;
path = gtk_tree_path_new_from_indices (0, -1);
}
else
{
y -= popup_req.height;
above = TRUE;
path = gtk_tree_path_new_from_indices (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL) - 1, -1);
}
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (completion->priv->tree_view), path, NULL, FALSE, 0.0, 0.0);
if (matches > 0)
{
path = gtk_tree_path_new_from_indices (above ? matches - 1 : 0, -1);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (completion->priv->tree_view), path,
NULL, FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
}
gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y);