]> err.no Git - mapper/commitdiff
Use a HTML table. Add url click handler that does nothing.
authorKaj-Michael Lang <milang@tal.org>
Mon, 5 Nov 2007 20:26:03 +0000 (22:26 +0200)
committerKaj-Michael Lang <milang@tal.org>
Mon, 5 Nov 2007 20:26:03 +0000 (22:26 +0200)
src/poi-gui.c

index 4d9ecd0ff77c54502cadc2bd9478ba816920e248..026a396725324434eaff5a4481f000102c673f22 100644 (file)
@@ -676,6 +676,17 @@ if (poi_category_list())
 return TRUE;
 }
 
+static void
+poi_info_url_cb(GtkHTML *html, const gchar *url, gpointer data)
+{
+g_printf("URL: %s\n", url);
+#ifdef WITH_OSSO
+/* XXX: Start browser... */
+#else
+
+#endif
+}
+
 gboolean
 poi_info_dialog(guint poi_id)
 {
@@ -693,16 +704,17 @@ if (!p)
 ls=strlen(p->label);
 
 phtml=g_strdup_printf(
-       "<html><body>"
-       "<b>%s%s</b><br><div>"
-       "<i>Location:</i><br>%f, %f<br>"
-       "<i>Public:</i>%s<br>"
-       "<i>Source:</i>%s<br>"
-       "<i>Category:</i><br>%s<br>"
-       "<i>Description:</i><br>%s<br>"
-       "<i>URL:</i><a href=\"%s\">%s</a><br>"
-       "<i>Postal Code:</i>%s<br>"
-       "</div></body></html>",
+       "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"
+       "<body>"
+       "<b>%s%s</b><br><table>"
+       "<tr><th align=\"left\">Location:</th><td>%f, %f</td></tr>"
+       "<tr><th align=\"left\">Public:</th><td>%s</td></tr>"
+       "<tr><th align=\"left\">Source:</th><td>%s</td></tr>"
+       "<tr><th align=\"left\">Category:</th><td>%s</td></tr>"
+       "<tr><th align=\"left\">Description:</th><td>%s</td></tr>"
+       "<tr><th align=\"left\">URL:</th><td><a href=\"%s\">%s</a></td></tr>"
+       "<tr><th align=\"left\">Postal Code:</th><td>%s</td></tr>"
+       "</table></body></html>",
        ls>0 ? p->label : p->cat_label,
        ls==0 ? " (No name)" : "",
        p->lat, p->lon,
@@ -725,11 +737,14 @@ dialog=gtk_dialog_new_with_buttons(_("POI"),
 
 info=gtk_html_new();
 gtk_html_set_editable(GTK_HTML(info), FALSE);
+gtk_html_allow_selection(GTK_HTML(info), TRUE);
 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);
 
+g_signal_connect(G_OBJECT(info), "link_clicked", G_CALLBACK(poi_info_url_cb), NULL);
+
 gtk_html_load_from_string(info, phtml, -1);
 
 gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 250);