[evolution-patches] Google maps from addressbook
- From: William Jon McCann <mccannwj pha jhu edu>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] Google maps from addressbook
- Date: Sat, 12 Feb 2005 04:21:13 -0500
Hi,
Here is a patch to use google maps from the addressbook.
Jon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1919
diff -p -u -r1.1919 ChangeLog
--- ChangeLog 10 Feb 2005 05:34:03 -0000 1.1919
+++ ChangeLog 12 Feb 2005 09:17:56 -0000
@@ -1,3 +1,8 @@
+2005-02-12 William Jon McCann <mccann jhu edu>
+
+ * gui/widgets/eab-contact-display.c (accum_address):
+ Add support for google maps.
+
2005-02-09 Hans Petter Jansson <hpj novell com>
* gui/contact-editor/Makefile.am:
Index: gui/widgets/eab-contact-display.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-contact-display.c,v
retrieving revision 1.19
diff -p -u -r1.19 eab-contact-display.c
--- gui/widgets/eab-contact-display.c 24 Jan 2005 17:28:37 -0000 1.19
+++ gui/widgets/eab-contact-display.c 12 Feb 2005 09:17:56 -0000
@@ -192,11 +192,7 @@ accum_address (GString *gstr, EContact *
if (label) {
char *html = e_text_to_html (label, E_TEXT_TO_HTML_CONVERT_NL);
-#if mapping_works
- g_string_append_printf (gstr, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\">%s</a></td><td valign=\"top\">%s</td></tr>", html_label, _("(map)"), html);
-#else
- g_string_append_printf (gstr, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font></td><td valign=\"top\">%s</td></tr>", html_label, html);
-#endif
+ g_string_append_printf (gstr, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://maps.google.com/maps?q=%s\">%s</a></td><td valign=\"top\">%s</td></tr>", html_label, label, _("(map)"), html);
g_free (html);
return;
@@ -205,18 +201,27 @@ accum_address (GString *gstr, EContact *
adr = e_contact_get (contact, adr_field);
if (adr &&
(adr->po || adr->ext || adr->street || adr->locality || adr->region || adr->code || adr->country)) {
+ char *adr_array [10];
+ char *display;
+ char *query;
+ int i = 0;
- g_string_append_printf (gstr, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\">%s</a></td><td valign=\"top\">", html_label, _("map"));
+ if (adr->po && *adr->po) adr_array[i++] = adr->po;
+ if (adr->ext && *adr->ext) adr_array[i++] = adr->ext;
+ if (adr->street && *adr->street) adr_array[i++] = adr->street;
+ if (adr->locality && *adr->locality) adr_array[i++] = adr->locality;
+ if (adr->region && *adr->region) adr_array[i++] = adr->region;
+ if (adr->code && *adr->code) adr_array[i++] = adr->code;
+ if (adr->country && *adr->country) adr_array[i++] = adr->country;
+ adr_array[i++] = NULL;
- if (adr->po && *adr->po) g_string_append_printf (gstr, "%s<br>", adr->po);
- if (adr->ext && *adr->ext) g_string_append_printf (gstr, "%s<br>", adr->ext);
- if (adr->street && *adr->street) g_string_append_printf (gstr, "%s<br>", adr->street);
- if (adr->locality && *adr->locality) g_string_append_printf (gstr, "%s<br>", adr->locality);
- if (adr->region && *adr->region) g_string_append_printf (gstr, "%s<br>", adr->region);
- if (adr->code && *adr->code) g_string_append_printf (gstr, "%s<br>", adr->code);
- if (adr->country && *adr->country) g_string_append_printf (gstr, "%s<br>", adr->country);
+ query = g_strjoinv (" ", adr_array);
+ display = g_strjoinv ("<br>", adr_array);
- g_string_append_printf (gstr, "</td></tr>");
+ g_string_append_printf (gstr, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://maps.google.com/maps?q=%s\">%s</a></td><td valign=\"top\">%s</td></tr>", html_label, query, _("(map)"), display);
+
+ g_free (query);
+ g_free (display);
}
if (adr)
e_contact_address_free (adr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]