Index: gtktreeview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.c,v
retrieving revision 1.305.2.26
diff -b -u -2 -r1.305.2.26 gtktreeview.c
--- gtktreeview.c	15 Aug 2003 20:05:18 -0000	1.305.2.26
+++ gtktreeview.c	18 Aug 2003 21:24:25 -0000
@@ -1907,5 +1907,5 @@
       GtkCellRenderer *focus_cell = NULL;
       gint column_handled_click = FALSE;
-      gboolean emit_row_activated = FALSE;
+      gboolean row_double_click = FALSE;
 
       /* are we in an arrow? */
@@ -1945,4 +1945,41 @@
       background_area.x = 0;
 
+
+      /* Test if the double-click happened on the same row */
+      if (event->button == 1 && event->type == GDK_2BUTTON_PRESS &&
+	  tree_view->priv->last_button_press)
+	{
+	  GtkTreePath *lsc;
+
+	  lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press);
+
+	  if (tree_view->priv->last_button_press)
+	    gtk_tree_row_reference_free (tree_view->priv->last_button_press);
+	  if (tree_view->priv->last_button_press_2)
+	    gtk_tree_row_reference_free (tree_view->priv->last_button_press_2);
+	  tree_view->priv->last_button_press = NULL;
+	  tree_view->priv->last_button_press_2 = NULL;
+
+	  if (lsc)
+	    {
+	      row_double_click = !gtk_tree_path_compare (lsc, path);
+	      gtk_tree_path_free (lsc);
+	    }
+	}
+      else if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
+        {
+	  if (tree_view->priv->last_button_press)
+	    gtk_tree_row_reference_free (tree_view->priv->last_button_press);
+	  tree_view->priv->last_button_press = tree_view->priv->last_button_press_2;
+	  tree_view->priv->last_button_press_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
+	}
+
+      /* if double-click didn't happen on the same row
+       * or if it's a triple-click we do no process the event */
+      if ((event->type == GDK_2BUTTON_PRESS && !row_double_click) ||
+          event->type == GDK_3BUTTON_PRESS)
+        return FALSE;
+
+
       /* Let the column have a chance at selecting it. */
       for (list = tree_view->priv->columns; list; list = list->next)
@@ -2095,36 +2132,7 @@
         }
 
-      if (event->button == 1 && event->type == GDK_2BUTTON_PRESS &&
-	  tree_view->priv->last_button_press)
-	{
-	  GtkTreePath *lsc;
-
-	  lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press);
-
-	  if (tree_view->priv->last_button_press)
-	    gtk_tree_row_reference_free (tree_view->priv->last_button_press);
-	  if (tree_view->priv->last_button_press_2)
-	    gtk_tree_row_reference_free (tree_view->priv->last_button_press_2);
-	  tree_view->priv->last_button_press = NULL;
-	  tree_view->priv->last_button_press_2 = NULL;
-
-	  if (lsc)
-	    {
-	      if (!gtk_tree_path_compare (lsc, path))
-		emit_row_activated = TRUE;
-	      gtk_tree_path_free (lsc);
-	    }
-	}
-      else if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
-        {
-	  if (tree_view->priv->last_button_press)
-	    gtk_tree_row_reference_free (tree_view->priv->last_button_press);
-	  tree_view->priv->last_button_press = tree_view->priv->last_button_press_2;
-	  tree_view->priv->last_button_press_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
-	}
-
       GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
 
-      if (emit_row_activated)
+      if(row_double_click)
 	{
 	  gtk_grab_remove (widget);
