]> git.street.me.uk Git - andy/viking.git/blob - src/garminsymbols.c
Fix crashing on invoking the Customize Toolbar from the preferences dialog.
[andy/viking.git] / src / garminsymbols.c
1 /*
2  * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
3  *
4  * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
5  * Copyright (C) 2005, Alex Foobarian <foobarian@gmail.com>
6  * Copyright (C) 2008, Quy Tonthat <qtonthat@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  */
23
24 #include "viking.h"
25 #include "garminsymbols.h"
26 #include "icons/icons.h"
27
28 #include <string.h>
29 #include <stdlib.h>
30
31 static struct {
32   gchar *sym;     /* icon names used by gpsbabel, garmin */
33   gchar *old_sym; /* keep backward compatible */
34   gint num;
35   gchar *desc;
36   const GdkPixdata *data;
37   const GdkPixdata *data_large;
38   GdkPixbuf *icon;
39 } garmin_syms[] = {
40   /* "sym" are in 'Title Case' like in gpsbabel. This is needed for
41    * devices like Garmin Oregon 450. Old exports with lower case
42    * identifiers will be automatically converted to the version defined
43    * inside the table by vikwaypoint.c:vik_waypoint_set_symbol().
44    * The hash itself tries to keep all operations case independent
45    * using str_equal_casefold() and str_hash_casefold(). This is
46    * necessary to allow a_get_hashed_sym() to match the lower case
47    * version with the identifier stored in "sym".
48    */
49   /*---------------------------------------------------------------
50     Marine symbols
51     ---------------------------------------------------------------*/
52   { "Marina",                "anchor",         0,     "white anchor symbol",               &wp_anchor_pixbuf,          &wp_anchor_large_pixbuf,          NULL },
53   { "Bell",                  "bell",           1,     "white bell symbol",                 &wp_bell_pixbuf,            &wp_bell_large_pixbuf,            NULL },
54   { "Green Diamon",          "diamond_grn",    2,     "green diamond symbol",              &wp_diamond_grn_pixbuf,     NULL,            NULL },
55   { "Red Diamon",            "diamond_red",    3,     "red diamond symbol",                &wp_diamond_red_pixbuf,     NULL,            NULL },
56   { "Diver Down Flag 1",     "dive1",          4,     "diver down flag 1",                 &wp_dive1_pixbuf,           &wp_dive1_large_pixbuf,           NULL },
57   { "Diver Down Flag 2",     "dive2",          5,     "diver down flag 2",                 &wp_dive2_pixbuf,           &wp_dive2_large_pixbuf,           NULL },
58   { "Bank",                  "dollar",         6,     "white dollar symbol",               &wp_dollar_pixbuf,          &wp_dollar_large_pixbuf,          NULL },
59   { "Fishing Area",          "fish",           7,     "white fish symbol",                 &wp_fish_pixbuf,            &wp_fish_large_pixbuf,            NULL },
60   { "Gas Station",           "fuel",           8,     "white fuel symbol",                 &wp_fuel_pixbuf,            &wp_fuel_large_pixbuf,            NULL },
61   { "Horn",                  "horn",           9,     "white horn symbol",                 &wp_horn_pixbuf,            &wp_horn_large_pixbuf,         NULL },
62   { "Residence",             "house",          10,    "white house symbol",                &wp_house_pixbuf,           &wp_house_large_pixbuf,           NULL },
63   { "Restaurant",            "knife",          11,    "white knife & fork symbol",         &wp_knife_pixbuf,           &wp_knife_large_pixbuf,           NULL },
64   { "Light",                 "light",          12,    "white light symbol",                &wp_light_pixbuf,           &wp_light_large_pixbuf,           NULL },
65   { "Bar",                   "mug",            13,    "white mug symbol",                  &wp_mug_pixbuf,             &wp_mug_large_pixbuf,            NULL },
66   { "Skull and Crossbones",  "skull",          14,    "white skull and crossbones symbol", &wp_skull_pixbuf,           &wp_skull_large_pixbuf,          NULL },
67   { "Green Square",          "square_grn",     15,    "green square symbol",               &wp_square_grn_pixbuf,      NULL,            NULL },
68   { "Red Square",            "square_red",     16,    "red square symbol",                 &wp_square_red_pixbuf,      NULL,            NULL },
69   { "Buoy, White",           "wbuoy",          17,    "white buoy waypoint symbol",        &wp_wbuoy_pixbuf,           &wp_wbuoy_large_pixbuf,           NULL },
70   { "Waypoint",              "wpt_dot",        18,    "waypoint dot",                      &wp_wpt_dot_pixbuf,         NULL,            NULL },
71   { "Shipwreck",             "wreck",          19,    "white wreck symbol",                &wp_wreck_pixbuf,           &wp_wreck_large_pixbuf,           NULL },
72   { "None",                  "null",           20,    "null symbol (transparent)",         &wp_null_pixbuf,            NULL,            NULL },
73   { "Man Overboard",         "mob",            21,    "man overboard symbol",              &wp_mob_pixbuf,             &wp_mob_large_pixbuf,            NULL },
74   { "Navaid, Amber",         "buoy_ambr",      22,    "amber map buoy symbol",             &wp_buoy_ambr_pixbuf,       &wp_buoy_ambr_large_pixbuf,       NULL },
75   { "Navaid, Black",         "buoy_blck",      23,    "black map buoy symbol",             &wp_buoy_blck_pixbuf,       &wp_buoy_blck_large_pixbuf,       NULL },
76   { "Navaid, Blue",          "buoy_blue",      24,    "blue map buoy symbol",              &wp_buoy_blue_pixbuf,       &wp_buoy_blue_large_pixbuf,       NULL },
77   { "Navaid, Green",         "buoy_grn",       25,    "green map buoy symbol",             &wp_buoy_grn_pixbuf,        &wp_buoy_grn_large_pixbuf,        NULL },
78   { "Navaid, Green/Red",     "buoy_grn_red",   26,    "green/red map buoy symbol",         &wp_buoy_grn_red_pixbuf,    &wp_buoy_grn_red_large_pixbuf,    NULL },
79   { "Navaid, Green/White",   "buoy_grn_wht",   27,    "green/white map buoy symbol",       &wp_buoy_grn_wht_pixbuf,    &wp_buoy_grn_wht_large_pixbuf,    NULL },
80   { "Navaid, Orange",        "buoy_orng",      28,    "orange map buoy symbol",            &wp_buoy_orng_pixbuf,       &wp_buoy_orng_large_pixbuf,       NULL },
81   { "Navaid, Red",           "buoy_red",       29,    "red map buoy symbol",               &wp_buoy_red_pixbuf,        &wp_buoy_red_large_pixbuf,        NULL },
82   { "Navaid, Red/Green",     "buoy_red_grn",   30,    "red/green map buoy symbol",         &wp_buoy_red_grn_pixbuf,    &wp_buoy_red_grn_large_pixbuf,    NULL },
83   { "Navaid, Red/White",     "buoy_red_wht",   31,    "red/white map buoy symbol",         &wp_buoy_red_wht_pixbuf,    &wp_buoy_red_wht_large_pixbuf,    NULL },
84   { "Navaid, Violet",        "buoy_violet",    32,    "violet map buoy symbol",            &wp_buoy_violet_pixbuf,     &wp_buoy_violet_large_pixbuf,     NULL },
85   { "Navaid, White",         "buoy_wht",       33,    "white map buoy symbol",             &wp_buoy_wht_pixbuf,        &wp_buoy_wht_large_pixbuf,        NULL },
86   { "Navaid, White/Green",    "buoy_wht_grn",   34,    "white/green map buoy symbol",       &wp_buoy_wht_grn_pixbuf,    &wp_buoy_wht_grn_large_pixbuf,    NULL },
87   { "Navaid, White/Red",     "buoy_wht_red",   35,    "white/red map buoy symbol",         &wp_buoy_wht_red_pixbuf,    &wp_buoy_wht_red_large_pixbuf,    NULL },
88   { "White Dot",             "dot",            36,    "white dot symbol",                  &wp_dot_pixbuf,             NULL,            NULL },
89   { "Radio Beacon",          "rbcn",           37,    "radio beacon symbol",               &wp_rbcn_pixbuf,            &wp_rbcn_large_pixbuf,            NULL },
90   { "Boat Ramp",             "boat_ramp",      150,   "boat ramp symbol",                  &wp_boat_ramp_pixbuf,       &wp_boat_ramp_large_pixbuf,       NULL },
91   { "Campground",            "camp",           151,   "campground symbol",                 &wp_camp_pixbuf,            &wp_camp_large_pixbuf,            NULL },
92   { "Restroom",              "restrooms",      152,   "restrooms symbol",                  &wp_restroom_pixbuf,        &wp_restroom_large_pixbuf,        NULL },
93   { "Shower",                "showers",        153,   "shower symbol",                     &wp_shower_pixbuf,          &wp_shower_large_pixbuf,          NULL },
94   { "Drinking Water",        "drinking_wtr",   154,   "drinking water symbol",             &wp_drinking_wtr_pixbuf,    &wp_drinking_wtr_large_pixbuf,    NULL },
95   { "Telephone",             "phone",          155,   "telephone symbol",                  &wp_phone_pixbuf,           &wp_phone_large_pixbuf,           NULL },
96   { "Medical Facility",      "1st_aid",        156,   "first aid symbol",                  &wp_1st_aid_pixbuf,         &wp_1st_aid_large_pixbuf,         NULL },
97   { "Information",           "info",           157,   "information symbol",                &wp_info_pixbuf,            &wp_info_large_pixbuf,            NULL },
98   { "Parking Area",          "parking",        158,   "parking symbol",                    &wp_parking_pixbuf,         &wp_parking_large_pixbuf,         NULL },
99   { "Park",                  "park",           159,   "park symbol",                       &wp_park_pixbuf,            &wp_park_large_pixbuf,            NULL },
100   { "Picnic Area",           "picnic",         160,   "picnic symbol",                     &wp_picnic_pixbuf,          &wp_picnic_large_pixbuf,          NULL },
101   { "Scenic Area",           "scenic",         161,   "scenic area symbol",                &wp_scenic_pixbuf,          &wp_scenic_large_pixbuf,          NULL },
102   { "Skiing Area",           "skiing",         162,   "skiing symbol",                     &wp_skiing_pixbuf,          &wp_skiing_large_pixbuf,          NULL },
103   { "Swimming Area",         "swimming",       163,   "swimming symbol",                   &wp_swimming_pixbuf,        &wp_swimming_large_pixbuf,        NULL },
104   { "Dam",                   "dam",            164,   "dam symbol",                        &wp_dam_pixbuf,             &wp_dam_large_pixbuf,            NULL },
105   { "Controlled Area",       "controlled",     165,   "controlled area symbol",            &wp_controlled_pixbuf,      &wp_controlled_large_pixbuf,      NULL },
106   { "Danger Area",           "danger",         166,   "danger symbol",                     &wp_danger_pixbuf,          &wp_danger_large_pixbuf,          NULL },
107   { "Restricted Area",       "restricted",     167,   "restricted area symbol",            &wp_restricted_pixbuf,      &wp_restricted_large_pixbuf,            NULL },
108   { "Null 2",                "null_2",         168,   "null symbol",                       NULL,                NULL,            NULL },  /* not exist */
109   { "Ball Park",             "ball",           169,   "ball symbol",                       &wp_ball_pixbuf,            &wp_ball_large_pixbuf,            NULL },
110   { "Car",                   "car",            170,   "car symbol",                        &wp_car_pixbuf,             &wp_car_large_pixbuf,            NULL },
111   { "Hunting Area",          "deer",           171,   "deer symbol",                       &wp_deer_pixbuf,            &wp_deer_large_pixbuf,            NULL },
112   { "Shopping Center",       "shopping",     172,   "shopping cart symbol",              NULL,                &wp_shopping_large_pixbuf,            NULL },
113   { "Lodging",               "lodging",        173,   "lodging symbol",                    NULL,                &wp_lodging_large_pixbuf,            NULL },
114   { "Mine",                  "mine",           174,   "mine symbol",                       &wp_mine_pixbuf,            &wp_mine_large_pixbuf,            NULL },
115   { "Trail Head",            "trail_head",     175,   "trail head symbol",                 NULL,                &wp_trail_head_large_pixbuf,            NULL },
116   { "Truck Stop",            "truck_stop",     176,   "truck stop symbol",                 NULL,                &wp_truck_stop_large_pixbuf,            NULL },
117   { "Exit",                  "user_exit",      177,   "user exit symbol",                  NULL,                       &wp_exit_large_pixbuf,            NULL },
118   { "Flag",                  "flag",           178,   "flag symbol",                       &wp_flag_pixbuf,            NULL,            NULL },
119   { "Circle with X",         "circle_x",       179,   "circle with x in the center",       NULL,                NULL,            NULL },
120   { "Open 24 Hours",          "open_24hr",      180,   "open 24 hours symbol",              NULL,                NULL,            NULL },
121   { "Fishing Hot Spot Facility",      "fhs_facility",   181,   "U Fishing Hot SpotsTM Facility",    NULL,                &wp_fhs_facility_large_pixbuf,  NULL },
122   { "Bottom Conditions",      "bot_cond",       182,   "Bottom Conditions",                 NULL,                NULL,            NULL },
123   { "Tide/Current PRediction Station", "tide_pred_stn",  183,   "Tide/Current Prediction Station",   NULL,                NULL,            NULL },
124   { "Anchor Prohibited",     "anchor_prohib",  184,   "U anchor prohibited symbol",        NULL,                NULL,            NULL },
125   { "Beacon",              "beacon",         185,   "U beacon symbol",                   NULL,                NULL,            NULL },
126   { "Coast Guard",         "coast_guard",    186,   "U coast guard symbol",              NULL,                NULL,            NULL },
127   { "Reef",                "reef",           187,   "U reef symbol",                     NULL,                NULL,            NULL },
128   { "Weed Bed",             "weedbed",        188,   "U weedbed symbol",                  NULL,                NULL,            NULL },
129   { "Dropoff",              "dropoff",        189,   "U dropoff symbol",                  NULL,                NULL,            NULL },
130   { "Dock",                "dock",           190,   "U dock symbol",                     NULL,                NULL,            NULL },
131   { "U Marina",              "marina",         191,   "U marina symbol",                   NULL,                NULL,            NULL },
132   { "Bait and Tackle",     "bait_tackle",    192,   "U bait and tackle symbol",          NULL,                NULL,            NULL },
133   { "Stump",               "stump",          193,   "U stump symbol",                    NULL,                NULL,            NULL },
134   { "Ground Transportation", "grnd_trans",   229,   "ground transportation",                    NULL,                &wp_grnd_trans_large_pixbuf,        NULL },
135   /*---------------------------------------------------------------
136     User customizable symbols
137     The values from begin_custom to end_custom inclusive are
138     reserved for the identification of user customizable symbols.
139     ---------------------------------------------------------------*/
140   { "custom begin placeholder",   "begin_custom",   7680,  "first user customizable symbol",    NULL,                NULL,            NULL },
141   { "custom end placeholder","end_custom",     8191,  "last user customizable symbol",     NULL,                NULL,            NULL },
142   /*---------------------------------------------------------------
143     Land symbols
144     ---------------------------------------------------------------*/
145   { "Interstate Highway",    "is_hwy",         8192,  "interstate hwy symbol",             NULL,                NULL,            NULL },   /* TODO: check symbol name */
146   { "US hwy",            "us_hwy",         8193,  "us hwy symbol",                     NULL,                NULL,            NULL },
147   { "State Hwy",         "st_hwy",         8194,  "state hwy symbol",                  NULL,                NULL,            NULL },
148   { "Mile Marker",           "mi_mrkr",        8195,  "mile marker symbol",                NULL,                NULL,            NULL },
149   { "TracBack Point",        "trcbck",         8196,  "TracBack (feet) symbol",            NULL,                NULL,            NULL },
150   { "Golf Course",           "golf",           8197,  "golf symbol",                       &wp_golf_pixbuf,            &wp_golf_large_pixbuf,            NULL },
151   { "City (Small)",          "sml_cty",        8198,  "small city symbol",                 &wp_sml_cty_pixbuf,         &wp_sml_cty_large_pixbuf,            NULL },
152   { "City (Medium)",         "med_cty",        8199,  "medium city symbol",                &wp_med_cty_pixbuf,         &wp_med_cty_large_pixbuf,            NULL },
153   { "City (Large)",          "lrg_cty",        8200,  "large city symbol",                 &wp_lrg_cty_pixbuf,         &wp_lrg_cty_large_pixbuf,            NULL },
154   { "Intl freeway hwy",               "freeway",        8201,  "intl freeway hwy symbol",           NULL,                NULL,            NULL },
155   { "Intl national hwy",      "ntl_hwy",        8202,  "intl national hwy symbol",          NULL,                NULL,            NULL },
156   { "City (Capitol)",          "cap_cty",        8203,  "capitol city symbol (star)",        &wp_cap_cty_pixbuf,         NULL,            NULL },
157   { "Amusement Park",        "amuse_pk",       8204,  "amusement park symbol",             NULL,                &wp_amuse_pk_large_pixbuf,            NULL },
158   { "Bowling",                "bowling",        8205,  "bowling symbol",                    NULL,                &wp_bowling_large_pixbuf,            NULL },
159   { "Car Rental",            "car_rental",     8206,  "car rental symbol",                 NULL,                &wp_car_rental_large_pixbuf,            NULL },
160   { "Car Repair",            "car_repair",     8207,  "car repair symbol",                 NULL,                &wp_car_repair_large_pixbuf,            NULL },
161   { "Fast Food",             "fastfood",       8208,  "fast food symbol",                  NULL,                &wp_fastfood_large_pixbuf,            NULL },
162   { "Fitness Center",        "fitness",        8209,  "fitness symbol",                    NULL,                &wp_fitness_large_pixbuf,            NULL },
163   { "Movie Theater",         "movie",          8210,  "movie symbol",                      NULL,                &wp_movie_large_pixbuf,            NULL },
164   { "Museum",                "museum",         8211,  "museum symbol",                     NULL,                &wp_museum_large_pixbuf,            NULL },
165   { "Pharmacy",              "pharmacy",       8212,  "pharmacy symbol",                   NULL,                &wp_pharmacy_large_pixbuf,            NULL },
166   { "Pizza",                 "pizza",          8213,  "pizza symbol",                      NULL,                &wp_pizza_large_pixbuf,            NULL },
167   { "Post Office",           "post_ofc",       8214,  "post office symbol",                NULL,                &wp_post_ofc_large_pixbuf,            NULL },
168   { "RV Park",               "rv_park",        8215,  "RV park symbol",                    &wp_rv_park_pixbuf,  &wp_rv_park_large_pixbuf,            NULL },
169   { "School",                "school",         8216,  "school symbol",                     &wp_school_pixbuf,   &wp_school_large_pixbuf,            NULL },
170   { "Stadium",               "stadium",        8217,  "stadium symbol",                    NULL,                &wp_stadium_large_pixbuf,            NULL },
171   { "Department Store",      "store",          8218,  "dept. store symbol",                NULL,                &wp_store_large_pixbuf,            NULL },
172   { "Zoo",                   "zoo",            8219,  "zoo symbol",                        NULL,                &wp_zoo_large_pixbuf,            NULL },
173   { "Convenience Store",     "conv_store",       8220,  "convenience store symbol",          NULL,                &wp_conv_store_large_pixbuf,        NULL },
174   { "Live Theater",          "theater",          8221,  "live theater symbol",               NULL,                &wp_theater_large_pixbuf,            NULL },
175   { "Ramp intersection",     "ramp_int",       8222,  "ramp intersection symbol",          NULL,                NULL,            NULL },
176   { "Street Intersection",   "st_int",         8223,  "street intersection symbol",        NULL,                NULL,            NULL },
177   { "Scales",                "weigh_station",     8226,  "inspection/weigh station symbol",   NULL,               &wp_weigh_station_large_pixbuf,       NULL },
178   { "Toll Booth",            "toll_booth",     8227,  "toll booth symbol",                 NULL,                &wp_toll_booth_large_pixbuf,            NULL },
179   { "Elevation point",       "elev_pt",        8228,  "elevation point symbol",            NULL,                NULL,            NULL },
180   { "Exit without services", "ex_no_srvc",     8229,  "exit without services symbol",      NULL,                NULL,            NULL },
181   { "Geographic place name, Man-made", "geo_place_mm",   8230,  "Geographic place name, man-made",   NULL,                NULL,            NULL },
182   { "Geographic place name, water","geo_place_wtr",  8231,  "Geographic place name, water",      NULL,                NULL,            NULL },
183   { "Geographic place name, Land", "geo_place_lnd",  8232,  "Geographic place name, land",       NULL,                NULL,            NULL },
184   { "Bridge",                "bridge",         8233,  "bridge symbol",                     &wp_bridge_pixbuf,          &wp_bridge_large_pixbuf,            NULL },
185   { "Building",              "building",       8234,  "building symbol",                   &wp_building_pixbuf,        &wp_building_large_pixbuf,        NULL },
186   { "Cemetery",              "cemetery",       8235,  "cemetery symbol",                   &wp_cemetery_pixbuf,        &wp_cemetery_large_pixbuf,            NULL },
187   { "Church",                "church",         8236,  "church symbol",                     &wp_church_pixbuf,          &wp_church_large_pixbuf,          NULL },
188   { "Civil",                 "civil",          8237,  "civil location symbol",             NULL,                &wp_civil_large_pixbuf,            NULL },
189   { "Crossing",              "crossing",       8238,  "crossing symbol",                   NULL,                &wp_crossing_large_pixbuf,            NULL },
190   { "Ghost Town",            "hist_town",      8239,  "historical town symbol",            NULL,                NULL,            NULL },
191   { "Levee",                 "levee",          8240,  "levee symbol",                      NULL,                NULL,            NULL },
192   { "Military",              "military",       8241,  "military location symbol",          &wp_military_pixbuf,        NULL,            NULL },
193   { "Oil Field",             "oil_field",      8242,  "oil field symbol",                  NULL,                &wp_oil_field_large_pixbuf,          NULL },
194   { "Tunnel",                "tunnel",         8243,  "tunnel symbol",                     &wp_tunnel_pixbuf,          &wp_tunnel_large_pixbuf,          NULL },
195   { "Beach",                 "beach",          8244,  "beach symbol",                      &wp_beach_pixbuf,           &wp_beach_large_pixbuf,           NULL },
196   { "Forest",                "forest",         8245,  "forest symbol",                     &wp_forest_pixbuf,          &wp_forest_large_pixbuf,          NULL },
197   { "Summit",                "summit",         8246,  "summit symbol",                     &wp_summit_pixbuf,          &wp_summit_large_pixbuf,          NULL },
198   { "Large Ramp intersection", "lrg_ramp_int",   8247,  "large ramp intersection symbol",    NULL,                NULL,            NULL },
199   { "Large exit without services", "lrg_ex_no_srvc", 8248,  "large exit without services smbl",  NULL,                NULL,            NULL },
200   { "Police Station",        "police",          8249,  "police/official badge symbol",      NULL,                &wp_police_large_pixbuf,            NULL },
201   { "Gambling/casino",                "cards",          8250,  "gambling/casino symbol",            NULL,                NULL,            NULL },
202   { "Ski Resort",            "ski_resort",        8251,  "snow skiing symbol",                NULL,                &wp_ski_resort_large_pixbuf,          NULL },
203   { "Ice Skating",           "ice_skating",       8252,  "ice skating symbol",                &wp_ice_skating_pixbuf,     &wp_ice_skating_large_pixbuf,  NULL },
204   { "Wrecker",               "wrecker",        8253,  "tow truck (wrecker) symbol",        NULL,                &wp_wrecker_large_pixbuf,            NULL },
205   { "Border Crossing (Port Of Entry)", "border",         8254,  "border crossing (port of entry)",   NULL,                NULL,            NULL },
206   { "Geocache",              "geocache",       8255,  "geocache location",                 &wp_geocache_pixbuf,        &wp_geocache_large_pixbuf,        NULL },
207   { "Geocache Found",        "geocache_fnd",   8256,  "found geocache",                    &wp_geocache_fnd_pixbuf,    &wp_geocache_fnd_large_pixbuf,    NULL },
208   { "Contact, Smiley",       "cntct_smiley",   8257,  "Rino contact symbol, ""smiley""",   NULL,                NULL,            NULL },
209   { "Contact, Ball Cap",     "cntct_ball_cap", 8258,  "Rino contact symbol, ""ball cap""", NULL,                NULL,            NULL },
210   { "Contact, Big Ears",      "cntct_big_ears", 8259,  "Rino contact symbol, ""big ear""",  NULL,                NULL,            NULL },
211   { "Contact, Spike",         "cntct_spike",    8260,  "Rino contact symbol, ""spike""",    NULL,                NULL,            NULL },
212   { "Contact, Goatee",        "cntct_goatee",   8261,  "Rino contact symbol, ""goatee""",   NULL,                NULL,            NULL },
213   { "Contact, Afro",          "cntct_afro",     8262,  "Rino contact symbol, ""afro""",     NULL,                NULL,            NULL },
214   { "Contact, Dreadlocks",    "cntct_dreads",   8263,  "Rino contact symbol, ""dreads""",   NULL,                NULL,            NULL },
215   { "Contact, Female1",       "cntct_female1",  8264,  "Rino contact symbol, ""female 1""", NULL,                NULL,            NULL },
216   { "Contact, Female2",       "cntct_female2",  8265,  "Rino contact symbol, ""female 2""", NULL,                NULL,            NULL },
217   { "Contact, Female3",       "cntct_female3",  8266,  "Rino contact symbol, ""female 3""", NULL,                NULL,            NULL },
218   { "Contact, Ranger",        "cntct_ranger",   8267,  "Rino contact symbol, ""ranger""",   NULL,                NULL,            NULL },
219   { "Contact, Kung-Fu",       "cntct_kung_fu",  8268,  "Rino contact symbol, ""kung fu""",  NULL,                NULL,            NULL },
220   { "Contact, Sumo",          "cntct_sumo",     8269,  "Rino contact symbol, ""sumo""",     NULL,                NULL,            NULL },
221   { "Contact, Pirate",        "cntct_pirate",   8270,  "Rino contact symbol, ""pirate""",   NULL,                NULL,            NULL },
222   { "Contact, Biker",         "cntct_biker",    8271,  "Rino contact symbol, ""biker""",    NULL,                NULL,            NULL },
223   { "Contact, Alien",         "cntct_alien",    8272,  "Rino contact symbol, ""alien""",    NULL,                NULL,            NULL },
224   { "Contact, Bug",           "cntct_bug",      8273,  "Rino contact symbol, ""bug""",      NULL,                NULL,            NULL },
225   { "Contact, Cat",           "cntct_cat",      8274,  "Rino contact symbol, ""cat""",      NULL,                NULL,            NULL },
226   { "Contact, Dog",           "cntct_dog",      8275,  "Rino contact symbol, ""dog""",      NULL,                NULL,            NULL },
227   { "Contact, Pig",           "cntct_pig",      8276,  "Rino contact symbol, ""pig""",      NULL,                NULL,            NULL },
228   { "Water Hydrant",          "hydrant",        8282,  "water hydrant symbol",              NULL,                NULL,            NULL },
229   { "Flag, Blue",             "flag_blue",      8284,  "blue flag symbol",                  NULL,                &wp_flag_blue_large_pixbuf,            NULL },
230   { "Flag, Green",            "flag_green",     8285,  "green flag symbol",                 NULL,                &wp_flag_green_large_pixbuf,            NULL },
231   { "Flag, Red",              "flag_red",       8286,  "red flag symbol",                   NULL,                &wp_flag_red_large_pixbuf,            NULL },
232   { "Pin, Blue",              "pin_blue",       8287,  "blue pin symbol",                   NULL,                &wp_pin_blue_large_pixbuf,            NULL },
233   { "Pin, Green",             "pin_green",      8288,  "green pin symbol",                  NULL,                &wp_pin_green_large_pixbuf,            NULL },
234   { "Pin, Red",               "pin_red",        8289,  "red pin symbol",                    NULL,                &wp_pin_red_large_pixbuf,            NULL },
235   { "Block, Blue",            "block_blue",     8290,  "blue block symbol",                 NULL,                &wp_block_blue_large_pixbuf,            NULL },
236   { "Block, Green",           "block_green",    8291,  "green block symbol",                NULL,                &wp_block_green_large_pixbuf,           NULL },
237   { "Block, Red",             "block_red",      8292,  "red block symbol",                  NULL,                &wp_block_red_large_pixbuf,            NULL },
238   { "Bike Trail",             "bike_trail",     8293,  "bike trail symbol",                 NULL,                &wp_bike_trail_large_pixbuf,            NULL },
239   { "Circle, Red",            "circle_red",     8294,  "red circle symbol",                 NULL,                NULL,            NULL },
240   { "Circle, Green",          "circle_green",   8295,  "green circle symbol",               NULL,                NULL,            NULL },
241   { "Circle, Blue",           "circle_blue",    8296,  "blue circle symbol",                NULL,                NULL,            NULL },
242   { "Diamond, Blue",          "diamond_blue",   8299,  "blue diamond symbol",               NULL,                NULL,            NULL },
243   { "Oval, Red",              "oval_red",       8300,  "red oval symbol",                   NULL,                NULL,            NULL },
244   { "Oval, Green",            "oval_green",     8301,  "green oval symbol",                 NULL,                NULL,            NULL },
245   { "Oval, Blue",             "oval_blue",      8302,  "blue oval symbol",                  NULL,                NULL,            NULL },
246   { "Rectangle, Red",         "rect_red",       8303,  "red rectangle symbol",              NULL,                NULL,            NULL },
247   { "Rectangle, Green",       "rect_green",     8304,  "green rectangle symbol",            NULL,                NULL,            NULL },
248   { "Rectangle, Blue",        "rect_blue",      8305,  "blue rectangle symbol",             NULL,                NULL,            NULL },
249   { "Square, Blue",           "square_blue",    8308,  "blue square symbol",                NULL,                NULL,            NULL },
250   { "Letter A, Red",          "letter_a_red",   8309,  "red letter 'A' symbol",             NULL,                NULL,            NULL },
251   { "Letter B, Red",          "letter_b_red",   8310,  "red letter 'B' symbol",             NULL,                NULL,            NULL },
252   { "Letter C, Red",          "letter_c_red",   8311,  "red letter 'C' symbol",             NULL,                NULL,            NULL },
253   { "Letter D, Red",          "letter_d_red",   8312,  "red letter 'D' symbol",             NULL,                NULL,            NULL },
254   { "Letter A, Green",        "letter_a_green", 8313,  "green letter 'A' symbol",           NULL,                NULL,            NULL },
255   { "Letter C, Green",        "letter_c_green", 8314,  "green letter 'C' symbol",           NULL,                NULL,            NULL },
256   { "Letter B, Green",        "letter_b_green", 8315,  "green letter 'B' symbol",           NULL,                NULL,            NULL },
257   { "Letter D, Green",        "letter_d_green", 8316,  "green letter 'D' symbol",           NULL,                NULL,            NULL },
258   { "Letter A, Blue",         "letter_a_blue",  8317,  "blue letter 'A' symbol",            NULL,                NULL,            NULL },
259   { "Letter B, Blue",         "letter_b_blue",  8318,  "blue letter 'B' symbol",            NULL,                NULL,            NULL },
260   { "Letter C, Blue",         "letter_c_blue",  8319,  "blue letter 'C' symbol",            NULL,                NULL,            NULL },
261   { "Letter D, Blue",         "letter_d_blue",  8320,  "blue letter 'D' symbol",            NULL,                NULL,            NULL },
262   { "Number 0, Red",          "number_0_red",   8321,  "red number '0' symbol",             NULL,                NULL,            NULL },
263   { "Number 1, Red",          "number_1_red",   8322,  "red number '1' symbol",             NULL,                NULL,            NULL },
264   { "Number 2, Red",          "number_2_red",   8323,  "red number '2' symbol",             NULL,                NULL,            NULL },
265   { "Number 3, Red",          "number_3_red",   8324,  "red number '3' symbol",             NULL,                NULL,            NULL },
266   { "Number 4, Red",          "number_4_red",   8325,  "red number '4' symbol",             NULL,                NULL,            NULL },
267   { "Number 5, Red",          "number_5_red",   8326,  "red number '5' symbol",             NULL,                NULL,            NULL },
268   { "Number 6, Red",          "number_6_red",   8327,  "red number '6' symbol",             NULL,                NULL,            NULL },
269   { "Number 7, Red",          "number_7_red",   8328,  "red number '7' symbol",             NULL,                NULL,            NULL },
270   { "Number 8, Red",          "number_8_red",   8329,  "red number '8' symbol",             NULL,                NULL,            NULL },
271   { "Number 9, Red",          "number_9_red",   8330,  "red number '9' symbol",             NULL,                NULL,            NULL },
272   { "Number 0, Green",        "number_0_green", 8331,  "green number '0' symbol",           NULL,                NULL,            NULL },
273   { "Number 1, Green",        "number_1_green", 8332,  "green number '1' symbol",           NULL,                NULL,            NULL },
274   { "Number 2, Green",        "number_2_green", 8333,  "green number '2' symbol",           NULL,                NULL,            NULL },
275   { "Number 3, Green",        "number_3_green", 8334,  "green number '3' symbol",           NULL,                NULL,            NULL },
276   { "Number 4, Green",        "number_4_green", 8335,  "green number '4' symbol",           NULL,                NULL,            NULL },
277   { "Number 5, Green",        "number_5_green", 8336,  "green number '5' symbol",           NULL,                NULL,            NULL },
278   { "Number 6, Green",        "number_6_green", 8337,  "green number '6' symbol",           NULL,                NULL,            NULL },
279   { "Number 7, Green",        "number_7_green", 8338,  "green number '7' symbol",           NULL,                NULL,            NULL },
280   { "Number 8, Green",        "number_8_green", 8339,  "green number '8' symbol",           NULL,                NULL,            NULL },
281   { "Number 9, Green",        "number_9_green", 8340,  "green number '9' symbol",           NULL,                NULL,            NULL },
282   { "Number 0, Blue",         "number_0_blue",  8341,  "blue number '0' symbol",            NULL,                NULL,            NULL },
283   { "Number 1, Blue",         "number_1_blue",  8342,  "blue number '1' symbol",            NULL,                NULL,            NULL },
284   { "Number 2, Blue",         "number_2_blue",  8343,  "blue number '2' symbol",            NULL,                NULL,            NULL },
285   { "Number 3, Blue",         "number_3_blue",  8344,  "blue number '3' symbol",            NULL,                NULL,            NULL },
286   { "Number 4, Blue",         "number_4_blue",  8345,  "blue number '4' symbol",            NULL,                NULL,            NULL },
287   { "Number 5, Blue",         "number_5_blue",  8346,  "blue number '5' symbol",            NULL,                NULL,            NULL },
288   { "Number 6, Blue",         "number_6_blue",  8347,  "blue number '6' symbol",            NULL,                NULL,            NULL },
289   { "Number 7, Blue",         "number_7_blue",  8348,  "blue number '7' symbol",            NULL,                NULL,            NULL },
290   { "Number 8, Blue",         "number_8_blue",  8349,  "blue number '8' symbol",            NULL,                NULL,            NULL },
291   { "Number 9, Blue",         "number_9_blue",  8350,  "blue number '9' symbol",            NULL,                NULL,            NULL },
292   { "Triangle, Blue",         "triangle_blue",  8351,  "blue triangle symbol",              NULL,                NULL,            NULL },
293   { "Triangle, Green",        "triangle_green", 8352,  "green triangle symbol",             NULL,                NULL,            NULL },
294   { "Triangle, Red",          "triangle_red",   8353,  "red triangle symbol",               NULL,                NULL,            NULL },
295   /*---------------------------------------------------------------
296     Aviation symbols
297     ---------------------------------------------------------------*/
298   { "Airport",                "airport",        16384, "airport symbol",                    &wp_airplane_pixbuf,        &wp_airplane_large_pixbuf,        NULL },
299   { "Intersection",           "int",            16385, "intersection symbol",               NULL,                NULL,            NULL },
300   { "Non-directional beacon", "ndb",            16386, "non-directional beacon symbol",     NULL,                NULL,            NULL },
301   { "VHF Omni-range",         "vor",            16387, "VHF omni-range symbol",             NULL,                NULL,            NULL },
302   { "Heliport",               "heliport",       16388, "heliport symbol",                   NULL,                       &wp_helipad_large_pixbuf,         NULL },
303   { "Private Field",          "private",        16389, "private field symbol",              NULL,                NULL,            NULL },
304   { "Soft Field",             "soft_fld",       16390, "soft field symbol",                 NULL,                NULL,            NULL },
305   { "Tall Tower",             "tall_tower",     16391, "tall tower symbol",                 NULL,                &wp_tall_tower_large_pixbuf,           NULL },
306   { "Short Tower",             "short_tower",    16392, "short tower symbol",                NULL,                &wp_short_tower_large_pixbuf,          NULL },
307   { "Glider Area",            "glider",         16393, "glider symbol",                     NULL,                &wp_glider_large_pixbuf,            NULL },
308   { "Ultralight Area",        "ultralight",     16394, "ultralight symbol",                 NULL,                &wp_ultralight_large_pixbuf,            NULL },
309   { "Parachute Area",         "parachute",      16395, "parachute symbol",                  NULL,                &wp_parachute_large_pixbuf,            NULL },
310   { "VOR/TACAN",              "vortac",         16396, "VOR/TACAN symbol",                  NULL,                NULL,            NULL },
311   { "VOR-DME",                "vordme",         16397, "VOR-DME symbol",                    NULL,                NULL,            NULL },
312   { "First approach fix",     "faf",            16398, "first approach fix",                NULL,                NULL,            NULL },
313   { "Localizer Outer Marker", "lom",            16399, "localizer outer marker",            NULL,                NULL,            NULL },
314   { "Missed Approach Point",  "map",            16400, "missed approach point",             NULL,                NULL,            NULL },
315   { "TACAN",                  "tacan",          16401, "TACAN symbol",                      NULL,                NULL,            NULL },
316   { "Seaplane Base",          "seaplane",       16402, "Seaplane Base",                     NULL,                NULL,            NULL }
317 };
318
319 static GHashTable *icons = NULL;
320 static GHashTable *old_icons = NULL;
321
322 static gboolean str_equal_casefold ( gconstpointer v1, gconstpointer v2 ) {
323   gboolean equal;
324   gchar *v1_lower;
325   gchar *v2_lower;
326
327   v1_lower = g_utf8_casefold ( v1, -1 );
328   if (!v1_lower)
329     return FALSE;
330   v2_lower = g_utf8_casefold ( v2, -1 );
331   if (!v2_lower) {
332     g_free ( v1_lower );
333     return FALSE;
334   }
335
336   equal = g_str_equal( v1_lower, v2_lower );
337
338   g_free ( v1_lower );
339   g_free ( v2_lower );
340
341   return equal;
342 }
343
344 static guint str_hash_casefold ( gconstpointer key ) {
345   guint h;
346   gchar *key_lower;
347
348   key_lower = g_utf8_casefold ( key, -1 );
349   if (!key_lower)
350     return 0;
351
352   h = g_str_hash ( key_lower );
353
354   g_free ( key_lower );
355
356   return h;
357 }
358
359 static void init_icons() {
360   icons = g_hash_table_new_full ( str_hash_casefold, str_equal_casefold, NULL, NULL);
361   old_icons = g_hash_table_new_full ( str_hash_casefold, str_equal_casefold, NULL, NULL);
362   gint i;
363   for (i=0; i<G_N_ELEMENTS(garmin_syms); i++) {
364     g_hash_table_insert(icons, garmin_syms[i].sym, GINT_TO_POINTER (i));
365     g_hash_table_insert(old_icons, garmin_syms[i].old_sym, GINT_TO_POINTER (i));
366   }
367 }
368
369 static GdkPixbuf *get_wp_sym_from_index ( gint i ) {
370   // Ensure data exists to either directly load icon or scale from the other set
371   if ( !garmin_syms[i].icon && ( garmin_syms[i].data || garmin_syms[i].data_large) ) {
372     if ( a_vik_get_use_large_waypoint_icons() ) {
373       if ( garmin_syms[i].data_large )
374         // Directly load icon
375         garmin_syms[i].icon = gdk_pixbuf_from_pixdata ( garmin_syms[i].data_large, FALSE, NULL );
376       else
377         // Up sample from small image
378         garmin_syms[i].icon = gdk_pixbuf_scale_simple ( gdk_pixbuf_from_pixdata ( garmin_syms[i].data, FALSE, NULL ), 30, 30, GDK_INTERP_BILINEAR );
379     }
380     else {
381       if ( garmin_syms[i].data )
382         // Directly use small symbol
383         garmin_syms[i].icon = gdk_pixbuf_from_pixdata ( garmin_syms[i].data, FALSE, NULL );
384       else
385         // Down size large image
386         garmin_syms[i].icon = gdk_pixbuf_scale_simple ( gdk_pixbuf_from_pixdata ( garmin_syms[i].data_large, FALSE, NULL ), 18, 18, GDK_INTERP_BILINEAR );
387     }
388   }
389   return garmin_syms[i].icon;
390 }
391
392 GdkPixbuf *a_get_wp_sym ( const gchar *sym ) {
393   gpointer gp;
394   gpointer x;
395
396   if (!sym) {
397     return NULL;
398   }
399   if (!icons) {
400     init_icons();
401   }
402   if (g_hash_table_lookup_extended(icons, sym, &x, &gp))
403     return get_wp_sym_from_index(GPOINTER_TO_INT(gp));
404   else if (g_hash_table_lookup_extended(old_icons, sym, &x, &gp))
405     return get_wp_sym_from_index(GPOINTER_TO_INT(gp));
406   else
407     return NULL;
408 }
409
410 const gchar *a_get_hashed_sym ( const gchar *sym ) {
411   gpointer gp;
412   gpointer x;
413
414   if (!sym) {
415     return NULL;
416   }
417   if (!icons) {
418     init_icons();
419   }
420   if (g_hash_table_lookup_extended(icons, sym, &x, &gp))
421     return garmin_syms[GPOINTER_TO_INT(gp)].sym;
422   else if (g_hash_table_lookup_extended(old_icons, sym, &x, &gp))
423     return garmin_syms[GPOINTER_TO_INT(gp)].sym;
424   else
425     return NULL;
426 }
427
428 void a_populate_sym_list ( GtkListStore *list ) {
429   gint i;
430   for (i=0; i<G_N_ELEMENTS(garmin_syms); i++) {
431     // Ensure at least one symbol available - the other can be auto generated
432     if ( garmin_syms[i].data || garmin_syms[i].data_large ) {
433       GtkTreeIter iter;
434       gtk_list_store_append(list, &iter);
435       gtk_list_store_set(list, &iter, 0, garmin_syms[i].sym, 1, get_wp_sym_from_index(i), -1);
436     }
437   }
438 }
439
440
441 /* Use when preferences have changed to reset icons*/
442 void clear_garmin_icon_syms () {
443   g_debug("garminsymbols: clear_garmin_icon_syms");
444   gint i;
445   for (i=0; i<G_N_ELEMENTS(garmin_syms); i++) {
446     if (garmin_syms[i].icon) {
447       g_object_unref (garmin_syms[i].icon);
448       garmin_syms[i].icon = NULL;
449     }
450   }
451 }