[epiphany] window: add a popup command to open links in incognito window
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] window: add a popup command to open links in incognito window
- Date: Thu, 4 Jun 2015 15:28:53 +0000 (UTC)
commit c54d16d37cbfdfe28e7c1c949a8e56b15314f583
Author: Claudio Saavedra <csaavedra igalia com>
Date: Tue Jun 2 17:11:17 2015 +0300
window: add a popup command to open links in incognito window
https://bugzilla.gnome.org/show_bug.cgi?id=749454
src/ephy-window.c | 11 ++++++++++-
src/popup-commands.c | 15 +++++++++++++++
src/popup-commands.h | 3 +++
3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 69e20cf..1e4198f 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -219,6 +219,8 @@ static const GtkActionEntry ephy_popups_entries [] = {
G_CALLBACK (popup_cmd_link_in_new_window) },
{ "OpenLinkInNewTab", NULL, N_("Open Link in New _Tab"), NULL, NULL,
G_CALLBACK (popup_cmd_link_in_new_tab) },
+ { "OpenLinkInIncognitoWindow", NULL, N_("Open Link in I_ncognito Window"), NULL, NULL,
+ G_CALLBACK (popup_cmd_link_in_incognito_window) },
{ "DownloadLinkAs", NULL, N_("_Save Link As…"), NULL, NULL,
G_CALLBACK (popup_cmd_download_link_as) },
{ "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
@@ -910,6 +912,9 @@ update_link_actions_sensitivity (EphyWindow *window,
action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab");
ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !link_has_web_scheme);
+
+ action = gtk_action_group_get_action (action_group, "OpenLinkInIncognitoWindow");
+ gtk_action_set_sensitive (action, link_has_web_scheme);
}
static void
@@ -1641,7 +1646,7 @@ populate_context_menu (WebKitWebView *web_view,
GList *spelling_guess_items = NULL;
EphyEmbedEvent *embed_event;
gboolean is_document = FALSE;
- gboolean app_mode;
+ gboolean app_mode, incognito_mode;
gboolean is_image;
gboolean is_media = FALSE;
gboolean is_video = FALSE;
@@ -1692,6 +1697,7 @@ populate_context_menu (WebKitWebView *web_view,
g_object_unref (embed_event);
app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) ==
EPHY_EMBED_SHELL_MODE_APPLICATION;
+ incognito_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) ==
EPHY_EMBED_SHELL_MODE_INCOGNITO;
update_edit_actions_sensitivity (window, FALSE);
@@ -1712,6 +1718,9 @@ populate_context_menu (WebKitWebView *web_view,
priv->popups_action_group, "OpenLinkInNewTab");
add_action_to_context_menu (context_menu,
priv->popups_action_group, "OpenLinkInNewWindow");
+ if (!incognito_mode)
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group,
"OpenLinkInIncognitoWindow");
webkit_context_menu_append (context_menu,
webkit_context_menu_item_new_separator ());
}
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 675347b..37cf424 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -367,3 +367,18 @@ popup_cmd_media_in_new_tab (GtkAction *action,
{
popup_cmd_view_in_new_tab (window, "media-uri");
}
+
+void
+popup_cmd_link_in_incognito_window (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedEvent *event;
+ GValue value = { 0, };
+
+ event = ephy_window_get_context_event (window);
+ g_assert (event != NULL);
+
+ ephy_embed_event_get_property (event, "link-uri", &value);
+ ephy_open_incognito_window (g_value_get_string (&value));
+ g_value_unset (&value);
+}
diff --git a/src/popup-commands.h b/src/popup-commands.h
index 9e40e73..a701ca1 100644
--- a/src/popup-commands.h
+++ b/src/popup-commands.h
@@ -32,6 +32,9 @@ void popup_cmd_link_in_new_window (GtkAction *action,
void popup_cmd_link_in_new_tab (GtkAction *action,
EphyWindow *window);
+void popup_cmd_link_in_incognito_window (GtkAction *action,
+ EphyWindow *window);
+
void popup_cmd_bookmark_link (GtkAction *action,
EphyWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]