aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@igalia.com>2012-12-10 22:21:19 +0800
committerDiego Escalante Urrelo <diegoe@gnome.org>2013-01-05 04:38:52 +0800
commit997b046b63c66566561402cfafc6d0a25322a02b (patch)
tree0eb889cdad3f269576e07e924f7ade15aa5bb990 /src/ephy-window.c
parent6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66 (diff)
downloadgsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.tar
gsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.tar.gz
gsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.tar.bz2
gsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.tar.lz
gsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.tar.xz
gsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.tar.zst
gsoc2013-epiphany-997b046b63c66566561402cfafc6d0a25322a02b.zip
e-window: add a smarter CopyEmailAddress action
It omits the mailto: in mail links and has a different string in the context menu, to make this clear. https://bugzilla.gnome.org/show_bug.cgi?id=688166
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index adb7e956d..4b4598976 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -240,6 +240,8 @@ static const GtkActionEntry ephy_popups_entries [] = {
NULL, NULL, G_CALLBACK (popup_cmd_bookmark_link) },
{ "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
NULL, G_CALLBACK (popup_cmd_copy_link_address) },
+ { "CopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_link_address) },
/* Images. */
@@ -1920,8 +1922,17 @@ populate_context_menu (WebKitWebView *web_view,
add_action_to_context_menu (context_menu,
priv->popups_action_group, "BookmarkLink");
}
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "CopyLinkAddress");
+
+ if (g_str_has_prefix (uri, "mailto:"))
+ {
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "CopyEmailAddress");
+ }
+ else
+ {
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "CopyLinkAddress");
+ }
}
else if (webkit_hit_test_result_context_is_editable (hit_test_result))
{
@@ -2021,6 +2032,7 @@ show_embed_popup (EphyWindow *window,
guint context;
const char *popup;
gboolean can_open_in_new;
+ gboolean mailto;
GtkWidget *widget;
guint button;
char *uri;
@@ -2028,6 +2040,7 @@ show_embed_popup (EphyWindow *window,
g_object_get (hit_test_result, "link-uri", &uri, NULL);
can_open_in_new = uri && ephy_embed_utils_address_has_web_scheme (uri);
+ mailto = g_str_has_prefix (uri, "mailto:");
g_free (uri);
g_object_get (hit_test_result, "context", &context, NULL);
@@ -2036,6 +2049,13 @@ show_embed_popup (EphyWindow *window,
if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (priv->popups_action_group, "CopyEmailAddress");
+ gtk_action_set_visible (action, mailto);
+ action = gtk_action_group_get_action (priv->popups_action_group, "CopyLinkAddress");
+ gtk_action_set_visible (action, !mailto);
+
popup = "/EphyLinkPopup";
update_edit_actions_sensitivity (window, TRUE);
}