Re: [Nautilus-list] [PATCH] fix for bug 73469
- From: Diego González <diego pemas net>
- To: Alex Larsson <alexl redhat com>
- Cc: Nautilus List <nautilus-list lists eazel com>
- Subject: Re: [Nautilus-list] [PATCH] fix for bug 73469
- Date: 23 Apr 2002 18:51:17 +0200
On mar, 2002-04-23 at 17:25, Alex Larsson wrote:
> On 22 Apr 2002, Diego González wrote:
>
> > hi
> >
> > the bug is about the list-view not saving the sorting of the columns.
> >
> > i removed the function the functon get_attribute_from_sort_type from
> > fm-list-view.c and put a similar one in fm-list-model.c, becuase it
> > seems like the right place for it, there is a similar function there
> > that does the reverse mapping.
>
>
> 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 22 Apr 2002 12:50:52 -0000
> @@ -22,6 +22,8 @@
> Authors: Anders Carlsson <andersca gnu org>
> */
>
> +#include <stdio.h>
> +
>
>
> I don't think you need this.
>
truth, that's my fault
>
> +char *
> +fm_list_model_get_attribute_from_sort_column_id (int sort_column_id)
> +{
> + 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");
> + }
> }
>
>
> This should be using the attributes table instead of hardcoding the data
> in another place.
>
there used to be a function like this in fm-list-view.c, i thought it
was ok, i was going to use the attributes table at the top of
fm-list-model.c, but i couldn't do it because of this:
static const AttributeEntry attributes[] = {
{ "name", FM_LIST_MODEL_NAME_COLUMN },
{ "icon", 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 },
{ "date_modified", FM_LIST_MODEL_DATE_MODIFIED_COLUMN },
};
the FM_LIST_MODEL_TYPE_COLUMN is related to two attributes name, icon
and type, so when putting this into a for loop, it returns icon instead
of type, which is wrong.
what should i do with this, then, leave hardcoded or use the table?
although i don't know how to overcome the fact that there are two
attributes related to the same column_id.
>
> int
> 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 22 Apr 2002 12:50:52 -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 = g_strdup (order ? "true" : "false");
> + nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED, NULL, attr_order);
> +
> + g_free (attr_order);
> + g_free (attr_column);
> +}
>
> Why ar you strduping attr_order. That doesn't seem necessary. :)
my fault, once again
>
> Index: src/file-manager/fm-list-model.h
> ===================================================================
> RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-model.h,v
> retrieving revision 1.3
> diff -u -r1.3 fm-list-model.h
> --- src/file-manager/fm-list-model.h 11 Mar 2002 10:17:49 -0000 1.3
> +++ src/file-manager/fm-list-model.h 22 Apr 2002 12:50:52 -0000
> @@ -72,5 +72,6 @@
> gboolean sort_directories_first);
> int fm_list_model_get_sort_column_id_from_attribute (const char *attribute);
> int fm_list_model_get_sort_column_id_from_sort_type (NautilusFileSortType sort_type);
> +char *fm_list_model_get_attribute_from_sort_column_id (int sort_column_id);
>
> #endif /* FM_LIST_MODEL_H */
>
> Is this indented differently, or is it just the patch that looks strange?
i'll correct this.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Alexander Larsson Red Hat, Inc
> alexl redhat com alla lysator liu se
> He's a leather-clad Amish senator whom everyone believes is mad. She's an
> artistic cigar-chomping museum curator with a birthmark shaped like Liberty's
> torch. They fight crime!
>
>
> _______________________________________________
> nautilus-list mailing list
> nautilus-list lists eazel com
> http://lists.eazel.com/mailman/listinfo/nautilus-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]