X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=gtk-gui.c;h=f7d3c500886ad69406efa336547af48daf9c4026;hb=e6ecddfa3d17901847474b67b6121c0c8f56f078;hp=ca033835d31630a9144fdbb3505a2a612f9ca267;hpb=c8f3dc3594aa850829ab87ac7d290776dfb846bd;p=ext%2Fsubsurface.git
diff --git a/gtk-gui.c b/gtk-gui.c
index ca03383..f7d3c50 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -31,21 +31,43 @@ 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 void set_default_dive_computer(const char *name)
+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 *vendor, const char *product)
+{
+ if (!vendor || !*vendor)
+ return;
+ if (!product || !*product)
+ return;
+ if (is_default_dive_computer(vendor, product))
+ return;
+ 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)
{
if (!name || !*name)
return;
- if (is_default_dive_computer(name))
+ if (is_default_dive_computer_device(name))
return;
- default_dive_computer = name;
- subsurface_set_conf("dive_computer", PREF_STRING, name);
+ default_dive_computer_device = name;
+ subsurface_set_conf("dive_computer_device", PREF_STRING, name);
}
void repaint_dive(void)
@@ -604,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) },
@@ -624,13 +647,14 @@ static const gchar* ui_string = " \
\
\
\
- \
- \
\
- \
+ \
\
\