- gtk_widget_set_size_request(dive_list.tree_view, 200, 100);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.date = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "Date");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_DATE);
- gtk_tree_view_column_set_resizable (col, TRUE);
- gtk_tree_view_column_pack_start(col, renderer, TRUE);
- gtk_tree_view_column_set_cell_data_func(col, renderer, date_data_func, NULL, NULL);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.depth = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "ft");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_DEPTH);
- gtk_tree_view_column_pack_start(col, renderer, FALSE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_DEPTHSTR);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.duration = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "min");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_DURATION);
- gtk_tree_view_column_pack_start(col, renderer, FALSE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_DURATIONSTR);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.location = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "Location");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_LOCATION);
- gtk_tree_view_column_pack_start(col, renderer, FALSE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_LOCATION);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.temperature = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "deg");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_TEMP);
- gtk_tree_view_column_pack_start(col, renderer, FALSE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_TEMPSTR);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.nitrox = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "O2%");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_NITROX);
- gtk_tree_view_column_pack_start(col, renderer, FALSE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_NITROXSTR);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
-
- renderer = gtk_cell_renderer_text_new();
- dive_list.sac = col = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(col, "SAC");
- gtk_tree_view_column_set_sort_column_id(col, DIVE_SAC);
- gtk_tree_view_column_pack_start(col, renderer, FALSE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_SACSTR);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
-
- fill_dive_list(&dive_list);
+ gtk_widget_set_size_request(dive_list.tree_view, 200, 200);
+
+ dive_list.date = divelist_column(&dive_list, DIVE_DATE, "Date", date_data_func, PANGO_ALIGN_LEFT, TRUE);
+ dive_list.depth = divelist_column(&dive_list, DIVE_DEPTH, "ft", depth_data_func, PANGO_ALIGN_RIGHT, TRUE);
+ dive_list.duration = divelist_column(&dive_list, DIVE_DURATION, "min", duration_data_func, PANGO_ALIGN_RIGHT, TRUE);
+ dive_list.temperature = divelist_column(&dive_list, DIVE_TEMPERATURE, UTF8_DEGREE "F", temperature_data_func, PANGO_ALIGN_RIGHT, TRUE);
+ dive_list.cylinder = divelist_column(&dive_list, DIVE_CYLINDER, "Cyl", NULL, PANGO_ALIGN_CENTER, TRUE);
+ dive_list.nitrox = divelist_column(&dive_list, DIVE_NITROX, "O" UTF8_SUBSCRIPT_2 "%", nitrox_data_func, PANGO_ALIGN_CENTER, TRUE);
+ dive_list.sac = divelist_column(&dive_list, DIVE_SAC, "SAC", sac_data_func, PANGO_ALIGN_CENTER, visible_cols.sac);
+ dive_list.otu = divelist_column(&dive_list, DIVE_OTU, "OTU", otu_data_func, PANGO_ALIGN_CENTER, visible_cols.otu);
+ dive_list.location = divelist_column(&dive_list, DIVE_LOCATION, "Location", NULL, PANGO_ALIGN_LEFT, TRUE);
+
+ fill_dive_list();