diff --git a/WebKitTools/GtkLauncher/main.c b/WebKitTools/GtkLauncher/main.c
index 8ed2690..c503f52 100644
--- a/WebKitTools/GtkLauncher/main.c
+++ b/WebKitTools/GtkLauncher/main.c
@@ -34,6 +34,7 @@ static WebKitWebView* web_view;
static gchar* main_title;
static gint load_progress;
static guint status_context_id;
+static GtkWidget* inspector_window;
static void
activate_uri_entry_cb (GtkWidget* entry, gpointer data)
@@ -89,6 +90,81 @@ load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data)
}
static void
+hide_window_cb(GtkWidget *widget, gpointer data)
+{
+ gtk_widget_hide(widget);
+}
+
+static WebKitWebView*
+create_inspector_cb (WebKitWebInspector* web_inspector, WebKitWebView* page, gpointer data)
+{
+ GtkWidget* scrolled_window;
+ GtkWidget* new_web_view;
+
+ inspector_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ g_signal_connect(G_OBJECT(inspector_window), "delete-event",
+ G_CALLBACK(hide_window_cb), NULL);
+
+ gtk_window_set_title(GTK_WINDOW(inspector_window), "Inspector");
+ gtk_window_set_default_size(GTK_WINDOW(inspector_window), 400, 300);
+ gtk_widget_show(inspector_window);
+
+ scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add(GTK_CONTAINER(inspector_window), scrolled_window);
+ gtk_widget_show(scrolled_window);
+
+ new_web_view = webkit_web_view_new();
+ gtk_container_add(GTK_CONTAINER(scrolled_window), new_web_view);
+
+ return WEBKIT_WEB_VIEW(new_web_view);
+}
+
+static gboolean
+inspector_show_window_cb (WebKitWebInspector* inspector)
+{
+ gtk_widget_show(inspector_window);
+ g_message("show_window: %p", inspector);
+ return TRUE;
+}
+
+static gboolean
+inspector_close_window_cb (WebKitWebInspector* inspector)
+{
+ g_message("close_window");
+ return TRUE;
+}
+
+static gboolean
+inspector_attach_window_cb (WebKitWebInspector* inspector)
+{
+ g_message("attach_window");
+ return FALSE;
+}
+
+static gboolean
+inspector_dettach_window_cb (WebKitWebInspector* inspector)
+{
+ g_message("dettach_window");
+ return FALSE;
+}
+
+static gboolean
+inspector_uri_changed_cb (WebKitWebInspector* inspector)
+{
+ g_message("uri_changed: %s", webkit_web_inspector_get_inspected_uri(inspector));
+ return FALSE;
+}
+
+static gboolean
+inspector_inspector_destroyed_cb (WebKitWebInspector* inspector)
+{
+ g_message("destroy");
+ return FALSE;
+}
+
+static void
destroy_cb (GtkWidget* widget, gpointer data)
{
gtk_main_quit ();
@@ -109,17 +185,33 @@ go_forward_cb (GtkWidget* widget, gpointer data)
static GtkWidget*
create_browser ()
{
+ WebKitWebSettings *settings = webkit_web_settings_new();
+ WebKitWebInspector *inspector;
+
GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
+ g_object_set(G_OBJECT(settings), "enable-developer-extras", TRUE, NULL);
+ webkit_web_view_set_settings(WEBKIT_WEB_VIEW(web_view), settings);
+
g_signal_connect (G_OBJECT (web_view), "title-changed", G_CALLBACK (title_change_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
+ inspector = webkit_web_view_get_inspector(web_view);
+ g_signal_connect (G_OBJECT (inspector), "inspect-web-view", G_CALLBACK (create_inspector_cb), NULL);
+ g_signal_connect (G_OBJECT (inspector), "show-window", G_CALLBACK (inspector_show_window_cb), NULL);
+ g_signal_connect (G_OBJECT (inspector), "close-window", G_CALLBACK (inspector_close_window_cb), NULL);
+ g_signal_connect (G_OBJECT (inspector), "attach-window", G_CALLBACK (inspector_attach_window_cb), NULL);
+ g_signal_connect (G_OBJECT (inspector), "dettach-window", G_CALLBACK (inspector_dettach_window_cb), NULL);
+ g_signal_connect (G_OBJECT (inspector), "destroy", G_CALLBACK (inspector_inspector_destroyed_cb), NULL);
+
+ g_signal_connect (G_OBJECT (inspector), "notify::inspected-uri", G_CALLBACK (inspector_uri_changed_cb), NULL);
+
return scrolled_window;
}