aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/ui/epiphany-ui.xml8
-rw-r--r--src/ephy-window.c9
-rw-r--r--src/popup-commands.c21
-rw-r--r--src/popup-commands.h3
4 files changed, 41 insertions, 0 deletions
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 1f3dcaceb..5be9e4f26 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -117,6 +117,8 @@
<menuitem name="SaveImageAsIP" action="SaveImageAs"/>
<menuitem name="SetImageAsBackgroundIP" action="SetImageAsBackground"/>
<menuitem name="CopyImageLocationIP" action="CopyImageLocation"/>
+ <separator />
+ <menuitem name="InspectElementIP" action="InspectElement"/>
</popup>
<popup name="EphyDocumentPopup" action="PopupAction">
@@ -134,6 +136,8 @@
<menuitem name="SaveImageAsDP" action="SaveImageAs"/>
<menuitem name="SetImageAsBackgroundDP" action="SetImageAsBackground"/>
<menuitem name="CopyImageLocationDP" action="CopyImageLocation"/>
+ <separator />
+ <menuitem name="InspectElementDP" action="InspectElement"/>
</popup>
<popup name="EphyLinkPopup" action="PopupAction">
@@ -152,6 +156,8 @@
<menuitem name="SaveImageAsLP" action="SaveImageAs"/>
<menuitem name="SetImageAsBackgroundLP" action="SetImageAsBackground"/>
<menuitem name="CopyImageLocationLP" action="CopyImageLocation"/>
+ <separator />
+ <menuitem name="InspectElementLP" action="InspectElement"/>
</popup>
<popup name="EphyEmailLinkPopup" action="PopupAction">
@@ -164,6 +170,8 @@
<menuitem name="SaveImageAsELP" action="SaveImageAs"/>
<menuitem name="SetImageAsBackgroundELP" action="SetImageAsBackground"/>
<menuitem name="CopyImageLocationELP" action="CopyImageLocation"/>
+ <separator />
+ <menuitem name="InspectElementELP" action="InspectElement"/>
</popup>
<popup name="EphyNotebookPopup" action="NotebookPopupAction">
diff --git a/src/ephy-window.c b/src/ephy-window.c
index df0c7dfb1..a734e94f9 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -345,6 +345,10 @@ static const GtkActionEntry ephy_popups_entries [] = {
NULL, NULL },
{ "StopImageAnimation", NULL, N_("St_op Animation"), NULL,
NULL, NULL },
+
+ /* Inspector */
+ { "InspectElement", NULL, N_("Inspect _Element"), NULL,
+ NULL, G_CALLBACK (popup_cmd_inspect_element) },
};
static const struct
@@ -1119,6 +1123,7 @@ update_popup_actions_visibility (EphyWindow *window,
{
GtkAction *action;
GtkActionGroup *action_group;
+ gboolean inspector_enabled;
action_group = window->priv->popups_action_group;
@@ -1133,6 +1138,10 @@ update_popup_actions_visibility (EphyWindow *window,
action = gtk_action_group_get_action (action_group, "OpenFrame");
gtk_action_set_visible (action, is_frame);
+
+ inspector_enabled = eel_gconf_get_boolean (CONF_WEB_INSPECTOR_ENABLED);
+ action = gtk_action_group_get_action (action_group, "InspectElement");
+ gtk_action_set_visible (action, inspector_enabled);
}
static void
diff --git a/src/popup-commands.c b/src/popup-commands.c
index cbaf1e46b..755817e82 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -521,3 +521,24 @@ popup_cmd_open_image (GtkAction *action,
g_value_unset (&value);
g_free (scheme);
}
+
+void
+popup_cmd_inspect_element (GtkAction *action, EphyWindow *window)
+{
+ EphyEmbedEvent *event;
+ EphyEmbed *embed;
+ WebKitWebInspector *inspector;
+ guint x, y;
+
+ embed = ephy_embed_container_get_active_child
+ (EPHY_EMBED_CONTAINER (window));
+
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
+
+ inspector = webkit_web_view_get_inspector
+ (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
+
+ ephy_embed_event_get_coords (event, &x, &y);
+ webkit_web_inspector_inspect_coordinates (inspector, (gdouble)x, (gdouble)y);
+}
diff --git a/src/popup-commands.h b/src/popup-commands.h
index b1531bd5f..ddfc67632 100644
--- a/src/popup-commands.h
+++ b/src/popup-commands.h
@@ -65,3 +65,6 @@ void popup_cmd_download_link (GtkAction *action,
void popup_cmd_save_image_as (GtkAction *action,
EphyWindow *window);
+
+void popup_cmd_inspect_element (GtkAction *action,
+ EphyWindow *window);