[PATCH] Change list-view rename-behaviour



Attached is a patch to src/file-manager/fm-list-view.c that changes the rename-behaviour for the list-view; currently, when you select a file in the list-view and click on it a few moments later, you will start renaming the file. I find this behaviour to be very irritating. The patch changes the list-view to behave the way the icon-view does in this case: one can only rename a file from a (context-)menu or with a hotkey.

marten

--- fm-list-view.c	Wed Nov  6 11:54:27 2002
+++ ../../../../work/nautilus-2.1.5/src/file-manager/fm-list-view.c	Sat Jan 11 12:33:11 2003
@@ -291,10 +291,16 @@
 			    -1);
 
 	fm_rename_file (file, new_text);
 	
 	nautilus_file_unref (file);
+
+	/*We're done editing - make the filename-cells readonly again.*/
+	g_object_set (G_OBJECT (view->details->file_name_cell),
+		      "editable", FALSE,
+		      NULL);
+
 }
 
 static char *
 get_root_uri_callback (NautilusTreeViewDragDest *dest,
 		       gpointer user_data)
@@ -427,13 +433,11 @@
 	view->details->file_name_cell = (GtkCellRendererText *)cell;
 	g_signal_connect (cell, "edited", G_CALLBACK (cell_renderer_edited), view);
 
 	gtk_tree_view_column_pack_start (view->details->file_name_column, cell, TRUE);
 	gtk_tree_view_column_set_attributes (view->details->file_name_column, cell,
-					     "text", FM_LIST_MODEL_NAME_COLUMN,
-					     "editable", FM_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN,
-					     NULL);
+					     "text", FM_LIST_MODEL_NAME_COLUMN, NULL);
 	gtk_tree_view_append_column (view->details->tree_view, view->details->file_name_column);
 
 	/* Create the size column */
 	cell = gtk_cell_renderer_text_new ();
 	view->details->size_cell = (GtkCellRendererText *)cell;
@@ -829,12 +833,22 @@
 	FMListView *list_view;
 	GtkTreeIter iter;
 	GtkTreePath *path;
 	
 	list_view = FM_LIST_VIEW (view);
-	
+
+	/*Make filename-cells editable.*/
+	g_object_set (G_OBJECT (list_view->details->file_name_cell),
+		      "editable", TRUE,
+		      NULL);
+
 	if (!fm_list_model_get_tree_iter_from_file (list_view->details->model, file, &iter)) {
+		/*Oops. We're not editing after all. Make the filename-cells readonly again*/
+		g_object_set (G_OBJECT (list_view->details->file_name_cell),
+		      "editable", FALSE,
+		      NULL);
+
 		return;
 	}
 
 	path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_view->details->model), &iter);
 	


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