From a1faea0314930cf42b495d63758250ef83397bad Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 5 Nov 2007 22:26:03 +0200 Subject: [PATCH] Use a HTML table. Add url click handler that does nothing. --- src/poi-gui.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/poi-gui.c b/src/poi-gui.c index 4d9ecd0..026a396 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -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( - "" - "%s%s
" - "Location:
%f, %f
" - "Public:%s
" - "Source:%s
" - "Category:
%s
" - "Description:
%s
" - "URL:%s
" - "Postal Code:%s
" - "
", + "" + "" + "%s%s
" + "" + "" + "" + "" + "" + "" + "" + "
Location:%f, %f
Public:%s
Source:%s
Category:%s
Description:%s
URL:%s
Postal Code:%s
", 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); -- 2.39.5