From 0c63d5983df779d4f4001a711978e072ee715840 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sun, 16 Sep 2007 12:10:34 +0000 Subject: Use friendly display for mailto: links; shows a nice text in status bar when hovering a mailto: link. Initial patch by Diego Escalante Urrelo, fixes bug #339161. svn path=/trunk/; revision=7452 --- src/ephy-tab.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/ephy-tab.c') diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 4e31dd573..8b3a32be1 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -1039,10 +1039,49 @@ ephy_tab_get_load_status (EphyTab *tab) static void ephy_tab_set_link_message (EphyTab *tab, char *message) { + char *status_message; + char **splitted_message; g_return_if_fail (EPHY_IS_TAB (tab)); g_free (tab->priv->link_message); - tab->priv->link_message = ephy_string_blank_chr (message); + status_message = ephy_string_blank_chr (message); + + if (status_message && g_str_has_prefix (status_message, "mailto:")) + { + int i = 1; + char *p; + GString *tmp; + + /* We first want to eliminate all the things after "?", like + * cc, subject and alike. + */ + + p = strchr (status_message, '?'); + if (p != NULL) *p = '\0'; + + /* Then we also want to check if there is more than an email address + * in the mailto: list. + */ + + splitted_message = g_strsplit_set (status_message, ";", -1); + tmp = g_string_new (g_strdup_printf (_("Send an email message to ā€œ%sā€"), + (splitted_message[0] + 7))); + + while (splitted_message [i] != NULL) + { + g_string_append_printf (tmp, ", ā€œ%sā€", splitted_message[i]); + i++; + } + + tab->priv->link_message = g_string_free (tmp, FALSE); + + g_free (status_message); + g_strfreev (splitted_message); + } + else + { + tab->priv->link_message = status_message; + } g_object_notify (G_OBJECT (tab), "message"); } -- cgit v1.2.3