]> Pileus Git - ~andy/gtk/commitdiff
Handle paths of depth 0 gracefully. (#312796, Jonathan Blandford)
authorMatthias Clasen <mclasen@redhat.com>
Mon, 15 Aug 2005 16:46:52 +0000 (16:46 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 15 Aug 2005 16:46:52 +0000 (16:46 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkiconview.c

index 8f4e4d94dd6acb51dd255453191c661101afe70b..ca1f694f65a2156f405f834ae2687cde4561660b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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): 
index 8f4e4d94dd6acb51dd255453191c661101afe70b..ca1f694f65a2156f405f834ae2687cde4561660b 100644 (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): 
index 8f4e4d94dd6acb51dd255453191c661101afe70b..ca1f694f65a2156f405f834ae2687cde4561660b 100644 (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): 
index 30360fd3ce38bce3fc3ace09f41070a55ee4d9db..f589fe51537d33e2f81a70521b1c4a94c04581a8 100644 (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);
 }
 
 /**