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.
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.
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.
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.
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.
_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;
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);
{
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);
- gtk_tree_path_free (path);
+ 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);