Require libzip, xslt and osm-gps-map in all builds

Conditional inclusion of libzip, xslt and osm-gps-map just
makes testing more cumbersome, since testers might lack
Subsurface features without knowing.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Henrik Brautaset Aronsen 2013-05-11 21:33:46 +02:00 committed by Dirk Hohndel
parent 5775905727
commit f5ef74202b
9 changed files with 4 additions and 89 deletions

4
dive.h
View file

@ -9,9 +9,7 @@
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#ifdef XSLT
#include <libxslt/transform.h> #include <libxslt/transform.h>
#endif
#include "sha1.h" #include "sha1.h"
@ -598,9 +596,7 @@ extern void save_dives(const char *filename);
extern void save_dives_logic(const char *filename, gboolean select_only); extern void save_dives_logic(const char *filename, gboolean select_only);
extern void save_dive(FILE *f, struct dive *dive); extern void save_dive(FILE *f, struct dive *dive);
#ifdef XSLT
extern xsltStylesheetPtr get_stylesheet(const char *name); extern xsltStylesheetPtr get_stylesheet(const char *name);
#endif
extern timestamp_t utc_mktime(struct tm *tm); extern timestamp_t utc_mktime(struct tm *tm);
extern void utc_mkdate(timestamp_t, struct tm *tm); extern void utc_mkdate(timestamp_t, struct tm *tm);

View file

