WebKitWebInspector

WebKitWebInspector — Access to the WebKit Inspector

Synopsis

                    WebKitWebInspector;
const gchar *       webkit_web_inspector_get_inspected_uri
                                                        (WebKitWebInspector *web_inspector);
WebKitWebView *     webkit_web_inspector_get_web_view   (WebKitWebInspector *web_inspector);
void                webkit_web_inspector_inspect_coordinates
                                                        (WebKitWebInspector *web_inspector,
                                                         gdouble x,
                                                         gdouble y);
void                webkit_web_inspector_show           (WebKitWebInspector *webInspector);
void                webkit_web_inspector_close          (WebKitWebInspector *webInspector);

Description

The WebKit Inspector is a graphical tool to inspect and change the content of a WebKitWebView. It also includes an interactive JavaScriptDebugger. Using this class one can get a GtkWidget which can be embedded into an application to show the inspector.

The inspector is available when the WebKitWebSettings of the WebKitWebView has set the "enable-developer-extras" to true otherwise no inspector is available.

/* Enable the developer extras */
WebKitWebSettings *setting = webkit_web_view_get_settings (WEBKIT_WEB_VIEW(my_webview));
g_object_set (G_OBJECT(settings), "enable-developer-extras", TRUE, NULL);

/* load some data or reload to be able to inspect the page*/
webkit_web_view_open (WEBKIT_WEB_VIEW(my_webview), "http://www.gnome.org");

/* Embed the inspector somewhere */
WebKitWebInspector *inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW(my_webview));
g_signal_connect (G_OBJECT (inspector), "inspect-web-view", G_CALLBACK(create_gtk_window_around_it), NULL);
g_signal_connect (G_OBJECT (inspector), "show-window", G_CALLBACK(show_inpector_window), NULL));
g_signal_connect (G_OBJECT (inspector), "notify::inspected-uri", G_CALLBACK(inspected_uri_changed_do_stuff), NULL);

Details

WebKitWebInspector

typedef struct {
    GObject parent_instance;

    WebKitWebInspectorPrivate* priv;
} WebKitWebInspector;


webkit_web_inspector_get_inspected_uri ()

const gchar *       webkit_web_inspector_get_inspected_uri
                                                        (WebKitWebInspector *web_inspector);

Obtains the URI that is currently being inspected.

web_inspector :

Returns :

a pointer to the URI as an internally allocated string; it should not be freed, modified or stored.

Since 1.0.3


webkit_web_inspector_get_web_view ()

WebKitWebView *     webkit_web_inspector_get_web_view   (WebKitWebInspector *web_inspector);

Obtains the WebKitWebView that is used to render the inspector. The WebKitWebView instance is created by the application, by handling the "inspect-web-view" signal. This means that this method may return NULL if the user hasn't inspected anything.

web_inspector :

Returns :

the WebKitWebView instance that is used to render the inspector or NULL if it is not yet created.

Since 1.0.3


webkit_web_inspector_inspect_coordinates ()

void                webkit_web_inspector_inspect_coordinates
                                                        (WebKitWebInspector *web_inspector,
                                                         gdouble x,
                                                         gdouble y);

Causes the Web Inspector to inspect the node that is located at the given coordinates of the widget. The coordinates should be relative to the WebKitWebView widget, not to the scrollable content, and may be obtained from a GdkEvent directly.

This means x, and y being zero doesn't guarantee you will hit the left-most top corner of the content, since the contents may have been scrolled.

web_inspector :

the WebKitWebInspector that will do the inspection

x :

the X coordinate of the node to be inspected

y :

the Y coordinate of the node to be inspected

Since 1.1.17


webkit_web_inspector_show ()

void                webkit_web_inspector_show           (WebKitWebInspector *webInspector);

Causes the Web Inspector to be shown.

webInspector :

Since 1.1.17


webkit_web_inspector_close ()

void                webkit_web_inspector_close          (WebKitWebInspector *webInspector);

Causes the Web Inspector to be closed.

webInspector :

Since 1.1.17