From: Evan Battaglia Date: Sat, 1 Oct 2005 07:52:50 +0000 (+0000) Subject: make symbols work for geocaching .loc X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/08b251ecfe7ae7a2330073967ba0316758b56c78 make symbols work for geocaching .loc --- diff --git a/ChangeLog b/ChangeLog index e0f11131..a88c29bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-10-01 +Evan Battaglia : + * make symbols work for geocaching .loc files (and case-insensitive symbol names) + 2005-09-30 Guilhem BONNEFILLE * configure.ac, src/Makefile.am (SUBDIRS): added auto-tools support for src/icons Alex Foobarian : diff --git a/TODO b/TODO index 9f114636..bd1de51f 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,10 @@ TODO till release 0.1.1: IMPORTANT STUFF: -X GPX symbols Option as to whether or not to show waypoint symbols (we may want to show 'x's or something, and may have a lot of wpt_dot icons) Option as to whether or not to show unit scale (esp for exporting images) fix save file thing check out bgitemcount stuff in background.c (hangs on clear!) g_dtostr instead of fprintf in the appropriate places -X DND: make it an interface, so we don't mention VikTrwLayer in viktreeview.c -X DND: when moving layers, take into account the layer we're moving onto - and move it above. -X (DND?) fix "(viking:3671): Gtk-CRITICAL **: gtk_tree_model_get_iter: assertion `path->depth > 0' failed" Debugging output shouldn't be printf'd but we g_print'd, and we should have a DEBUG flag BIG THINGS: diff --git a/src/garminsymbols.c b/src/garminsymbols.c index 73a0fd4e..78d3c892 100644 --- a/src/garminsymbols.c +++ b/src/garminsymbols.c @@ -304,8 +304,28 @@ struct { GHashTable *icons = NULL; +/* found via Google, from Sylpheed/GPL and/or gstring.c in Glib */ +static gint g_str_case_equal(gconstpointer v, gconstpointer v2) +{ + return strcasecmp((const gchar *)v, (const gchar *)v2) == 0; +} + +static guint g_str_case_hash(gconstpointer key) +{ + const gchar *p = key; + guint h = *p; + + if (h) { + h = tolower(h); + for (p += 1; *p != '\0'; p++) + h = (h << 5) - h + tolower(*p); + } + + return h; +} + static void init_icons() { - icons = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, NULL); + icons = g_hash_table_new_full ( g_str_case_hash, g_str_case_equal, NULL, NULL); gint i; for (i=0; i