Re: [Nautilus-list] [PATCH] fix for bug 73469



On 24 Apr 2002, Diego González wrote:

> here is a new patch with the changes:
 
Index: src/file-manager/fm-list-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-view.c,v
retrieving revision 1.167
diff -u -r1.167 fm-list-view.c
--- src/file-manager/fm-list-view.c	18 Apr 2002 23:51:44 -0000	1.167
+++ src/file-manager/fm-list-view.c	23 Apr 2002 21:21:32 -0000
@@ -67,6 +67,7 @@
 
 static GList *     fm_list_view_get_selection         (FMDirectoryView *view);
 
+
 GNOME_CLASS_BOILERPLATE (FMListView, fm_list_view,
 			 FMDirectoryView, FM_TYPE_DIRECTORY_VIEW)
 
@@ -178,6 +179,28 @@
 }
 
 static void
+rows_reordered_callback (GtkTreeSortable *sortable, 
+			 FMListView *view)
+{
+	NautilusFile *file;
+	gint sort_column_id;
+	GtkSortType order;
+	char *attr_column, *attr_order;
+
+	file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (view));
+	gtk_tree_sortable_get_sort_column_id (sortable, &sort_column_id, &order);
+
+	attr_column = fm_list_model_get_attribute_from_sort_column_id (sort_column_id);
+	nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_COLUMN, NULL, attr_column);
+
+	attr_order = (order ? "true" : "false");
+	nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED, NULL, attr_order);
+
+/*	g_free (attr_order);*/


Don't leave this in commented out.


+	g_free (attr_column);
+}
+
+static void
 cell_renderer_edited (GtkCellRendererText *cell,
 		      const char          *path_str,
 		      const char          *new_text,
Index: src/file-manager/fm-list-model.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-model.c,v
retrieving revision 1.11
diff -u -r1.11 fm-list-model.c
--- src/file-manager/fm-list-model.c	17 Apr 2002 12:38:27 -0000	1.11
+++ src/file-manager/fm-list-model.c	23 Apr 2002 21:21:32 -0000
@@ -55,12 +55,12 @@
 
 static const AttributeEntry attributes[] = {
 	{ "name", FM_LIST_MODEL_NAME_COLUMN },
-	{ "icon", FM_LIST_MODEL_TYPE_COLUMN },
+	{ "type", FM_LIST_MODEL_TYPE_COLUMN },
 #ifdef GNOME2_CONVERSION_COMPLETE
 	{ "emblems", FM_LIST_MODEL_EMBLEMS_COLUMN },
 #endif
 	{ "size", FM_LIST_MODEL_SIZE_COLUMN },
-	{ "type", FM_LIST_MODEL_TYPE_COLUMN },
+	{ "icon", FM_LIST_MODEL_TYPE_COLUMN },
 	{ "date_modified", FM_LIST_MODEL_DATE_MODIFIED_COLUMN },
 };



Please add a comment before the table noting the duplicate entries and why 
they are there.
 
+char *
+fm_list_model_get_attribute_from_sort_column_id (int sort_column_id)
+{
+	int i;
+
+	for (i = 0; i < G_N_ELEMENTS (attributes); i++) {
+		if (attributes[i].sort_column_id == sort_column_id) {
+			return g_strdup (attributes[i].attribute_name);
+		}
+	}
+
+	g_warning ("unknown sort column id: %d", sort_column_id);
+	return g_strdup ("name");
+
+/*
+	switch (sort_column_id) {
+	case FM_LIST_MODEL_NAME_COLUMN:
+		return g_strdup ("name");
+	case FM_LIST_MODEL_TYPE_COLUMN:
+		return g_strdup ("type");
+	case FM_LIST_MODEL_SIZE_COLUMN:
+		return g_strdup ("size");
+	case FM_LIST_MODEL_DATE_MODIFIED_COLUMN:
+		return g_strdup ("data_modified");
+	default:
+		g_warning ("unknown sort column id: %d", sort_column_id);
+		return g_strdup ("name");
+	}
+*/


Don't leave this part commented out in the code.


Otherwise looks fine to commit.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a notorious day-dreaming vagrant with nothing left to lose. She's a 
hard-bitten African-American politician who don't take no shit from nobody. 
They fight crime! 





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