From: Kaj-Michael Lang Date: Tue, 5 Feb 2008 13:24:11 +0000 (+0200) Subject: Small POI changes: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f2cde51e2582e8fa14fd4f2b80f1173f80386ce;p=mapper Small POI changes: - Use helper to set button icon - Add "Other POI" button to quick poi dialog - Use correct type in POI type to icon name function --- diff --git a/src/poi-gui.c b/src/poi-gui.c index 4d53852..8a38518 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -1007,11 +1007,27 @@ poi_free(p); return TRUE; } +static void +poi_button_set_icon(GtkWidget *button, node_type_t t) +{ +const gchar *iname; +GdkPixbuf *icon=NULL; + +iname=poi_get_icon_from_type(t); +if (iname) + icon=poi_get_icon(iname, TRUE); +if (icon) { + gtk_button_set_image(button, gtk_image_new_from_pixbuf(icon)); + gtk_button_set_image_position(button, GTK_POS_TOP); +} +} + gboolean poi_quick_dialog(gdouble lat, gdouble lon) { GtkWidget *table; GtkWidget *buttons[POI_QUICK_BUTTONS]; +GtkWidget *otherbtn; guint x,y; qp.lat=lat; @@ -1035,22 +1051,22 @@ gtk_table_set_homogeneous(GTK_TABLE(table), TRUE); for (x=0;x<3;x++) { for (y=0;y<3;y++) { guint p=x+y*3; - const gchar *iname; - GdkPixbuf *icon=NULL; buttons[p]=gtk_button_new_with_label(quick_poi_categories[p].name); - iname=poi_get_icon_from_type(quick_poi_categories[p].type); - if (iname) - icon=poi_get_icon(iname, TRUE); - if (icon) - gtk_button_set_image(buttons[p], gtk_image_new_from_pixbuf(icon)); - + poi_button_set_icon(buttons[p], quick_poi_categories[p].type); gtk_table_attach(GTK_TABLE(table), buttons[p], x, x+1, y, y+1, GTK_FILL, 0, 2, 4); g_signal_connect(G_OBJECT(buttons[p]), "clicked", G_CALLBACK(poi_quick_button_cb), GINT_TO_POINTER(quick_poi_categories[p].type)); } } +/* Other POI button */ +otherbtn=gtk_button_new_with_label("Other POI"); +poi_button_set_icon(otherbtn, NODE_AMENITY_GENERIC); +g_signal_connect(G_OBJECT(otherbtn), "clicked", G_CALLBACK(poi_quick_button_cb), GINT_TO_POINTER(NODE_AMENITY_GENERIC)); +gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qp.dialog)->vbox), otherbtn, TRUE, TRUE, 0); + +/* Optional Label */ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(qp.dialog)->vbox), qp.label = gtk_entry_new(), TRUE, TRUE, 0); gtk_widget_show_all(qp.dialog); diff --git a/src/poi.c b/src/poi.c index eb291e4..f612cb9 100644 --- a/src/poi.c +++ b/src/poi.c @@ -82,7 +82,7 @@ static struct _poi_categories default_poi_categories[] = { { NODE_AMENITY_TOWNHALL, "Townhall", "" , "", "#408090" }, { NODE_AMENITY_WC, "WC/Toilets", "" , "public/toilets", "#e1d62c" }, { NODE_AMENITY_TELEPHONE, "Telephone", "Public telephone" , "public/telephone", "#208060" }, - { NODE_TOURISM_ATTRACTION, "Attraction", "Something interesting" , "generic", "#005000" }, + { NODE_TOURISM_ATTRACTION, "Attraction", "Something interesting" , "misc", "#005000" }, { NODE_HISTORIC_MUSEUM, "Museum", "A place where objects of historical, artistic, or scientific interest are exhibited, preserved or studied." , "sightseeing/museum", "#202020" }, { NODE_HISTORIC_CASTLE, "Castle", "Historical building or group of building used for defense by military forces, whose main structures are walls and towers." , "sightseeing/castle", "#404040" }, @@ -95,31 +95,31 @@ static struct _poi_categories default_poi_categories[] = { { NODE_SPORT_SOCCER, "Soccer", "" , "sports/soccer", "#102080" }, { NODE_SPORT_GOLF, "Golf", "" , "sports/golf", "#102080" }, { NODE_SPORT_TENNIS, "Tennis", "" , "sports/tennis", "#101080" }, - { NODE_SPORT_BOWLING, "Bowling", "" , "", "#101080" }, - { NODE_SPORT_RUGBY, "Rugby", "" , "", "#101080" }, - { NODE_SPORT_CLIMBING, "Climbing", "" , "", "#101080" }, + { NODE_SPORT_BOWLING, "Bowling", "" , "sports", "#101080" }, + { NODE_SPORT_RUGBY, "Rugby", "" , "sports", "#101080" }, + { NODE_SPORT_CLIMBING, "Climbing", "" , "sports", "#101080" }, { NODE_SPORT_CYCLING, "Cycling", "" , "sports/bicycle", "#101080" }, - { NODE_SPORT_MOTOR, "Motor sport", "" , "", "#101080" }, - { NODE_SPORT_HOCKEY, "Hockey", "" , "", "#5050A0" }, - { NODE_SPORT_SKATING, "Skating", "" , "", "#5050A0" }, - { NODE_SPORT_SKATEBOARD, "Skateboard", "" , "", "#101080" }, + { NODE_SPORT_MOTOR, "Motor sport", "" , "sports", "#101080" }, + { NODE_SPORT_HOCKEY, "Hockey", "" , "sports", "#5050A0" }, + { NODE_SPORT_SKATING, "Skating", "" , "sports", "#5050A0" }, + { NODE_SPORT_SKATEBOARD, "Skateboard", "" , "sports", "#101080" }, { NODE_SPORT_HORSES, "Horses", "Horse riding or racing" , "sports/riding", "#101080" }, - { NODE_SPORT_DOG, "Dog racing", "" , "", "#101080" }, - { NODE_SPORT_BASKETBALL, "Basketball", "" , "", "#101080" }, - { NODE_SPORT_BASEBALL, "Baseball", "" , "", "#101080" }, + { NODE_SPORT_DOG, "Dog racing", "" , "sports", "#101080" }, + { NODE_SPORT_BASKETBALL, "Basketball", "" , "sports", "#101080" }, + { NODE_SPORT_BASEBALL, "Baseball", "" , "sports", "#101080" }, { NODE_SPORT_CANOE, "Canoe", "" , "", "#101080" }, - { NODE_SPORT_CROQUET, "Croquet", "" , "", "#101080" }, - { NODE_SPORT_CRICKET, "Cricket", "" , "", "#101080" }, - { NODE_SPORT_SHOOTING, "Shooting", "Shooting range" , "", "#101080" }, - { NODE_SPORT_PAINTBALL, "Paintball", "Run around and shoot people with paintballs" , "", "#101080" }, - { NODE_SPORT_TABLE_TENNIS, "Table tennis", "" , "", "#101080" }, - { NODE_SPORT_PELOTA, "Pelota", "" , "", "#101080" }, + { NODE_SPORT_CROQUET, "Croquet", "" , "sports", "#101080" }, + { NODE_SPORT_CRICKET, "Cricket", "" , "sports", "#101080" }, + { NODE_SPORT_SHOOTING, "Shooting", "Shooting range" , "sports", "#101080" }, + { NODE_SPORT_PAINTBALL, "Paintball", "Run around and shoot people with paintballs" , "sports", "#101080" }, + { NODE_SPORT_TABLE_TENNIS, "Table tennis", "" , "sports", "#101080" }, + { NODE_SPORT_PELOTA, "Pelota", "" , "sports", "#101080" }, { NODE_SPORT_RACQUET, "Racquet", "" , "sports/racquetball", "#101080" }, - { NODE_SPORT_BOWLS, "Lawn Bowls", "" , "", "#101080" }, - { NODE_SPORT_ATHLETICS, "Athletics", "" , "", "#101080" }, + { NODE_SPORT_BOWLS, "Lawn Bowls", "" , "sports", "#101080" }, + { NODE_SPORT_ATHLETICS, "Athletics", "" , "sports", "#101080" }, { NODE_SPORT_OTHER, "Other Sports", "" , "sports/stadium", "#101077" }, - { NODE_AMENITY_GENERIC, "Other", "Miscellaneous category for everything else." , "generic", "#002000" }, + { NODE_AMENITY_GENERIC, "Other", "Miscellaneous category for everything else." , "misc", "#002000" }, { NODE_POI_END, NULL, NULL } }; @@ -152,7 +152,7 @@ return TRUE; } const gchar * -poi_get_icon_from_type(gint t) +poi_get_icon_from_type(node_type_t t) { guint i; diff --git a/src/poi.h b/src/poi.h index b027151..1dca4c1 100644 --- a/src/poi.h +++ b/src/poi.h @@ -10,6 +10,8 @@ #include #include +#include "osm.h" + typedef enum { POI_TYPE_POINT=0, POI_TYPE_LANDMARK=1, @@ -135,8 +137,8 @@ gboolean poi_category_update(guint cat_id, poi_category *c); gboolean poi_category_toggle(guint cat_id, gboolean cat_enabled); GdkPixbuf *poi_get_icon(gchar *icon, gboolean big); - -const gchar *poi_get_icon_from_type(gint t); +const gchar *poi_get_icon_from_type(node_type_t t); +void poi_icon_hash_clear(void); GtkListStore *poi_category_generate_store(void);