[yelp: 2/4] [libyelp/yelp-view] Special right-click menu for mailto: links
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp: 2/4] [libyelp/yelp-view] Special right-click menu for mailto: links
- Date: Fri, 21 May 2010 23:30:48 +0000 (UTC)
commit 55da84092d431ba44f17cba8a96aaac54ce02273
Author: Shaun McCance <shaunm gnome org>
Date: Fri May 21 16:22:42 2010 -0500
[libyelp/yelp-view] Special right-click menu for mailto: links
libyelp/yelp-view.c | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index b237c6c..783f705 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -812,15 +812,31 @@ view_populate_popup (YelpView *view,
g_free (priv->popup_link_uri);
priv->popup_link_uri = uri;
- item = gtk_menu_item_new_with_mnemonic (_("_Open Link"));
- g_signal_connect (item, "activate",
- G_CALLBACK (popup_open_link), view);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ if (g_str_has_prefix (priv->popup_link_uri, "mailto:")) {
+ /* Not using a mnemonic because underscores are common in email
+ * addresses, and we'd have to escape them. There doesn't seem
+ * to be a quick GTK+ function for this. In practice, there will
+ * probably only be one menu item for mailto link popups anyway,
+ * so the mnemonic's not that big of a deal.
+ */
+ gchar *label = g_strdup_printf (_("Send email to %s"),
+ priv->popup_link_uri + 7);
+ item = gtk_menu_item_new_with_label (label);
+ g_signal_connect (item, "activate",
+ G_CALLBACK (popup_open_link), view);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ }
+ else {
+ item = gtk_menu_item_new_with_mnemonic (_("_Open Link"));
+ g_signal_connect (item, "activate",
+ G_CALLBACK (popup_open_link), view);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- item = gtk_menu_item_new_with_mnemonic (_("Open Link in New _Window"));
- g_signal_connect (item, "activate",
- G_CALLBACK (popup_open_link_new), view);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ item = gtk_menu_item_new_with_mnemonic (_("Open Link in New _Window"));
+ g_signal_connect (item, "activate",
+ G_CALLBACK (popup_open_link_new), view);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ }
}
else {
item = gtk_action_create_menu_item (gtk_action_group_get_action (priv->action_group,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]