Make the cylinder table columns unsortable

They were never intended to be sortable, but using common code with the
dive list picked up that "sort by index" thing by mistake.

If we really want to be able to sort cylinders by O2 percentage (which
really doesn't seem to make much sense, considering that you usually
have just one or two cylinders) we will need to also handle the case of
editing the (differently sorted) cylinder table.  Which we don't do now.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2011-12-11 11:40:17 -08:00
parent 50d026230f
commit f078bc04e1
4 changed files with 38 additions and 24 deletions

View file

@ -202,17 +202,25 @@ static void quit(GtkWidget *w, gpointer data)
}
GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title,
data_func_t data_func, PangoAlignment align, gboolean visible)
data_func_t data_func, unsigned int flags)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *col;
double xalign = 0.0; /* left as default */
PangoAlignment align;
gboolean visible;
align = (flags & ALIGN_LEFT) ? PANGO_ALIGN_LEFT :
(flags & ALIGN_RIGHT) ? PANGO_ALIGN_RIGHT :
PANGO_ALIGN_CENTER;
visible = !(flags & INVISIBLE);
renderer = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, title);
gtk_tree_view_column_set_sort_column_id(col, index);
if (!(flags & UNSORTABLE))
gtk_tree_view_column_set_sort_column_id(col, index);
gtk_tree_view_column_set_resizable(col, TRUE);
gtk_tree_view_column_pack_start(col, renderer, TRUE);
if (data_func)