]> git.tdb.fi Git - ext/subsurface.git/blobdiff - gtk-gui.c
Fixed another memory leak
[ext/subsurface.git] / gtk-gui.c
index 679b1e4dbd41f969d38584797831491a694e4441..0dc2f97344c4f7d0ddda4b0cadea1c85d89b9bf9 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -348,6 +348,7 @@ OPTIONCALLBACK(otu_toggle, visible_cols.otu)
 OPTIONCALLBACK(sac_toggle, visible_cols.sac)
 OPTIONCALLBACK(nitrox_toggle, visible_cols.nitrox)
 OPTIONCALLBACK(temperature_toggle, visible_cols.temperature)
+OPTIONCALLBACK(totalweight_toggle, visible_cols.totalweight)
 OPTIONCALLBACK(cylinder_toggle, visible_cols.cylinder)
 
 static void event_toggle(GtkWidget *w, gpointer _data)
@@ -434,6 +435,11 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
        gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
        g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(otu_toggle), NULL);
 
+       button = gtk_check_button_new_with_label("Show Weight");
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.totalweight);
+       gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+       g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(totalweight_toggle), NULL);
+
        font = gtk_font_button_new_with_font(divelist_font);
        gtk_box_pack_start(GTK_BOX(vbox), font, FALSE, FALSE, 5);
 
@@ -457,6 +463,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
                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("TOTALWEIGHT", PREF_BOOL, BOOL_TO_PTR(visible_cols.totalweight));
                subsurface_set_conf("CYLINDER", PREF_BOOL, BOOL_TO_PTR(visible_cols.cylinder));
                subsurface_set_conf("NITROX", PREF_BOOL, BOOL_TO_PTR(visible_cols.nitrox));
                subsurface_set_conf("SAC", PREF_BOOL, BOOL_TO_PTR(visible_cols.sac));
@@ -626,6 +633,7 @@ static GtkActionEntry menu_items[] = {
        { "SaveFile",       GTK_STOCK_SAVE, NULL,   CTRLCHAR "S", NULL, G_CALLBACK(file_save) },
        { "Print",          GTK_STOCK_PRINT, NULL,  CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
        { "Import",         NULL, "Import", NULL, NULL, G_CALLBACK(import_dialog) },
+       { "AddDive",        NULL, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) },
        { "Preferences",    NULL, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
        { "Renumber",       NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) },
        { "SelectEvents",   NULL, "SelectEvents", NULL, NULL, G_CALLBACK(selectevents_dialog) },
@@ -652,6 +660,7 @@ static const gchar* ui_string = " \
                        </menu> \
                        <menu name=\"LogMenu\" action=\"LogMenuAction\"> \
                                <menuitem name=\"Import\" action=\"Import\" /> \
+                               <menuitem name=\"Add Dive\" action=\"AddDive\" /> \
                                <separator name=\"Separator\"/> \
                                <menuitem name=\"Renumber\" action=\"Renumber\" /> \
                                <menu name=\"View\" action=\"ViewMenuAction\"> \
@@ -724,6 +733,7 @@ void init_ui(int *argcp, char ***argvp)
        /* 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));
+       visible_cols.totalweight = PTR_TO_BOOL(subsurface_get_conf("TOTALWEIGHT", PREF_BOOL));
        visible_cols.nitrox = PTR_TO_BOOL(subsurface_get_conf("NITROX", PREF_BOOL));
        visible_cols.otu = PTR_TO_BOOL(subsurface_get_conf("OTU", PREF_BOOL));
        visible_cols.sac = PTR_TO_BOOL(subsurface_get_conf("SAC", PREF_BOOL));