X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=gtk-gui.c;h=7d0e95c43ecdf5b8885ff44dd4a1693b75b744c6;hb=3a7d577ff1109c701656854ceb23ed690c340fbc;hp=45185c016090e3e1569ae09ce02467d7364a5693;hpb=788ebc0500b12fb502b82473c1459ccca06345a5;p=ext%2Fsubsurface.git diff --git a/gtk-gui.c b/gtk-gui.c index 45185c0..7d0e95c 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -114,7 +114,7 @@ static void file_open(GtkWidget *w, gpointer data) GError *error = NULL; while(filenames != NULL) { filename = filenames->data; - parse_xml_file(filename, &error); + parse_file(filename, &error); if (error != NULL) { report_error(error); @@ -296,6 +296,8 @@ UNITCALLBACK(set_liter, volume, LITER) UNITCALLBACK(set_cuft, volume, CUFT) UNITCALLBACK(set_celsius, temperature, CELSIUS) UNITCALLBACK(set_fahrenheit, temperature, FAHRENHEIT) +UNITCALLBACK(set_kg, weight, KG) +UNITCALLBACK(set_lbs, weight, LBS) #define OPTIONCALLBACK(name, option) \ static void name(GtkWidget *w, gpointer data) \ @@ -357,6 +359,11 @@ static void preferences_dialog(GtkWidget *w, gpointer data) "Fahrenheit", set_fahrenheit, (output_units.temperature == FAHRENHEIT), NULL); + create_radio(box, "Weight:", + "kg", set_kg, (output_units.weight == KG), + "lbs", set_lbs, (output_units.weight == LBS), + NULL); + frame = gtk_frame_new("Columns"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5); @@ -409,6 +416,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data) subsurface_set_conf("psi", PREF_BOOL, BOOL_TO_PTR(output_units.pressure == PSI)); subsurface_set_conf("cuft", PREF_BOOL, BOOL_TO_PTR(output_units.volume == CUFT)); subsurface_set_conf("fahrenheit", PREF_BOOL, BOOL_TO_PTR(output_units.temperature == FAHRENHEIT)); + subsurface_set_conf("lbs", PREF_BOOL, BOOL_TO_PTR(output_units.weight == LBS)); subsurface_set_conf("TEMPERATURE", PREF_BOOL, BOOL_TO_PTR(visible_cols.temperature)); subsurface_set_conf("CYLINDER", PREF_BOOL, BOOL_TO_PTR(visible_cols.cylinder)); subsurface_set_conf("NITROX", PREF_BOOL, BOOL_TO_PTR(visible_cols.nitrox)); @@ -670,6 +678,8 @@ void init_ui(int *argcp, char ***argvp) output_units.volume = CUFT; if (subsurface_get_conf("fahrenheit", PREF_BOOL)) output_units.temperature = FAHRENHEIT; + if (subsurface_get_conf("lbs", PREF_BOOL)) + output_units.weight = LBS; /* an unset key is FALSE - all these are hidden by default */ visible_cols.cylinder = PTR_TO_BOOL(subsurface_get_conf("CYLINDER", PREF_BOOL)); visible_cols.temperature = PTR_TO_BOOL(subsurface_get_conf("TEMPERATURE", PREF_BOOL)); @@ -746,7 +756,7 @@ void init_ui(int *argcp, char ***argvp) /* Frame for total dive statistics */ nb_page = total_stats_widget(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Overall Stats")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Stats")); gtk_widget_set_app_paintable(win, TRUE); gtk_widget_show_all(win); @@ -961,7 +971,7 @@ static GtkWidget *xml_file_selector(GtkWidget *vbox, GtkWidget *main_dialog) static void do_import_file(gpointer data, gpointer user_data) { GError *error = NULL; - parse_xml_file(data, &error); + parse_file(data, &error); if (error != NULL) {