diff options
-rw-r--r-- | data/epiphany.schemas.in | 11 | ||||
-rw-r--r-- | data/glade/prefs-dialog.glade | 84 | ||||
-rw-r--r-- | embed/ephy-embed-prefs.h | 1 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-prefs.c | 5 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.c | 64 | ||||
-rw-r--r-- | src/prefs-dialog.c | 13 |
6 files changed, 171 insertions, 7 deletions
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in index 9c4a0149c..51bcb107e 100644 --- a/data/epiphany.schemas.in +++ b/data/epiphany.schemas.in @@ -519,6 +519,17 @@ <long></long> </locale> </schema> + <schema> + <key>/schemas/apps/epiphany/web/inspector_enabled</key> + <applyto>/apps/epiphany/web/inspector_enabled</applyto> + <owner>epiphany</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Enable Web Inspector</short> + <long></long> + </locale> + </schema> </schemalist> </gconfschemafile> diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade index 4062df83a..841502a4b 100644 --- a/data/glade/prefs-dialog.glade +++ b/data/glade/prefs-dialog.glade @@ -374,6 +374,90 @@ </widget> <packing> <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox201"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label1318"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Web Development</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment20"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkVBox" id="vbox203"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkCheckButton" id="checkbutton2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Enable Web Inspector</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h index 0222c96cb..79c381816 100644 --- a/embed/ephy-embed-prefs.h +++ b/embed/ephy-embed-prefs.h @@ -17,6 +17,7 @@ #define CONF_IMAGE_ANIMATION_MODE "/apps/epiphany/web/image_animation" #define CONF_IMAGE_LOADING_MODE "/apps/epiphany/web/image_loading" #define CONF_DISPLAY_SMOOTHSCROLL "/apps/epiphany/web/smooth_scroll" +#define CONF_WEB_INSPECTOR_ENABLED "/apps/epiphany/web/inspector_enabled" /* These are defined gnome wide now */ #define CONF_NETWORK_PROXY_MODE "/system/proxy/mode" diff --git a/embed/webkit/webkit-embed-prefs.c b/embed/webkit/webkit-embed-prefs.c index 978be49fb..4ee0d0ea0 100644 --- a/embed/webkit/webkit-embed-prefs.c +++ b/embed/webkit/webkit-embed-prefs.c @@ -111,7 +111,10 @@ static const PrefData webkit_pref_entries[] = webkit_pref_callback_boolean }, { CONF_LANGUAGE_DEFAULT_ENCODING, "default-encoding", - webkit_pref_callback_string } + webkit_pref_callback_string }, + { CONF_WEB_INSPECTOR_ENABLED, + "enable-developer-extras", + webkit_pref_callback_boolean } }; static void diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index 198ff07f8..59bf4aeee 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -1,4 +1,5 @@ /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ +/* vim: set sw=2 ts=2 sts=2 et: */ /* * Copyright © 2007 Xan Lopez * Copyright © 2008 Jan Alonzo @@ -32,6 +33,7 @@ #include <webkit/webkit.h> #include <string.h> +#include <glib/gi18n.h> #include "webkit-embed.h" #include "webkit-embed-prefs.h" @@ -59,6 +61,7 @@ struct WebKitEmbedPrivate WebKitEmbedLoadState load_state; char *loading_uri; EphyHistory *history; + GtkWidget *inspector_window; guint is_setting_zoom : 1; }; @@ -301,11 +304,45 @@ webkit_embed_class_init (WebKitEmbedClass *klass) g_type_class_add_private (object_class, sizeof(WebKitEmbedPrivate)); } +static WebKitWebView * +webkit_embed_inspect_web_view_cb (WebKitWebInspector *inspector, + WebKitWebView *web_view, + gpointer data) +{ + GtkWidget *inspector_sw = GTK_WIDGET (data); + GtkWidget *inspector_web_view; + + inspector_web_view = webkit_web_view_new (); + gtk_container_add (GTK_CONTAINER (inspector_sw), inspector_web_view); + + gtk_widget_show_all (gtk_widget_get_toplevel (inspector_sw)); + + return WEBKIT_WEB_VIEW (inspector_web_view); +} + +static gboolean +webkit_embed_inspect_show_cb (WebKitWebInspector *inspector, + GtkWidget *widget) +{ + gtk_widget_show (widget); + return TRUE; +} + +static gboolean +webkit_embed_inspect_close_cb (WebKitWebInspector *inspector, + GtkWidget *widget) +{ + gtk_widget_hide (widget); + return TRUE; +} + static void webkit_embed_init (WebKitEmbed *embed) { WebKitWebView *web_view; + WebKitWebInspector *inspector; GtkWidget *sw; + GtkWidget *inspector_sw; embed->priv = WEBKIT_EMBED_GET_PRIVATE (embed); @@ -334,6 +371,33 @@ webkit_embed_init (WebKitEmbed *embed) g_signal_connect (web_view, "notify::zoom-level", G_CALLBACK (webkit_web_view_zoom_change_cb), embed); + embed->priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + inspector = webkit_web_view_get_inspector (web_view); + + inspector_sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (inspector_sw), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (embed->priv->inspector_window), + inspector_sw); + + gtk_window_set_title (GTK_WINDOW (embed->priv->inspector_window), + _("Web Inspector")); + gtk_window_set_default_size (GTK_WINDOW (embed->priv->inspector_window), + 400, 300); + + g_signal_connect (embed->priv->inspector_window, + "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), + NULL); + + g_object_connect (inspector, + "signal::inspect-web-view", G_CALLBACK (webkit_embed_inspect_web_view_cb), + inspector_sw, + "signal::show-window", G_CALLBACK (webkit_embed_inspect_show_cb), + embed->priv->inspector_window, + "signal::close-window", G_CALLBACK (webkit_embed_inspect_close_cb), + embed->priv->inspector_window, + NULL); + webkit_embed_prefs_add_embed (embed); embed->priv->history = EPHY_HISTORY (ephy_embed_shell_get_global_history (ephy_embed_shell_get_default ())); diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index c3221e983..88bdfab2a 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -110,12 +110,13 @@ EphyDialogProperty properties [] = { "prefs_notebook", NULL, PT_NORMAL, 0}, /* General */ - { "homepage_entry", CONF_GENERAL_HOMEPAGE, PT_AUTOAPPLY, G_TYPE_STRING }, - { "homepage_current_button", NULL, PT_NORMAL, 0 }, - { "homepage_blank_button", NULL, PT_NORMAL, 0 }, - { "automatic_downloads_checkbutton", CONF_AUTO_DOWNLOADS, PT_AUTOAPPLY, 0 }, - { "download_button_hbox", NULL, PT_NORMAL, 0 }, - { "download_button_label", NULL, PT_NORMAL, 0 }, + { "homepage_entry", CONF_GENERAL_HOMEPAGE, PT_AUTOAPPLY, G_TYPE_STRING }, + { "homepage_current_button", NULL, PT_NORMAL, 0 }, + { "homepage_blank_button", NULL, PT_NORMAL, 0 }, + { "automatic_downloads_checkbutton", CONF_AUTO_DOWNLOADS, PT_AUTOAPPLY, 0 }, + { "download_button_hbox", NULL, PT_NORMAL, 0 }, + { "download_button_label", NULL, PT_NORMAL, 0 }, + { "web_inspector_checkbutton", CONF_WEB_INSPECTOR_ENABLED, PT_AUTOAPPLY, 0 }, /* Fonts and Colors */ { "use_fonts_checkbutton", CONF_RENDERING_USE_OWN_FONTS, PT_AUTOAPPLY | PT_INVERTED, 0 }, |