GtkWidget *container_widget;
GtkListStore *model;
GtkTreeViewColumn *date, *depth, *duration, *location;
- GtkTreeViewColumn *temperature, *cylinder, *nitrox, *sac;
+ GtkTreeViewColumn *temperature, *cylinder, *nitrox, *sac, *otu;
int changed;
};
gtk_tree_model_foreach(model, set_one_dive, NULL);
}
+void update_dive_list_col_visibility(void)
+{
+ gtk_tree_view_column_set_visible(dive_list.sac, visible_cols.sac);
+ gtk_tree_view_column_set_visible(dive_list.otu, visible_cols.otu);
+ return;
+}
+
static void fill_dive_list(void)
{
int i;
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, TRUE);
- dive_list.sac = divelist_column(&dive_list, DIVE_OTU, "OTU", otu_data_func, PANGO_ALIGN_CENTER, FALSE);
+ 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();
static GtkWidget *dive_profile;
+visible_cols_t visible_cols = {TRUE, FALSE};
+
void repaint_dive(void)
{
update_dive(current_dive);
UNITCALLBACK(set_celsius, temperature, CELSIUS)
UNITCALLBACK(set_fahrenheit, temperature, FAHRENHEIT)
+#define OPTIONCALLBACK(name, option) \
+static void name(GtkWidget *w, gpointer data) \
+{ \
+ option = GTK_TOGGLE_BUTTON(w)->active; \
+}
+
+OPTIONCALLBACK(otu_toggle, visible_cols.otu)
+OPTIONCALLBACK(sac_toggle, visible_cols.sac)
+
static void preferences_dialog(GtkWidget *w, gpointer data)
{
int result;
- GtkWidget *dialog, *font, *frame, *box;
+ GtkWidget *dialog, *font, *frame, *box, *button;
menu_units = output_units;
"Fahrenheit", set_fahrenheit, (output_units.temperature == FAHRENHEIT),
NULL);
+ frame = gtk_frame_new("Columns");
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
+
+ box = gtk_hbox_new(FALSE, 6);
+ gtk_container_add(GTK_CONTAINER(frame), box);
+
+ button = gtk_check_button_new_with_label("Show SAC");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.sac);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(sac_toggle), NULL);
+
+ button = gtk_check_button_new_with_label("Show OTU");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.otu);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(otu_toggle), NULL);
+
font = gtk_font_button_new_with_font(divelist_font);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), font, FALSE, FALSE, 5);
output_units = menu_units;
update_dive_list_units();
repaint_dive();
+ update_dive_list_col_visibility();
gconf_client_set_bool(gconf, GCONF_NAME(feet), output_units.length == FEET, NULL);
gconf_client_set_bool(gconf, GCONF_NAME(psi), output_units.pressure == PSI, NULL);
gconf_client_set_bool(gconf, GCONF_NAME(cuft), output_units.volume == CUFT, NULL);
gconf_client_set_bool(gconf, GCONF_NAME(fahrenheit), output_units.temperature == FAHRENHEIT, NULL);
+ gconf_client_set_bool(gconf, GCONF_NAME(SAC), visible_cols.sac, NULL);
+ gconf_client_set_bool(gconf, GCONF_NAME(OTU), visible_cols.otu, NULL);
gconf_client_set_string(gconf, GCONF_NAME(divelist_font), divelist_font, NULL);
}
gtk_widget_destroy(dialog);