epiphany r8634 - in trunk: data data/glade embed embed/webkit src



Author: xan
Date: Fri Dec 12 00:14:24 2008
New Revision: 8634
URL: http://svn.gnome.org/viewvc/epiphany?rev=8634&view=rev

Log:
Enable Web Inspector.

Bug #562446

Modified:
   trunk/data/epiphany.schemas.in
   trunk/data/glade/prefs-dialog.glade
   trunk/embed/ephy-embed-prefs.h
   trunk/embed/webkit/webkit-embed-prefs.c
   trunk/embed/webkit/webkit-embed.c
   trunk/src/prefs-dialog.c

Modified: trunk/data/epiphany.schemas.in
==============================================================================
--- trunk/data/epiphany.schemas.in	(original)
+++ trunk/data/epiphany.schemas.in	Fri Dec 12 00:14:24 2008
@@ -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>

Modified: trunk/data/glade/prefs-dialog.glade
==============================================================================
--- trunk/data/glade/prefs-dialog.glade	(original)
+++ trunk/data/glade/prefs-dialog.glade	Fri Dec 12 00:14:24 2008
@@ -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">&lt;b&gt;Web Development&lt;/b&gt;</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>

Modified: trunk/embed/ephy-embed-prefs.h
==============================================================================
--- trunk/embed/ephy-embed-prefs.h	(original)
+++ trunk/embed/ephy-embed-prefs.h	Fri Dec 12 00:14:24 2008
@@ -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"

Modified: trunk/embed/webkit/webkit-embed-prefs.c
==============================================================================
--- trunk/embed/webkit/webkit-embed-prefs.c	(original)
+++ trunk/embed/webkit/webkit-embed-prefs.c	Fri Dec 12 00:14:24 2008
@@ -111,7 +111,10 @@
       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

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c	(original)
+++ trunk/embed/webkit/webkit-embed.c	Fri Dec 12 00:14:24 2008
@@ -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 @@
   WebKitEmbedLoadState load_state;
   char *loading_uri;
   EphyHistory *history;
+  GtkWidget *inspector_window;
   guint is_setting_zoom : 1;
 };
 
@@ -301,11 +304,45 @@
   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 @@
   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 ()));

Modified: trunk/src/prefs-dialog.c
==============================================================================
--- trunk/src/prefs-dialog.c	(original)
+++ trunk/src/prefs-dialog.c	Fri Dec 12 00:14:24 2008
@@ -110,12 +110,13 @@
 	{ "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 },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]