unit2latlon(ux, uy, lat, lon);
if (map_poi_find_at_latlon(lat, lon, &poi_id)==TRUE) {
g_printf("POI: %d\n", poi_id);
+ if (poi_info_dialog(poi_id)==FALSE)
+ g_printerr("Huh? Failed to display info dialog\n");
} else {
map_drag_start(event->x, event->y);
}
#include <fcntl.h>
#include <libintl.h>
#include <locale.h>
+#include <gtkhtml/gtkhtml.h>
#include "utils.h"
#include "poi.h"
return TRUE;
}
+gboolean
+poi_info_dialog(guint poi_id)
+{
+GtkWidget *dialog;
+GtkWidget *info;
+GtkWidget *sw;
+poi_info *p;
+gchar *phtml;
+
+p=poi_get_by_id(poi_id);
+if (!p)
+ return FALSE;
+
+phtml=g_strdup_printf(
+ "<html><body>"
+ "<b>%s</b><br>"
+ "<div><i>Lat: </i>%f<br><i>Lon: </i>%f</id></div>"
+ "<div><i>%s</i><br>%s</div>"
+ "<div><i>URL:</i>%s<br><i>Postal Code:</i>%s</div>"
+ "</body></html>",
+ strlen(p->label)>0 ? p->label : "Unnamed POI",
+ p->lat, p->lon,
+ p->cat_desc ? p->cat_desc : "",
+ p->desc ? p->desc : "",
+ p->url ? p->url : "",
+ p->postal_code ? p->postal_code : "");
+
+dialog=gtk_dialog_new_with_buttons(_("POI"),
+ GTK_WINDOW(_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+info=gtk_html_new();
+gtk_html_set_editable(GTK_HTML(info), FALSE);
+sw=gtk_scrolled_window_new(NULL, NULL);
+gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+gtk_container_add(GTK_CONTAINER(sw), info);
+gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), sw, TRUE, TRUE, 0);
+
+gtk_html_load_from_string(info, phtml, -1);
+
+gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 250);
+gtk_widget_show_all(dialog);
+gtk_dialog_run(dialog);
+gtk_widget_destroy(dialog);
+
+g_free(phtml);
+poi_free(p);
+
+return TRUE;
+}
/**
* poi_edit_dialog
*
gboolean poi_search_dialog(GtkListStore *store, poi_info *poi, gdouble lat, gdouble lon);
gboolean poi_quick_dialog(gdouble lat, gdouble lon);
+gboolean poi_info_dialog(guint poi_id);
+
gboolean poi_category_dialog(guint cat_id);
gboolean poi_category_list();