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



On 23 Apr 2002, Diego González wrote:

> > 
> > +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.

Hmmm.. Is that even right for 
fm_list_model_get_sort_column_id_from_attribute() though? It seems like an 
honest bug in the attributes table. Well. I guess you can't sort by 
pixbufs. :)

I think the right way is to change the table so that the icon entry is 
after the type entry, and add a comment to say why this is so. Then use 
the first matching entry in attributes.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a notorious umbrella-wielding firefighter on his last day in the job. 
She's a man-hating out-of-work politician fleeing from a Satanic cult. They 
fight crime! 





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