[nautilus] Don't check for the eject button if the row doesn't have it (#628347)



commit 476d45bfd1dd71595e7d38f4d18c761fe2a85b78
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Sep 17 19:28:27 2010 +0200

    Don't check for the eject button if the row doesn't have it (#628347)
    
    This sometimes caused false positives in the click-on-eject-button
    detection method.

 src/nautilus-places-sidebar.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index ce3ef5e..cd25f5b 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -913,12 +913,26 @@ over_eject_button (NautilusPlacesSidebar *sidebar,
 	GtkTextDirection direction;
 	int width, total_width;
 	int eject_button_size;
+	gboolean show_eject;
+	GtkTreeIter iter;
+	GtkTreeModel *model;
 
 	*path = NULL;
+	model = gtk_tree_view_get_model (sidebar->tree_view);
 
 	if (gtk_tree_view_get_path_at_pos (sidebar->tree_view,
 					   x, y,
 					   path, &column, NULL, NULL)) {
+
+		gtk_tree_model_get_iter (model, &iter, *path);
+		gtk_tree_model_get (model, &iter,
+				    PLACES_SIDEBAR_COLUMN_EJECT, &show_eject,
+				    -1);
+
+		if (!show_eject) {
+			goto out;
+		}
+
 		total_width = 0;
 
 		gtk_widget_style_get (GTK_WIDGET (sidebar->tree_view),
@@ -959,6 +973,7 @@ over_eject_button (NautilusPlacesSidebar *sidebar,
 		}
 	}
 
+ out:
 	if (*path != NULL) {
 		gtk_tree_path_free (*path);
 		*path = NULL;



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