diff options
author | Marco Peereboom <marco@conformal.com> | 2011-10-31 16:09:06 -0500 |
---|---|---|
committer | Marco Peereboom <marco@conformal.com> | 2011-10-31 16:09:06 -0500 |
commit | 05dfa9c4d20182dd8df5f9e42a5a12b0070c8d09 (patch) | |
tree | bd411cb1be9b4b7478f85d99c9d2d5fc69e36e57 | |
parent | fcdfea84a0863986e1b3e954f46f76184b0d104d (diff) | |
download | xombrero-05dfa9c4d20182dd8df5f9e42a5a12b0070c8d09.tar.gz |
enable web inspector
Right click a web page to which shows a menu option called "inspect element". Click on that and play play play!
-rw-r--r-- | xxxterm.c | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/xxxterm.c b/xxxterm.c index a2ecc93..767f73a 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -8911,6 +8911,8 @@ setup_webkit(struct tab *t) "enable_spell_checking", enable_spell_checking, (char *)NULL); g_object_set(G_OBJECT(t->settings), "spell_checking_languages", spell_check_languages, (char *)NULL); + g_object_set(G_OBJECT(t->settings), + "enable-developer-extras", TRUE, (char *)NULL); g_object_set(G_OBJECT(t->wv), "full-content-zoom", TRUE, (char *)NULL); @@ -8957,11 +8959,40 @@ update_statusbar_position(GtkAdjustment* adjustment, gpointer data) } GtkWidget * +create_window(const gchar *name) +{ + GtkWidget *w; + + w = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size(GTK_WINDOW(w), window_width, window_height); + gtk_widget_set_name(w, name); + gtk_window_set_wmclass(GTK_WINDOW(w), name, "XXXTerm"); + + return (w); +} + +WebKitWebView* +inspector_inspect_web_view_cb(WebKitWebInspector inspector, WebKitWebView* wv, + struct tab *t;) +{ + GtkWidget *inspector_window; + GtkWidget *inspector_view; + + inspector_window = create_window("inspector"); + inspector_view = webkit_web_view_new(); + gtk_container_add(GTK_CONTAINER(inspector_window), inspector_view); + gtk_widget_show_all(inspector_window); + + return WEBKIT_WEB_VIEW(inspector_view); +} + +GtkWidget * create_browser(struct tab *t) { GtkWidget *w; gchar *strval; GtkAdjustment *adjustment; + WebKitWebInspector *inspector; if (t == NULL) { show_oops(NULL, "create_browser invalid parameters"); @@ -9002,20 +9033,9 @@ create_browser(struct tab *t) setup_webkit(t); - return (w); -} - -GtkWidget * -create_window(void) -{ - GtkWidget *w; - - w = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size(GTK_WINDOW(w), window_width, window_height); - gtk_widget_set_name(w, "xxxterm"); - gtk_window_set_wmclass(GTK_WINDOW(w), "xxxterm", "XXXTerm"); - g_signal_connect(G_OBJECT(w), "delete_event", - G_CALLBACK (gtk_main_quit), NULL); + inspector = webkit_web_view_get_inspector(WEBKIT_WEB_VIEW(t->wv)); + g_signal_connect(G_OBJECT(inspector), "inspect-web-view", + G_CALLBACK(inspector_inspect_web_view_cb), t); return (w); } @@ -10005,8 +10025,10 @@ create_canvas(void) g_signal_connect(G_OBJECT(abtn), "button_press_event", G_CALLBACK(arrow_cb), NULL); - main_window = create_window(); + main_window = create_window("xxxterm"); gtk_container_add(GTK_CONTAINER(main_window), vbox); + g_signal_connect(G_OBJECT(main_window), "delete_event", + G_CALLBACK(gtk_main_quit), NULL); /* icons */ for (i = 0; i < LENGTH(icons); i++) { |