[gtk+] Don't call scroll to cell if the tree view is empty



commit 44a064fe30f8217eb257bf56f0790db771927c13
Author: Kristian Rietveld <kris loopnest org>
Date:   Sun Nov 20 18:54:20 2011 +0100

    Don't call scroll to cell if the tree view is empty
    
    Account for the case when gtk_drag_finish() didn't actually add a row
    (can happen when dragging from an empty tree view to itself ...).

 gtk/gtktreeview.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index e31de47..1bc347d 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -7988,8 +7988,9 @@ gtk_tree_view_drag_data_received (GtkWidget        *widget,
                    (gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
                    time);
 
-  if (gtk_tree_path_get_depth (dest_row) == 1
-      && gtk_tree_path_get_indices (dest_row)[0] == 0)
+  if (gtk_tree_path_get_depth (dest_row) == 1 &&
+      gtk_tree_path_get_indices (dest_row)[0] == 0 &&
+      gtk_tree_model_iter_n_children (tree_view->priv->model, NULL) != 0)
     {
       /* special special case drag to "0", scroll to first item */
       if (!tree_view->priv->scroll_to_path)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]