summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-05 00:29:09 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-06 10:41:44 -0700
commit4b12f28ca453b038fdeca8e6ada106e0c157296b (patch)
treeae6c72da921baf80870ea57a5ec4ea9126fe201c /divelist.c
parent3e0ecb5ff6a95e1be8f22359048e4dfa85d165bc (diff)
downloadsubsurface-4b12f28ca453b038fdeca8e6ada106e0c157296b.tar.gz
First steps towards removing glib dependencies
- remove the build flags and libraries from the Makefile / Configure.mk - remove the glib types (gboolean, gchar, gint64, gint) - comment out / hack around gettext - replace the glib file helper functions - replace g_ascii_strtod - replace g_build_filename - use environment variables instead of g_get_home_dir() & g_get_user_name() - comment out GPS string parsing (uses glib utf8 macros) This needs massive cleanup, but it's a snapshot of what I have right now, in case people want to look at it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/divelist.c b/divelist.c
index d5ee9b71a..5bc175170 100644
--- a/divelist.c
+++ b/divelist.c
@@ -38,7 +38,11 @@
#include <string.h>
#include <time.h>
#include <math.h>
+#if 0
#include <glib/gi18n.h>
+#else /* stupid */
+#define _(arg) arg
+#endif
#include <assert.h>
#include <zip.h>
#include <libxslt/transform.h>
@@ -71,7 +75,7 @@ void dump_selection(void)
}
#endif
-void set_autogroup(gboolean value)
+void set_autogroup(bool value)
{
/* if we keep the UI paradigm, this needs to toggle
* the checkbox on the autogroup menu item */
@@ -456,7 +460,7 @@ double init_decompression(struct dive *dive)
int i, divenr = -1;
unsigned int surface_time;
timestamp_t when, lasttime = 0;
- gboolean deco_init = FALSE;
+ bool deco_init = FALSE;
double tissue_tolerance, surface_pressure;
if (!dive)
@@ -534,6 +538,7 @@ void update_cylinder_related_info(struct dive *dive)
}
}
+#if USE_GTK_UI
static void get_string(char **str, const char *s)
{
int len;
@@ -563,6 +568,7 @@ void get_suit(struct dive *dive, char **str)
{
get_string(str, dive->suit);
}
+#endif
#define MAX_DATE_STRING 256
/* caller needs to free the string */
@@ -606,13 +612,24 @@ char *get_trip_date_string(timestamp_t when, int nr)
if (buffer) {
struct tm tm;
utc_mkdate(when, &tm);
- snprintf(buffer, MAX_DATE_STRING,
- /*++GETTEXT 60 char buffer monthname, year, nr dives */
- ngettext("%1$s %2$d (%3$d dive)",
- "%1$s %2$d (%3$d dives)", nr),
- monthname(tm.tm_mon),
- tm.tm_year + 1900,
- nr);
+ if (nr != 1) {
+ snprintf(buffer, MAX_DATE_STRING,
+#if 0
+ /*++GETTEXT 60 char buffer monthname, year, nr dives */
+ ngettext("%1$s %2$d (%3$d dive)",
+ "%1$s %2$d (%3$d dives)", nr),
+#else
+ _("%1$s %2$d (%3$d dives)"),
+#endif
+ monthname(tm.tm_mon),
+ tm.tm_year + 1900,
+ nr);
+ } else {
+ snprintf(buffer, MAX_DATE_STRING,
+ _("%1$s %2$d (1 dive)"),
+ monthname(tm.tm_mon),
+ tm.tm_year + 1900);
+ }
}
return buffer;
}