]> git.street.me.uk Git - andy/viking.git/commitdiff
make symbols work for geocaching .loc
authorEvan Battaglia <gtoevan@gmx.net>
Sat, 1 Oct 2005 07:52:50 +0000 (07:52 +0000)
committerEvan Battaglia <gtoevan@gmx.net>
Sat, 1 Oct 2005 07:52:50 +0000 (07:52 +0000)
ChangeLog
TODO
src/garminsymbols.c
src/gpx.c
src/icons.h

index e0f11131089489ae13365802e6dd41b313e99d45..a88c29bfe83ae6555b329b1d0f50d604c1add52a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-10-01
+Evan Battaglia <gtoevan@gmx.net>:
+       * make symbols work for geocaching .loc files (and case-insensitive symbol names)
+
 2005-09-30  Guilhem BONNEFILLE  <guilhem.bonnefille@laposte.net>
        * configure.ac, src/Makefile.am (SUBDIRS): added auto-tools support for src/icons
 Alex Foobarian <foobarian@gmail.com>:
diff --git a/TODO b/TODO
index 9f11463675a0b3aa634116d0540432c5950db3d3..bd1de51f34e6b0c9ac98dea5a364712a7fe09f4b 100644 (file)
--- 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:
index 73a0fd4e62811de03a10e471084737a209681665..78d3c892daf88d0d3610cde7a7f4b1c763abd2de 100644 (file)
@@ -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<G_N_ELEMENTS(garmin_syms); i++) {
     g_hash_table_insert(icons, garmin_syms[i].sym, (gpointer)i);
index f290831fdf27ae95e21e38ec913b0e5c230fb967..f030d6c0cec4d35ea72ffdf9865163df1f3efd0f 100644 (file)
--- a/src/gpx.c
+++ b/src/gpx.c
@@ -81,6 +81,7 @@ tag_mapping tag_path_map[] = {
         { tt_wpt_name, "/gpx/wpt/name" },
         { tt_wpt_desc, "/gpx/wpt/desc" },
         { tt_wpt_sym, "/gpx/wpt/sym" },
+        { tt_wpt_sym, "/loc/waypoint/type" },
         { tt_wpt_link, "/gpx/wpt/link" },                    /* GPX 1.1 */
 
         { tt_trk, "/gpx/trk" },
index 0322c876c521bf9f27c6bfb6c9d9aff2b2ddd5b1..b02396173537a422415d86843a88487d145dad72 100644 (file)
@@ -12,8 +12,8 @@
 #include "icons/wp_car.png_h"
 #include "icons/wp_deer.png_h"
 #include "icons/wp_flag.png_h"
-#include "icons/wp_geocache_fnd.png_h"
 #include "icons/wp_geocache.png_h"
+#include "icons/wp_geocache_fnd.png_h"
 #include "icons/wp_house.png_h"
 #include "icons/wp_wpt_dot.png_h"
 #include "icons/zoom_18.png_h"