Handle paths of depth 0 gracefully. (#312796, Jonathan Blandford)

2005-08-15  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconview.c (gtk_icon_view_select_path)
	(gtk_icon_view_scroll_to_path): Handle paths of depth 0
	gracefully.  (#312796, Jonathan Blandford)
This commit is contained in:
Matthias Clasen 2005-08-15 16:46:52 +00:00 committed by Matthias Clasen
parent 24a55633ce
commit 6fbbdeefd3
4 changed files with 22 additions and 8 deletions

View File

@ -1,5 +1,9 @@
2005-08-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c (gtk_icon_view_select_path)
(gtk_icon_view_scroll_to_path): Handle paths of depth 0
gracefully. (#312796, Jonathan Blandford)
* tests/testtoolbar.c: Add some more tests for menu placement.
* gtk/gtkmenutoolbutton.c (menu_position_func):

View File

@ -1,5 +1,9 @@
2005-08-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c (gtk_icon_view_select_path)
(gtk_icon_view_scroll_to_path): Handle paths of depth 0
gracefully. (#312796, Jonathan Blandford)
* tests/testtoolbar.c: Add some more tests for menu placement.
* gtk/gtkmenutoolbutton.c (menu_position_func):

View File

@ -1,5 +1,9 @@
2005-08-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c (gtk_icon_view_select_path)
(gtk_icon_view_scroll_to_path): Handle paths of depth 0
gracefully. (#312796, Jonathan Blandford)
* tests/testtoolbar.c: Add some more tests for menu placement.
* gtk/gtkmenutoolbutton.c (menu_position_func):

View File

@ -3917,15 +3917,16 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
gfloat row_align,
gfloat col_align)
{
GtkIconViewItem *item;
GtkIconViewItem *item = NULL;
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
g_return_if_fail (path != NULL);
g_return_if_fail (row_align >= 0.0 && row_align <= 1.0);
g_return_if_fail (col_align >= 0.0 && col_align <= 1.0);
item = g_list_nth (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0])->data;
if (gtk_tree_path_get_depth (path) > 0)
item = g_list_nth_data (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0]);
if (!item)
return;
@ -4979,17 +4980,18 @@ void
gtk_icon_view_select_path (GtkIconView *icon_view,
GtkTreePath *path)
{
GList *l;
GtkIconViewItem *item = NULL;
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
g_return_if_fail (icon_view->priv->model != NULL);
g_return_if_fail (path != NULL);
l = g_list_nth (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0]);
if (gtk_tree_path_get_depth (path) > 0)
item = g_list_nth_data (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0]);
if (l != NULL)
gtk_icon_view_select_item (icon_view, l->data);
if (item)
gtk_icon_view_select_item (icon_view, item);
}
/**