[PATCH] Treat clicks in list view on other columns than sort column as background click



From bug 94618 (summary) [1]:
"No way to get contextmenu for current folder in list view".

I've decided against an empty row at the bottom because the solution
proposed by me doesn't change the folder UI state (in contrast to
scrolling), except for unselection of course.

Proposed patch attached, which makes Nautilus treat all clicks to
columns which don't act as sort column as clicks on the folder
background.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=94618

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-list-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-view.c,v
retrieving revision 1.254
diff -u -p -r1.254 fm-list-view.c
--- src/file-manager/fm-list-view.c	14 Jul 2005 08:22:30 -0000	1.254
+++ src/file-manager/fm-list-view.c	19 Jul 2005 10:56:10 -0000
@@ -416,8 +608,10 @@ motion_notify_callback (GtkWidget *widge
 	GdkCursor *cursor;
 	GList *ref_list;
 	GdkPixbuf *pixbuf;	
+	GtkTreeViewColumn *column;
 	GtkTreePath *last_hover_path;
 	GtkTreeIter iter;
+	int sort_column_id;
 	
 	view = FM_LIST_VIEW (callback_data);
 	
@@ -425,18 +619,26 @@ motion_notify_callback (GtkWidget *widge
 		return FALSE;
 	}
 
+	fm_list_view_update_rubberband (view);
+
 	if (click_policy_auto_value == NAUTILUS_CLICK_POLICY_SINGLE) {
 		last_hover_path = view->details->hover_path;
 
 		gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
 					       event->x, event->y,
 					       &view->details->hover_path,
-					       NULL, NULL, NULL);
+					       &column, NULL, NULL);
 
+		cursor = NULL;
 		if (view->details->hover_path != NULL) {
-			cursor = gdk_cursor_new (GDK_HAND2);
-		} else {
-			cursor = NULL;
+			gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (view->details->model), &sort_column_id, NULL);
+
+			if (gtk_tree_view_column_get_sort_column_id (column) == sort_column_id) {
+				cursor = gdk_cursor_new (GDK_HAND2);
+			} else {
+				gtk_tree_path_free (view->details->hover_path);
+				view->details->hover_path = NULL;
+			}
 		}
 
 		gdk_window_set_cursor (widget->window, cursor);
@@ -544,6 +746,7 @@ button_press_callback (GtkWidget *widget
 {
 	FMListView *view;
 	GtkTreeView *tree_view;
+	GtkTreeViewColumn *column;
 	GtkTreePath *path;
 	gboolean call_parent;
 	gboolean allow_drag;
@@ -554,6 +757,7 @@ button_press_callback (GtkWidget *widget
 	static int click_count = 0;
 	int double_click_time;
 	int expander_size, horizontal_separator;
+	int sort_column_id;
 	gboolean on_expander;
 
 	view = FM_LIST_VIEW (callback_data);
@@ -594,8 +798,10 @@ button_press_callback (GtkWidget *widget
 
 	call_parent = TRUE;
 	allow_drag = FALSE;
+	gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (view->details->model), &sort_column_id, NULL);
 	if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y,
-					   &path, NULL, NULL, NULL)) {
+					   &path, &column, NULL, NULL) &&
+	    gtk_tree_view_column_get_sort_column_id (column) == sort_column_id) {
 		/* Keep track of path of last click so double clicks only happen
 		 * on the same item */
 		if ((event->button == 1 || event->button == 2)  && 

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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