From 8677721e85a344e29782cfc2ab838edb8da9215b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 3 May 2013 11:04:51 -0700 Subject: Remove the majority of the Gtk related code - rip all Gtk code from qt-gui.cpp - don't compile Gtk specific files - don't link against Gtk libraries - don't compile modules we don't use at all (yet) - use #if USE_GTK_UI on the remaining files to disable Gtk related parts - disable the non-functional Cochran support while I'm at it Signed-off-by: Dirk Hohndel --- download-dialog.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'download-dialog.c') diff --git a/download-dialog.c b/download-dialog.c index 5d5c1de04..729f3a6b6 100644 --- a/download-dialog.c +++ b/download-dialog.c @@ -3,19 +3,23 @@ #include "dive.h" #include "divelist.h" #include "display.h" +#if USE_GTK_UI #include "display-gtk.h" #include "callbacks-gtk.h" +#endif #include "libdivecomputer.h" const char *default_dive_computer_vendor; const char *default_dive_computer_product; const char *default_dive_computer_device; +#if USE_GTK_UI static gboolean force_download; static gboolean prefer_downloaded; OPTIONCALLBACK(force_toggle, force_download) OPTIONCALLBACK(prefer_dl_toggle, prefer_downloaded) +#endif struct product { const char *product; @@ -38,6 +42,7 @@ struct mydescriptor { struct vendor *dc_list; +#if USE_GTK_UI static void render_dc_vendor(GtkCellLayout *cell, GtkCellRenderer *renderer, GtkTreeModel *model, @@ -63,6 +68,7 @@ static void render_dc_product(GtkCellLayout *cell, product = dc_descriptor_get_product(descriptor); g_object_set(renderer, "text", product, NULL); } +#endif int is_default_dive_computer(const char *vendor, const char *product) { @@ -105,6 +111,7 @@ static void set_default_dive_computer_device(const char *name) subsurface_set_conf("dive_computer_device", name); } +#if USE_GTK_UI static void dive_computer_selector_changed(GtkWidget *combo, gpointer data) { GtkWidget *import, *button; @@ -149,7 +156,7 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog) gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0); return info; } - +#endif /* create a list of lists and keep the elements sorted */ static void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor) @@ -195,6 +202,7 @@ static void add_dc(const char *vendor, const char *product, dc_descriptor_t *des pl->descriptor = descriptor; } +#if USE_GTK_UI /* fill the vendors and create and fill the respective product stores; return the longest product name * and also the indices of the default vendor / product */ static int fill_computer_list(GtkListStore *vendorstore, GtkListStore ***productstore, int *vendor_index, int *product_index) @@ -469,3 +477,4 @@ void update_progressbar_text(progressbar_t *progress, const char *text) { gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress->bar), text); } +#endif -- cgit v1.2.3-70-g09d2 From 98414ac9a9ab927b475088a982ebaf8200c647c8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 3 May 2013 14:16:09 -0700 Subject: Fix compiler warnings Doing this on Arch Linux with gcc 4.8.0 helped find one real bug. The rest are simply changes to make static functions externally visible (as they are kept around to eventually become helpers used by Qt) which for now avoids the warnings. Signed-off-by: Dirk Hohndel --- divelist.c | 6 +++--- download-dialog.c | 6 +++--- equipment.c | 2 +- profile.c | 16 +++++++++------- 4 files changed, 16 insertions(+), 14 deletions(-) (limited to 'download-dialog.c') diff --git a/divelist.c b/divelist.c index e22dd331a..deab1b05c 100644 --- a/divelist.c +++ b/divelist.c @@ -620,12 +620,12 @@ char *get_nitrox_string(struct dive *dive) o2low = (o2low + 5) / 10; if (he) - snprintf(buffer, sizeof(buffer), "%d/%d", o2, he); + snprintf(buffer, MAX_NITROX_STRING, "%d/%d", o2, he); else if (o2) if (o2 == o2low) - snprintf(buffer, sizeof(buffer), "%d", o2); + snprintf(buffer, MAX_NITROX_STRING, "%d", o2); else - snprintf(buffer, sizeof(buffer), "%d" UTF8_ELLIPSIS "%d", o2low, o2); + snprintf(buffer, MAX_NITROX_STRING, "%d" UTF8_ELLIPSIS "%d", o2low, o2); else strcpy(buffer, _("air")); } diff --git a/download-dialog.c b/download-dialog.c index 729f3a6b6..e12b07abd 100644 --- a/download-dialog.c +++ b/download-dialog.c @@ -81,7 +81,7 @@ 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) +void set_default_dive_computer(const char *vendor, const char *product) { if (!vendor || !*vendor) return; @@ -99,7 +99,7 @@ static void set_default_dive_computer(const char *vendor, const char *product) subsurface_set_conf("dive_computer_product", product); } -static void set_default_dive_computer_device(const char *name) +void set_default_dive_computer_device(const char *name) { if (!name || !*name) return; @@ -159,7 +159,7 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog) #endif /* create a list of lists and keep the elements sorted */ -static void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor) +void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor) { struct vendor *dcl = dc_list; struct vendor **dclp = &dc_list; diff --git a/equipment.c b/equipment.c index 93f26dab1..4c692f33b 100644 --- a/equipment.c +++ b/equipment.c @@ -112,7 +112,7 @@ void convert_volume_pressure(int ml, int mbar, double *v, double *p) *v = volume; } -static int convert_weight(int grams, double *m) +int convert_weight(int grams, double *m) { int decimals = 1; /* not sure - do people do less than whole lbs/kg ? */ double weight; diff --git a/profile.c b/profile.c index f30ff1d06..b9a633cf6 100644 --- a/profile.c +++ b/profile.c @@ -18,7 +18,10 @@ int selected_dive = 0; char zoomed_plot = 0; char dc_number = 0; +#if USE_GTK_UI static double plot_scale = SCALE_SCREEN; +#endif + static struct plot_data *last_pi_entry = NULL; #define cairo_set_line_width_scaled(cr, w) \ @@ -228,7 +231,7 @@ static void dump_pi (struct plot_info *pi) * We also need to add 180 seconds at the end so the min/max * plots correctly */ -static int get_maxtime(struct plot_info *pi) +int get_maxtime(struct plot_info *pi) { int seconds = pi->maxtime; if (zoomed_plot) { @@ -251,7 +254,7 @@ static int get_maxtime(struct plot_info *pi) /* get the maximum depth to which we want to plot * take into account the additional verical space needed to plot * partial pressure graphs */ -static int get_maxdepth(struct plot_info *pi) +int get_maxdepth(struct plot_info *pi) { unsigned mm = pi->maxdepth; int md; @@ -1018,8 +1021,7 @@ static int get_cylinder_pressure_range(struct graphics_context *gc, struct plot_ * as compared to avg_sac; the calculation simply maps the delta between * sac and avg_sac to indexes 0 .. (SAC_COLORS - 1) with everything * more than 6000 ml/min below avg_sac mapped to 0 */ - -static void set_sac_color(struct graphics_context *gc, int sac, int avg_sac) +void set_sac_color(struct graphics_context *gc, int sac, int avg_sac) { int sac_index = 0; int delta = sac - avg_sac + 7000; @@ -1038,7 +1040,7 @@ static void set_sac_color(struct graphics_context *gc, int sac, int avg_sac) #endif /* USE_GTK_UI */ /* Get local sac-rate (in ml/min) between entry1 and entry2 */ -static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive) +int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive) { int index = entry1->cylinderindex; cylinder_t *cyl; @@ -1597,7 +1599,7 @@ static void check_gas_change_events(struct dive *dive, struct divecomputer *dc, set_cylinder_index(pi, i, cylinderindex, ~0u); } -static void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) +void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) { struct plot_info *pi; int maxdepth; @@ -1953,7 +1955,7 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d * sides, so that you can do end-points without having to worry * about it. */ -static struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) +struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) { struct plot_info *pi; -- cgit v1.2.3-70-g09d2