X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=gtk-gui.c;h=45aa212638716e4550aa3c399436af1cfb7464dd;hb=8cdf1ab59fed02d4740c13f0906dbdbc85043a53;hp=1e053e52b22837b3ed9df9554b337e25bf9da749;hpb=697435b249e1e2f308cc72c85180806cc0765249;p=ext%2Fsubsurface.git
diff --git a/gtk-gui.c b/gtk-gui.c
index 1e053e5..45aa212 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)
@@ -620,6 +626,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 +653,7 @@ static const gchar* ui_string = " \
\