@ -26,12 +26,8 @@
#include <math.h> #include <math.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <assert.h> #include <assert.h>
#ifdef LIBZIP
#include <zip.h> #include <zip.h>
#endif
#ifdef XSLT
#include <libxslt/transform.h> #include <libxslt/transform.h>
#endif
#include "dive.h" #include "dive.h"
#include "divelist.h" #include "divelist.h"
@ -985,16 +981,13 @@ static void edit_dive_when_cb(GtkWidget *menuitem, struct dive *dive)
} }
} }
#if HAVE_OSM_GPS_MAP
static void show_gps_location_cb(GtkWidget *menuitem, struct dive *dive) static void show_gps_location_cb(GtkWidget *menuitem, struct dive *dive)
{ {
show_gps_location(dive, NULL); show_gps_location(dive, NULL);
} }
#endif
gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data) gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data)
{ {
#if HAVE_OSM_GPS_MAP
GtkTreePath *path = NULL; GtkTreePath *path = NULL;
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeViewColumn *col; GtkTreeViewColumn *col;
@ -1015,7 +1008,6 @@ gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data)
if (path) if (path)
gtk_tree_path_free(path); gtk_tree_path_free(path);
} }
#endif
/* keep processing the click */ /* keep processing the click */
return FALSE; return FALSE;
} }
@ -1390,7 +1382,6 @@ void divelogs_status_dialog(char *error, GtkMessageType type)
} }
#if defined(LIBZIP) && defined(XSLT)
static void upload_dives_divelogs(const gboolean selected) static void upload_dives_divelogs(const gboolean selected)
{ {
int i; int i;
@ -1512,9 +1503,7 @@ void upload_all_dives_divelogs_cb()
{ {
upload_dives_divelogs(FALSE); upload_dives_divelogs(FALSE);
} }
#endif
#if defined(XSLT)
static void export_dives_uddf(const gboolean selected) static void export_dives_uddf(const gboolean selected)
{ {
FILE *f; FILE *f;
@ -1598,7 +1587,6 @@ void export_all_dives_uddf_cb()
{ {
export_dives_uddf(FALSE); export_dives_uddf(FALSE);
} }
#endif
static void merge_dives_cb(GtkWidget *menuitem, void *unused) static void merge_dives_cb(GtkWidget *menuitem, void *unused)
{ {
@ -1652,12 +1640,8 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
char deleteplurallabel[] = N_("Delete dives"); char deleteplurallabel[] = N_("Delete dives");
char deletesinglelabel[] = N_("Delete dive"); char deletesinglelabel[] = N_("Delete dive");
char *deletelabel; char *deletelabel;
#if defined(XSLT)
char exportuddflabel[] = N_("Export dive(s) to UDDF"); char exportuddflabel[] = N_("Export dive(s) to UDDF");
#endif
#if defined(LIBZIP) && defined(XSLT)
char uploaddivelogslabel[] = N_("Upload dive(s) to divelogs.de"); char uploaddivelogslabel[] = N_("Upload dive(s) to divelogs.de");
#endif
GtkTreePath *path, *prevpath, *nextpath; GtkTreePath *path, *prevpath, *nextpath;
GtkTreeIter iter, previter, nextiter; GtkTreeIter iter, previter, nextiter;
int idx, previdx, nextidx; int idx, previdx, nextidx;
@ -1736,17 +1720,13 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
g_signal_connect(menuitem, "activate", G_CALLBACK(delete_selected_dives_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(delete_selected_dives_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
#if defined(LIBZIP) && defined(XSLT)
menuitem = gtk_menu_item_new_with_label(_(uploaddivelogslabel)); menuitem = gtk_menu_item_new_with_label(_(uploaddivelogslabel));
g_signal_connect(menuitem, "activate", G_CALLBACK(upload_selected_dives_divelogs_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(upload_selected_dives_divelogs_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
#endif
#if defined(XSLT)
menuitem = gtk_menu_item_new_with_label(_(exportuddflabel)); menuitem = gtk_menu_item_new_with_label(_(exportuddflabel));
g_signal_connect(menuitem, "activate", G_CALLBACK(export_selected_dives_uddf_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(export_selected_dives_uddf_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
#endif
menuitem = gtk_menu_item_new_with_label(editlabel); menuitem = gtk_menu_item_new_with_label(editlabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_selected_dives_cb), NULL); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_selected_dives_cb), NULL);
@ -1770,14 +1750,12 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} }
#if HAVE_OSM_GPS_MAP
/* Only offer to show on map if it has a location. */ /* Only offer to show on map if it has a location. */
if (dive_has_gps_location(dive)) { if (dive_has_gps_location(dive)) {
menuitem = gtk_menu_item_new_with_label(_("Show in map")); menuitem = gtk_menu_item_new_with_label(_("Show in map"));
g_signal_connect(menuitem, "activate", G_CALLBACK(show_gps_location_cb), dive); g_signal_connect(menuitem, "activate", G_CALLBACK(show_gps_location_cb), dive);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} }
#endif
/* only offer trip editing options when we are displaying the tree model */ /* only offer trip editing options when we are displaying the tree model */
if (dive_list.model == dive_list.treemodel) { if (dive_list.model == dive_list.treemodel) {
int depth = gtk_tree_path_get_depth(path); int depth = gtk_tree_path_get_depth(path);

View file

@ -40,12 +40,8 @@
#include <math.h> #include <math.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <assert.h> #include <assert.h>
#ifdef LIBZIP
#include <zip.h> #include <zip.h>
#endif
#ifdef XSLT
#include <libxslt/transform.h> #include <libxslt/transform.h>
#endif
#include "dive.h" #include "dive.h"
#include "divelist.h" #include "divelist.h"

View file

@ -17,9 +17,7 @@ extern void show_and_select_dive(struct dive *dive);
extern double init_decompression(struct dive * dive); extern double init_decompression(struct dive * dive);
extern void export_all_dives_uddf_cb(); extern void export_all_dives_uddf_cb();
#if defined(LIBZIP) && defined(XSLT)
extern void upload_all_dives_divelogs_cb(); extern void upload_all_dives_divelogs_cb();
#endif
/* divelist core logic functions */ /* divelist core logic functions */
extern char *get_dive_date_string(struct tm *tm); extern char *get_dive_date_string(struct tm *tm);

12
file.c
View file

@ -5,6 +5,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <zip.h>
#include "dive.h" #include "dive.h"
#include "file.h" #include "file.h"
@ -59,8 +60,6 @@ out:
return ret; return ret;
} }
#ifdef LIBZIP
#include <zip.h>
static void zip_read(struct zip_file *file, GError **error, const char *filename) static void zip_read(struct zip_file *file, GError **error, const char *filename)
{ {
@ -76,12 +75,10 @@ static void zip_read(struct zip_file *file, GError **error, const char *filename
parse_xml_buffer(filename, mem, read, &dive_table, error); parse_xml_buffer(filename, mem, read, &dive_table, error);
free(mem); free(mem);
} }
#endif
static int try_to_open_zip(const char *filename, struct memblock *mem, GError **error) static int try_to_open_zip(const char *filename, struct memblock *mem, GError **error)
{ {
int success = 0; int success = 0;
#ifdef LIBZIP
/* Grr. libzip needs to re-open the file, it can't take a buffer */ /* Grr. libzip needs to re-open the file, it can't take a buffer */
struct zip *zip = zip_open(filename, ZIP_CHECKCONS, NULL); struct zip *zip = zip_open(filename, ZIP_CHECKCONS, NULL);
@ -97,16 +94,13 @@ static int try_to_open_zip(const char *filename, struct memblock *mem, GError **
} }
zip_close(zip); zip_close(zip);
} }
#endif
return success; return success;
} }
#ifdef SQLITE3
static int try_to_open_db(const char *filename, struct memblock *mem, GError **error) static int try_to_open_db(const char *filename, struct memblock *mem, GError **error)
{ {
return parse_dm4_buffer(filename, mem->buffer, mem->size, &dive_table, error); return parse_dm4_buffer(filename, mem->buffer, mem->size, &dive_table, error);
} }
#endif
static timestamp_t parse_date(const char *date) static timestamp_t parse_date(const char *date)
{ {
@ -266,9 +260,7 @@ static void parse_file_buffer(const char *filename, struct memblock *mem, GError
void parse_file(const char *filename, GError **error) void parse_file(const char *filename, GError **error)
{ {
struct memblock mem; struct memblock mem;
#ifdef SQLITE3
char *fmt; char *fmt;
#endif
if (readfile(filename, &mem) < 0) { if (readfile(filename, &mem) < 0) {
/* we don't want to display an error if this was the default file */ /* we don't want to display an error if this was the default file */
@ -286,7 +278,6 @@ void parse_file(const char *filename, GError **error)
return; return;
} }
#ifdef SQLITE3
fmt = strrchr(filename, '.'); fmt = strrchr(filename, '.');
if (fmt && (!strcasecmp(fmt + 1, "DB") || !strcasecmp(fmt + 1, "BAK"))) { if (fmt && (!strcasecmp(fmt + 1, "DB") || !strcasecmp(fmt + 1, "BAK"))) {
if (!try_to_open_db(filename, &mem, error)) { if (!try_to_open_db(filename, &mem, error)) {
@ -294,7 +285,6 @@ void parse_file(const char *filename, GError **error)
return; return;
} }
} }
#endif
parse_file_buffer(filename, &mem, error); parse_file_buffer(filename, &mem, error);
free(mem.buffer); free(mem.buffer);

View file

@ -29,9 +29,7 @@
#include <gdk-pixbuf/gdk-pixdata.h> #include <gdk-pixbuf/gdk-pixdata.h>
#include "subsurface-icon.h" #include "subsurface-icon.h"
#if HAVE_OSM_GPS_MAP
#include <osm-gps-map-source.h> #include <osm-gps-map-source.h>
#endif
GtkWidget *main_window; GtkWidget *main_window;
GtkWidget *main_vbox; GtkWidget *main_vbox;
@ -137,16 +135,12 @@ static GtkFileFilter *setup_filter(void)
gtk_file_filter_add_pattern(filter, "*.UDCF"); gtk_file_filter_add_pattern(filter, "*.UDCF");
gtk_file_filter_add_pattern(filter, "*.jlb"); gtk_file_filter_add_pattern(filter, "*.jlb");
gtk_file_filter_add_pattern(filter, "*.JLB"); gtk_file_filter_add_pattern(filter, "*.JLB");
#ifdef LIBZIP
gtk_file_filter_add_pattern(filter, "*.sde"); gtk_file_filter_add_pattern(filter, "*.sde");
gtk_file_filter_add_pattern(filter, "*.SDE"); gtk_file_filter_add_pattern(filter, "*.SDE");
gtk_file_filter_add_pattern(filter, "*.dld"); gtk_file_filter_add_pattern(filter, "*.dld");
gtk_file_filter_add_pattern(filter, "*.DLD"); gtk_file_filter_add_pattern(filter, "*.DLD");
#endif
#ifdef SQLITE3
gtk_file_filter_add_pattern(filter, "*.DB"); gtk_file_filter_add_pattern(filter, "*.DB");
gtk_file_filter_add_pattern(filter, "*.db"); gtk_file_filter_add_pattern(filter, "*.db");
#endif
gtk_file_filter_add_mime_type(filter, "text/xml"); gtk_file_filter_add_mime_type(filter, "text/xml");
gtk_file_filter_set_name(filter, _("XML file")); gtk_file_filter_set_name(filter, _("XML file"));
@ -724,7 +718,6 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
gtk_widget_set_sensitive(parent, TRUE); gtk_widget_set_sensitive(parent, TRUE);
} }
#if HAVE_OSM_GPS_MAP
static GtkWidget * map_provider_widget() static GtkWidget * map_provider_widget()
{ {
OsmGpsMapSource_t i; OsmGpsMapSource_t i;
@ -744,16 +737,13 @@ static GtkWidget * map_provider_widget()
gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), prefs.map_provider - 1); gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), prefs.map_provider - 1);
return combobox; return combobox;
} }
#endif
static void preferences_dialog(GtkWidget *w, gpointer data) static void preferences_dialog(GtkWidget *w, gpointer data)
{ {
int result; int result;
GtkWidget *dialog, *notebook, *font, *frame, *box, *hbox, *vbox, *button; GtkWidget *dialog, *notebook, *font, *frame, *box, *hbox, *vbox, *button;
GtkWidget *xmlfile_button; GtkWidget *xmlfile_button;
#if HAVE_OSM_GPS_MAP
GtkWidget *map_provider; GtkWidget *map_provider;
#endif
GtkWidget *entry_po2, *entry_pn2, *entry_phe, *entry_mod, *entry_gflow, *entry_gfhigh; GtkWidget *entry_po2, *entry_pn2, *entry_phe, *entry_mod, *entry_gflow, *entry_gfhigh;
const char *current_default, *new_default; const char *current_default, *new_default;
char threshold_text[10], mod_text[10], utf8_buf[128]; char threshold_text[10], mod_text[10], utf8_buf[128];
@ -868,12 +858,12 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
g_signal_connect(G_OBJECT(xmlfile_button), "clicked", g_signal_connect(G_OBJECT(xmlfile_button), "clicked",
G_CALLBACK(pick_default_file), xmlfile_button); G_CALLBACK(pick_default_file), xmlfile_button);
gtk_box_pack_start(GTK_BOX(hbox), xmlfile_button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(hbox), xmlfile_button, FALSE, FALSE, 6);
#if HAVE_OSM_GPS_MAP
frame = gtk_frame_new(_("Map provider")); frame = gtk_frame_new(_("Map provider"));
map_provider = map_provider_widget(); map_provider = map_provider_widget();
gtk_container_add(GTK_CONTAINER(frame), map_provider); gtk_container_add(GTK_CONTAINER(frame), map_provider);
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 3);
#endif
/* vbox that holds the second notebook page */ /* vbox that holds the second notebook page */
vbox = gtk_vbox_new(FALSE, 6); vbox = gtk_vbox_new(FALSE, 6);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
@ -1078,7 +1068,6 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
if (strcmp(current_default, new_default)) { if (strcmp(current_default, new_default)) {
prefs.default_filename = new_default; prefs.default_filename = new_default;
} }
#if HAVE_OSM_GPS_MAP
/* get the map provider selected */ /* get the map provider selected */
OsmGpsMapSource_t i; OsmGpsMapSource_t i;
#if GTK_CHECK_VERSION(2,24,0) #if GTK_CHECK_VERSION(2,24,0)
@ -1092,7 +1081,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
break; break;
} }
free((void *)provider); free((void *)provider);
#endif
save_preferences(); save_preferences();
dive_list_update_dives(); dive_list_update_dives();
} else if (result == GTK_RESPONSE_CANCEL) { } else if (result == GTK_RESPONSE_CANCEL) {
@ -1623,18 +1612,14 @@ static GtkActionEntry menu_items[] = {
{ "Print", GTK_STOCK_PRINT, N_("Print..."), CTRLCHAR "P", NULL, G_CALLBACK(do_print) }, { "Print", GTK_STOCK_PRINT, N_("Print..."), CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
{ "ImportFile", NULL, N_("Import File(s)..."), CTRLCHAR "I", NULL, G_CALLBACK(import_files) }, { "ImportFile", NULL, N_("Import File(s)..."), CTRLCHAR "I", NULL, G_CALLBACK(import_files) },
{ "ExportUDDF", NULL, N_("Export UDDF..."), NULL, NULL, G_CALLBACK(export_all_dives_uddf_cb) }, { "ExportUDDF", NULL, N_("Export UDDF..."), NULL, NULL, G_CALLBACK(export_all_dives_uddf_cb) },
#if defined(LIBZIP) && defined(XSLT)
{ "UploadDivelogs", NULL, N_("Upload to divelogs.de..."), NULL, NULL, G_CALLBACK(upload_all_dives_divelogs_cb) }, { "UploadDivelogs", NULL, N_("Upload to divelogs.de..."), NULL, NULL, G_CALLBACK(upload_all_dives_divelogs_cb) },
#endif
{ "DownloadLog", NULL, N_("Download From Dive Computer..."), CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) }, { "DownloadLog", NULL, N_("Download From Dive Computer..."), CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) },
{ "DownloadWeb", GTK_STOCK_CONNECT, N_("Download From Web Service..."), NULL, NULL, G_CALLBACK(webservice_download_dialog) }, { "DownloadWeb", GTK_STOCK_CONNECT, N_("Download From Web Service..."), NULL, NULL, G_CALLBACK(webservice_download_dialog) },
{ "AddDive", GTK_STOCK_ADD, N_("Add Dive..."), NULL, NULL, G_CALLBACK(add_dive_cb) }, { "AddDive", GTK_STOCK_ADD, N_("Add Dive..."), NULL, NULL, G_CALLBACK(add_dive_cb) },
{ "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences..."), PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences..."), PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, N_("Renumber..."), NULL, NULL, G_CALLBACK(renumber_dialog) }, { "Renumber", NULL, N_("Renumber..."), NULL, NULL, G_CALLBACK(renumber_dialog) },
{ "YearlyStats", NULL, N_("Yearly Statistics"), NULL, NULL, G_CALLBACK(show_yearly_stats) }, { "YearlyStats", NULL, N_("Yearly Statistics"), NULL, NULL, G_CALLBACK(show_yearly_stats) },
#if HAVE_OSM_GPS_MAP
{ "DivesLocations", NULL, N_("Dives Locations"), CTRLCHAR "M", NULL, G_CALLBACK(show_gps_locations) }, { "DivesLocations", NULL, N_("Dives Locations"), CTRLCHAR "M", NULL, G_CALLBACK(show_gps_locations) },
#endif
{ "SelectEvents", NULL, N_("Select Events..."), NULL, NULL, G_CALLBACK(selectevents_dialog) }, { "SelectEvents", NULL, N_("Select Events..."), NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "SelectTags", NULL, N_("Select Tags..."), NULL, NULL, G_CALLBACK(selecttags_dialog) }, { "SelectTags", NULL, N_("Select Tags..."), NULL, NULL, G_CALLBACK(selecttags_dialog) },
{ "Quit", GTK_STOCK_QUIT, N_("Quit"), CTRLCHAR "Q", NULL, G_CALLBACK(quit) }, { "Quit", GTK_STOCK_QUIT, N_("Quit"), CTRLCHAR "Q", NULL, G_CALLBACK(quit) },
@ -1669,9 +1654,7 @@ static const gchar* ui_string = " \
<separator name=\"Separator1\"/> \ <separator name=\"Separator1\"/> \
<menuitem name=\"Import XML File\" action=\"ImportFile\" /> \ <menuitem name=\"Import XML File\" action=\"ImportFile\" /> \
<menuitem name=\"Export to UDDF File\" action=\"ExportUDDF\" />" <menuitem name=\"Export to UDDF File\" action=\"ExportUDDF\" />"
#if defined(LIBZIP) && defined(XSLT)
"<menuitem name=\"Upload to divelogs.de\" action=\"UploadDivelogs\" />" "<menuitem name=\"Upload to divelogs.de\" action=\"UploadDivelogs\" />"
#endif
"<separator name=\"Separator2\"/> \ "<separator name=\"Separator2\"/> \
<menuitem name=\"Print\" action=\"Print\" /> \ <menuitem name=\"Print\" action=\"Print\" /> \
<separator name=\"Separator3\"/> \ <separator name=\"Separator3\"/> \
@ -1690,9 +1673,7 @@ static const gchar* ui_string = " \
<menuitem name=\"Autogroup\" action=\"Autogroup\" /> \ <menuitem name=\"Autogroup\" action=\"Autogroup\" /> \
<menuitem name=\"Toggle Zoom\" action=\"ToggleZoom\" /> \ <menuitem name=\"Toggle Zoom\" action=\"ToggleZoom\" /> \
<menuitem name=\"YearlyStats\" action=\"YearlyStats\" />" <menuitem name=\"YearlyStats\" action=\"YearlyStats\" />"
#if HAVE_OSM_GPS_MAP
"<menuitem name=\"Dive Locations\" action=\"DivesLocations\" /> " "<menuitem name=\"Dive Locations\" action=\"DivesLocations\" /> "
#endif
"</menu> \ "</menu> \
<menu name=\"ViewMenu\" action=\"ViewMenuAction\"> \ <menu name=\"ViewMenu\" action=\"ViewMenuAction\"> \
<menuitem name=\"List\" action=\"ViewList\" /> \ <menuitem name=\"List\" action=\"ViewList\" /> \

View file

@ -397,7 +397,6 @@ static void update_gps_entry(int lat, int lon)
} }
} }
#if HAVE_OSM_GPS_MAP
static void update_gps_entry_callback(float lat, float lon) static void update_gps_entry_callback(float lat, float lon)
{ {
update_gps_entry(lat * 1000000, lon * 1000000); update_gps_entry(lat * 1000000, lon * 1000000);
@ -420,7 +419,6 @@ static gboolean gps_map_callback(GtkWidget *w, gpointer data)
show_gps_location(&fake_dive, update_gps_entry_callback); show_gps_location(&fake_dive, update_gps_entry_callback);
return TRUE; return TRUE;
} }
#endif
/* /*
* If somebody sets the string by editing the text entry, * If somebody sets the string by editing the text entry,
@ -524,9 +522,7 @@ void divetag_toggle_cb(GtkWidget *widget, gpointer data)
static void dive_info_widget(GtkWidget *obox, struct dive *dive, struct dive_info *info, int multi, int *show_tags) static void dive_info_widget(GtkWidget *obox, struct dive *dive, struct dive_info *info, int multi, int *show_tags)
{ {
GtkWidget *hbox, *frame, *equipment, *ibox, *box, *button, *sbox, *framebox; GtkWidget *hbox, *frame, *equipment, *ibox, *box, *button, *sbox, *framebox;
#if HAVE_OSM_GPS_MAP
GtkWidget *image; GtkWidget *image;
#endif
char buffer[256]; char buffer[256];
char airtemp[10]; char airtemp[10];
const char *unit; const char *unit;
@ -566,7 +562,6 @@ static void dive_info_widget(GtkWidget *obox, struct dive *dive, struct dive_inf
gtk_widget_add_events(GTK_WIDGET(info->gps), GDK_FOCUS_CHANGE_MASK); gtk_widget_add_events(GTK_WIDGET(info->gps), GDK_FOCUS_CHANGE_MASK);
g_signal_connect(G_OBJECT(info->gps), "focus-out-event", G_CALLBACK(gps_entry_change_cb), NULL); g_signal_connect(G_OBJECT(info->gps), "focus-out-event", G_CALLBACK(gps_entry_change_cb), NULL);
gtk_entry_set_width_chars(info->gps, 30); gtk_entry_set_width_chars(info->gps, 30);
#if HAVE_OSM_GPS_MAP
info->gps_icon = gtk_button_new_with_label(_("Pick on map")); info->gps_icon = gtk_button_new_with_label(_("Pick on map"));
gtk_box_pack_start(GTK_BOX(hbox), info->gps_icon, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(hbox), info->gps_icon, FALSE, FALSE, 6);
image = gtk_image_new_from_pixbuf(get_gps_icon()); image = gtk_image_new_from_pixbuf(get_gps_icon());
@ -574,7 +569,6 @@ static void dive_info_widget(GtkWidget *obox, struct dive *dive, struct dive_inf
gtk_button_set_image(GTK_BUTTON(info->gps_icon), image); gtk_button_set_image(GTK_BUTTON(info->gps_icon), image);
g_signal_connect(G_OBJECT(info->gps_icon), "clicked", G_CALLBACK(gps_map_callback), NULL); g_signal_connect(G_OBJECT(info->gps_icon), "clicked", G_CALLBACK(gps_map_callback), NULL);
#endif
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);

4
main.c
View file

@ -10,9 +10,7 @@
#include "dive.h" #include "dive.h"
#include "divelist.h" #include "divelist.h"
#if HAVE_OSM_GPS_MAP
#include <osm-gps-map.h> #include <osm-gps-map.h>
#endif
#ifdef DEBUGFILE #ifdef DEBUGFILE
char *debugfilename; char *debugfilename;
FILE *debugfile; FILE *debugfile;
@ -38,9 +36,7 @@ struct preferences default_prefs = {
.calc_ceiling_3m_incr = FALSE, .calc_ceiling_3m_incr = FALSE,
.gflow = 0.30, .gflow = 0.30,
.gfhigh = 0.75, .gfhigh = 0.75,
#if HAVE_OSM_GPS_MAP
.map_provider = OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID, .map_provider = OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID,
#endif
}; };
/* random helper functions, used here or elsewhere */ /* random helper functions, used here or elsewhere */

View file

@ -10,14 +10,9 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#ifdef XSLT
#include <libxslt/transform.h> #include <libxslt/transform.h>
#endif
#include <glib/gi18n.h> #include <glib/gi18n.h>
#ifdef SQLITE3
#include<sqlite3.h> #include<sqlite3.h>
#endif
#include "dive.h" #include "dive.h"
#include "device.h" #include "device.h"
@ -1601,15 +1596,12 @@ void parse_xml_buffer(const char *url, const char *buffer, int size,
} }
reset_all(); reset_all();
dive_start(); dive_start();
#ifdef XSLT
doc = test_xslt_transforms(doc, error); doc = test_xslt_transforms(doc, error);
#endif
traverse(xmlDocGetRootElement(doc)); traverse(xmlDocGetRootElement(doc));
dive_end(); dive_end();
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }
#ifdef SQLITE3
extern int dm4_events(void *handle, int columns, char **data, char **column) extern int dm4_events(void *handle, int columns, char **data, char **column)
{ {
event_start(); event_start();
@ -1816,12 +1808,10 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
*/ */
return SQLITE_OK; return SQLITE_OK;
} }
#endif
int parse_dm4_buffer(const char *url, const char *buffer, int size, int parse_dm4_buffer(const char *url, const char *buffer, int size,
struct dive_table *table, GError **error) struct dive_table *table, GError **error)
{ {
#ifdef SQLITE3
int retval; int retval;
char *err = NULL; char *err = NULL;
sqlite3 *handle; sqlite3 *handle;
@ -1846,7 +1836,6 @@ int parse_dm4_buffer(const char *url, const char *buffer, int size,
} }
sqlite3_close(handle); sqlite3_close(handle);
#endif
return 0; return 0;
} }
@ -1860,8 +1849,6 @@ void parse_xml_exit(void)
xmlCleanupParser(); xmlCleanupParser();
} }
#ifdef XSLT
/* Maybe we'll want a environment variable that can override this.. */ /* Maybe we'll want a environment variable that can override this.. */
static const char *xslt_path = XSLT ":xslt:."; static const char *xslt_path = XSLT ":xslt:.";
@ -1962,4 +1949,3 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, GError **error)
} }
return doc; return doc;
} }
#endif