diff options
author | Henrik Brautaset Aronsen <subsurface@henrik.synth.no> | 2013-05-11 21:33:46 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-11 22:02:24 -0700 |
commit | f5ef74202b8295400e5f26d1fa80b90223f822da (patch) | |
tree | a513e68f368055bf2f194dc662fb4d87d2d2a889 | |
parent | 5775905727150b4f2f5556b84814acdc46e2d717 (diff) | |
download | subsurface-f5ef74202b8295400e5f26d1fa80b90223f822da.tar.gz |
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>
-rw-r--r-- | dive.h | 4 | ||||
-rw-r--r-- | divelist-gtk.c | 22 | ||||
-rw-r--r-- | divelist.c | 4 | ||||
-rw-r--r-- | divelist.h | 2 | ||||
-rw-r--r-- | file.c | 12 | ||||
-rw-r--r-- | gtk-gui.c | 25 | ||||
-rw-r--r-- | info-gtk.c | 6 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | parse-xml.c | 14 |
9 files changed, 4 insertions, 89 deletions
@@ -9,9 +9,7 @@ #include <glib.h> #include <glib/gstdio.h> #include <libxml/tree.h> -#ifdef XSLT #include <libxslt/transform.h> -#endif #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_dive(FILE *f, struct dive *dive); -#ifdef XSLT extern xsltStylesheetPtr get_stylesheet(const char *name); -#endif extern timestamp_t utc_mktime(struct tm *tm); extern void utc_mkdate(timestamp_t, struct tm *tm); diff --git a/divelist-gtk.c b/divelist-gtk.c index e46fb34b9..c2ae5fed5 100644 --- a/divelist-gtk.c +++ b/divelist-gtk.c @@ -26,12 +26,8 @@ #include <math.h> #include <glib/gi18n.h> #include <assert.h> -#ifdef LIBZIP #include <zip.h> -#endif -#ifdef XSLT #include <libxslt/transform.h> -#endif #include "dive.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) { show_gps_location(dive, NULL); } -#endif gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data) { -#if HAVE_OSM_GPS_MAP GtkTreePath *path = NULL; GtkTreeIter iter; GtkTreeViewColumn *col; @@ -1015,7 +1008,6 @@ gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data) if (path) gtk_tree_path_free(path); } -#endif /* keep processing the click */ 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) { int i; @@ -1512,9 +1503,7 @@ void upload_all_dives_divelogs_cb() { upload_dives_divelogs(FALSE); } -#endif -#if defined(XSLT) static void export_dives_uddf(const gboolean selected) { FILE *f; @@ -1598,7 +1587,6 @@ void export_all_dives_uddf_cb() { export_dives_uddf(FALSE); } -#endif 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 deletesinglelabel[] = N_("Delete dive"); char *deletelabel; -#if defined(XSLT) char exportuddflabel[] = N_("Export dive(s) to UDDF"); -#endif -#if defined(LIBZIP) && defined(XSLT) char uploaddivelogslabel[] = N_("Upload dive(s) to divelogs.de"); -#endif GtkTreePath *path, *prevpath, *nextpath; GtkTreeIter iter, previter, nextiter; 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); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -#if defined(LIBZIP) && defined(XSLT) menuitem = gtk_menu_item_new_with_label(_(uploaddivelogslabel)); g_signal_connect(menuitem, "activate", G_CALLBACK(upload_selected_dives_divelogs_cb), path); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -#endif -#if defined(XSLT) menuitem = gtk_menu_item_new_with_label(_(exportuddflabel)); g_signal_connect(menuitem, "activate", G_CALLBACK(export_selected_dives_uddf_cb), path); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -#endif menuitem = gtk_menu_item_new_with_label(editlabel); 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); 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. */ if (dive_has_gps_location(dive)) { menuitem = gtk_menu_item_new_with_label(_("Show in map")); g_signal_connect(menuitem, "activate", G_CALLBACK(show_gps_location_cb), dive); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); } -#endif /* only offer trip editing options when we are displaying the tree model */ if (dive_list.model == dive_list.treemodel) { int depth = gtk_tree_path_get_depth(path); diff --git a/divelist.c b/divelist.c index 3be95e3e9..fcbc7e59c 100644 --- a/divelist.c +++ b/divelist.c @@ -40,12 +40,8 @@ #include <math.h> #include <glib/gi18n.h> #include <assert.h> -#ifdef LIBZIP #include <zip.h> -#endif -#ifdef XSLT #include <libxslt/transform.h> -#endif #include "dive.h" #include "divelist.h" diff --git a/divelist.h b/divelist.h index 5d30e9b1d..23e22190d 100644 --- a/divelist.h +++ b/divelist.h @@ -17,9 +17,7 @@ extern void show_and_select_dive(struct dive *dive); extern double init_decompression(struct dive * dive); extern void export_all_dives_uddf_cb(); -#if defined(LIBZIP) && defined(XSLT) extern void upload_all_dives_divelogs_cb(); -#endif /* divelist core logic functions */ extern char *get_dive_date_string(struct tm *tm); @@ -5,6 +5,7 @@ #include <string.h> #include <errno.h> #include <glib/gi18n.h> +#include <zip.h> #include "dive.h" #include "file.h" @@ -59,8 +60,6 @@ out: return ret; } -#ifdef LIBZIP -#include <zip.h> 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); free(mem); } -#endif static int try_to_open_zip(const char *filename, struct memblock *mem, GError **error) { int success = 0; -#ifdef LIBZIP /* Grr. libzip needs to re-open the file, it can't take a buffer */ 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); } -#endif return success; } -#ifdef SQLITE3 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); } -#endif 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) { struct memblock mem; -#ifdef SQLITE3 char *fmt; -#endif if (readfile(filename, &mem) < 0) { /* 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; } -#ifdef SQLITE3 fmt = strrchr(filename, '.'); if (fmt && (!strcasecmp(fmt + 1, "DB") || !strcasecmp(fmt + 1, "BAK"))) { if (!try_to_open_db(filename, &mem, error)) { @@ -294,7 +285,6 @@ void parse_file(const char *filename, GError **error) return; } } -#endif parse_file_buffer(filename, &mem, error); free(mem.buffer); @@ -29,9 +29,7 @@ #include <gdk-pixbuf/gdk-pixdata.h> #include "subsurface-icon.h" -#if HAVE_OSM_GPS_MAP #include <osm-gps-map-source.h> -#endif GtkWidget *main_window; 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, "*.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, "*.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"); -#endif gtk_file_filter_add_mime_type(filter, "text/xml"); 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); } -#if HAVE_OSM_GPS_MAP static GtkWidget * map_provider_widget() { 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); return combobox; } -#endif static void preferences_dialog(GtkWidget *w, gpointer data) { int result; GtkWidget *dialog, *notebook, *font, *frame, *box, *hbox, *vbox, *button; GtkWidget *xmlfile_button; -#if HAVE_OSM_GPS_MAP GtkWidget *map_provider; -#endif GtkWidget *entry_po2, *entry_pn2, *entry_phe, *entry_mod, *entry_gflow, *entry_gfhigh; const char *current_default, *new_default; 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_CALLBACK(pick_default_file), xmlfile_button); gtk_box_pack_start(GTK_BOX(hbox), xmlfile_button, FALSE, FALSE, 6); -#if HAVE_OSM_GPS_MAP + frame = gtk_frame_new(_("Map provider")); map_provider = map_provider_widget(); gtk_container_add(GTK_CONTAINER(frame), map_provider); gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 3); -#endif + /* vbox that holds the second notebook page */ vbox = gtk_vbox_new(FALSE, 6); 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)) { prefs.default_filename = new_default; } -#if HAVE_OSM_GPS_MAP /* get the map provider selected */ OsmGpsMapSource_t i; #if GTK_CHECK_VERSION(2,24,0) @@ -1092,7 +1081,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data) break; } free((void *)provider); -#endif + save_preferences(); dive_list_update_dives(); } 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) }, { "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) }, -#if defined(LIBZIP) && defined(XSLT) { "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) }, { "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) }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences..."), PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) }, { "Renumber", NULL, N_("Renumber..."), NULL, NULL, G_CALLBACK(renumber_dialog) }, { "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) }, -#endif { "SelectEvents", NULL, N_("Select Events..."), NULL, NULL, G_CALLBACK(selectevents_dialog) }, { "SelectTags", NULL, N_("Select Tags..."), NULL, NULL, G_CALLBACK(selecttags_dialog) }, { "Quit", GTK_STOCK_QUIT, N_("Quit"), CTRLCHAR "Q", NULL, G_CALLBACK(quit) }, @@ -1669,9 +1654,7 @@ static const gchar* ui_string = " \ <separator name=\"Separator1\"/> \ <menuitem name=\"Import XML File\" action=\"ImportFile\" /> \ <menuitem name=\"Export to UDDF File\" action=\"ExportUDDF\" />" -#if defined(LIBZIP) && defined(XSLT) "<menuitem name=\"Upload to divelogs.de\" action=\"UploadDivelogs\" />" -#endif "<separator name=\"Separator2\"/> \ <menuitem name=\"Print\" action=\"Print\" /> \ <separator name=\"Separator3\"/> \ @@ -1690,9 +1673,7 @@ static const gchar* ui_string = " \ <menuitem name=\"Autogroup\" action=\"Autogroup\" /> \ <menuitem name=\"Toggle Zoom\" action=\"ToggleZoom\" /> \ <menuitem name=\"YearlyStats\" action=\"YearlyStats\" />" -#if HAVE_OSM_GPS_MAP "<menuitem name=\"Dive Locations\" action=\"DivesLocations\" /> " -#endif "</menu> \ <menu name=\"ViewMenu\" action=\"ViewMenuAction\"> \ <menuitem name=\"List\" action=\"ViewList\" /> \ diff --git a/info-gtk.c b/info-gtk.c index 4ed945791..39325f6f3 100644 --- a/info-gtk.c +++ b/info-gtk.c @@ -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) { 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); return TRUE; } -#endif /* * 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) { GtkWidget *hbox, *frame, *equipment, *ibox, *box, *button, *sbox, *framebox; -#if HAVE_OSM_GPS_MAP GtkWidget *image; -#endif char buffer[256]; char airtemp[10]; 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); 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); -#if HAVE_OSM_GPS_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); 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); g_signal_connect(G_OBJECT(info->gps_icon), "clicked", G_CALLBACK(gps_map_callback), NULL); -#endif hbox = gtk_hbox_new(FALSE, 3); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0); @@ -10,9 +10,7 @@ #include "dive.h" #include "divelist.h" -#if HAVE_OSM_GPS_MAP #include <osm-gps-map.h> -#endif #ifdef DEBUGFILE char *debugfilename; FILE *debugfile; @@ -38,9 +36,7 @@ struct preferences default_prefs = { .calc_ceiling_3m_incr = FALSE, .gflow = 0.30, .gfhigh = 0.75, -#if HAVE_OSM_GPS_MAP .map_provider = OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID, -#endif }; /* random helper functions, used here or elsewhere */ diff --git a/parse-xml.c b/parse-xml.c index 4636a000c..ac6e63eba 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -10,14 +10,9 @@ #include <libxml/parser.h> #include <libxml/parserInternals.h> #include <libxml/tree.h> -#ifdef XSLT #include <libxslt/transform.h> -#endif #include <glib/gi18n.h> - -#ifdef SQLITE3 #include<sqlite3.h> -#endif #include "dive.h" #include "device.h" @@ -1601,15 +1596,12 @@ void parse_xml_buffer(const char *url, const char *buffer, int size, } reset_all(); dive_start(); -#ifdef XSLT doc = test_xslt_transforms(doc, error); -#endif traverse(xmlDocGetRootElement(doc)); dive_end(); xmlFreeDoc(doc); } -#ifdef SQLITE3 extern int dm4_events(void *handle, int columns, char **data, char **column) { event_start(); @@ -1816,12 +1808,10 @@ extern int dm4_dive(void *param, int columns, char **data, char **column) */ return SQLITE_OK; } -#endif int parse_dm4_buffer(const char *url, const char *buffer, int size, struct dive_table *table, GError **error) { -#ifdef SQLITE3 int retval; char *err = NULL; sqlite3 *handle; @@ -1846,7 +1836,6 @@ int parse_dm4_buffer(const char *url, const char *buffer, int size, } sqlite3_close(handle); -#endif return 0; } @@ -1860,8 +1849,6 @@ void parse_xml_exit(void) xmlCleanupParser(); } -#ifdef XSLT - /* Maybe we'll want a environment variable that can override this.. */ static const char *xslt_path = XSLT ":xslt:."; @@ -1962,4 +1949,3 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, GError **error) } return doc; } -#endif |