changeset 157:b73743a01384

fixed in-place rename
author nadvornik
date Sun, 16 Dec 2007 22:30:19 +0000
parents dd6dc0a55d3d
children 63f202592bb1
files src/view_file_list.c
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_file_list.c	Sat Dec 15 17:58:51 2007 +0000
+++ b/src/view_file_list.c	Sun Dec 16 22:30:19 2007 +0000
@@ -109,6 +109,28 @@
 	gtk_tree_path_free(tpath);
 }
 
+
+static gint vflist_column_idx(ViewFileList *vfl, gint store_idx)
+{
+	GList *columns, *work;
+	gint i = 0;
+
+	columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
+	work = columns;
+	while (work)
+		{
+		GtkTreeViewColumn *column = work->data;
+		if (store_idx == GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx")))
+			break;
+		work = work->next;
+		i++;
+		}
+    
+	g_list_free(columns);
+	return i;
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  * dnd
@@ -286,7 +308,7 @@
 
 			tpath = gtk_tree_model_get_path(store, &iter);
 			tree_edit_by_path(GTK_TREE_VIEW(vfl->listview), tpath,
-					  FILE_COLUMN_NAME -1, vfl->click_fd->name,
+					  vflist_column_idx(vfl, FILE_COLUMN_NAME), vfl->click_fd->name,
 					  vflist_row_rename_cb, vfl);
 			gtk_tree_path_free(tpath);
 			}