X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=gtk-gui.c;h=9f37c1a0b95f9f193673d521efd9a666ee323d6d;hb=91e7dcc555ada4fe43198327383e895e528c4cc7;hp=1e053e52b22837b3ed9df9554b337e25bf9da749;hpb=697435b249e1e2f308cc72c85180806cc0765249;p=ext%2Fsubsurface.git diff --git a/gtk-gui.c b/gtk-gui.c index 1e053e5..9f37c1a 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -31,12 +31,14 @@ static GtkWidget *dive_profile; visible_cols_t visible_cols = {TRUE, FALSE}; -static const char *default_dive_computer; +static const char *default_dive_computer_vendor; +static const char *default_dive_computer_product; static const char *default_dive_computer_device; -static int is_default_dive_computer(const char *name) +static int is_default_dive_computer(const char *vendor, const char *product) { - return default_dive_computer && !strcmp(name, default_dive_computer); + return default_dive_computer_vendor && !strcmp(vendor, default_dive_computer_vendor) && + default_dive_computer_product && !strcmp(product, default_dive_computer_product); } static int is_default_dive_computer_device(const char *name) @@ -44,14 +46,18 @@ static int is_default_dive_computer_device(const char *name) return default_dive_computer_device && !strcmp(name, default_dive_computer_device); } -static void set_default_dive_computer(const char *name) +static void set_default_dive_computer(const char *vendor, const char *product) { - if (!name || !*name) + if (!vendor || !*vendor) + return; + if (!product || !*product) return; - if (is_default_dive_computer(name)) + if (is_default_dive_computer(vendor, product)) return; - default_dive_computer = name; - subsurface_set_conf("dive_computer", PREF_STRING, name); + default_dive_computer_vendor = vendor; + default_dive_computer_product = product; + subsurface_set_conf("dive_computer_vendor", PREF_STRING, vendor); + subsurface_set_conf("dive_computer_product", PREF_STRING, product); } static void set_default_dive_computer_device(const char *name) @@ -342,6 +348,8 @@ 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(suit_toggle, visible_cols.suit) OPTIONCALLBACK(cylinder_toggle, visible_cols.cylinder) static void event_toggle(GtkWidget *w, gpointer _data) @@ -428,6 +436,16 @@ 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); + + button = gtk_check_button_new_with_label("Show Suit"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.suit); + gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); + g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(suit_toggle), NULL); + font = gtk_font_button_new_with_font(divelist_font); gtk_box_pack_start(GTK_BOX(vbox), font, FALSE, FALSE, 5); @@ -451,6 +469,8 @@ 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("SUIT", PREF_BOOL, BOOL_TO_PTR(visible_cols.suit)); 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)); @@ -620,6 +640,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) }, @@ -646,6 +667,7 @@ static const gchar* ui_string = " \ \