1.43 <WebKitWebInspector>

Class: <WebKitWebInspector>

It derives from <GObject>.

Access to the WebKit inspector.

The WebKit Inspector is a graphical tool to inspect and change the content of a <WebKitWebView>. It also includes an interactive JavaScript debugger. 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 <WebKitSettings> of the <WebKitWebView> has set the settings:enable-developer-extras to true, otherwise no inspector is available.

// Enable the developer extras
WebKitSettings *settings = 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_load_uri (WEBKIT_WEB_VIEW(my_webview), "http://www.gnome.org");

// Show the inspector
WebKitWebInspector *inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW(my_webview));
webkit_web_inspector_show (WEBKIT_WEB_INSPECTOR(inspector));

Properties

Property: web-inspector:attached-height self

The height that the inspector view should have when it is attached.

Its value is an unsigned 32-bit integer.

It is read only.

Property: web-inspector:can-attach self

Whether the inspector can be attached to the same window that contains the inspected view.

Its value is a boolean.

It is read only.

Property: web-inspector:inspected-uri self

The URI that is currently being inspected.

Its value is a string, or #f.

It is read only.

Procedures

Method: web-inspector:attach self
Method: attach self

Request self to be attached.

The signal web-inspector:attach will be emitted. If the inspector is already attached it does nothing.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

Method: web-inspector:close self
Method: close self

Request self to be closed.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

Method: web-inspector:detach self
Method: detach self

Request self to be detached.

The signal web-inspector:detach will be emitted. If the inspector is already detached it does nothing.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

Method: web-inspector:get-attached-height self ⇒ %return
Method: get-attached-height self ⇒ %return

Get the height that the inspector view when attached.

Get the height that the inspector view should have when it’s attached. If the inspector view is not attached this returns 0.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

%return

Returned: an unsigned 32-bit integer.

the height of the inspector view when attached

Method: web-inspector:get-can-attach? self ⇒ %return
Method: get-can-attach? self ⇒ %return

Whether the self can be attached to the same window that contains the inspected view.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

%return

Returned: a boolean.

#t if there is enough room for the inspector view inside the window that contains the inspected view, or #f otherwise.

Method: web-inspector:get-inspected-uri self ⇒ %return
Method: get-inspected-uri self ⇒ %return

Get the URI that is currently being inspected.

This can be #f if nothing has been loaded yet in the inspected view, if the inspector has been closed or when inspected view was loaded from a HTML string instead of a URI.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

%return

Returned: a string.

the URI that is currently being inspected or #f

Method: web-inspector:get-web-view self ⇒ %return
Method: get-web-view self ⇒ %return

Get the <WebKitWebViewBase> used to display the inspector.

This might be #f if the inspector hasn’t been loaded yet, or it has been closed.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

%return

Returned: a <WebKitWebViewBase>.

the <WebKitWebViewBase> used to display the inspector or #f

Method: web-inspector:is-attached? self ⇒ %return
Method: is-attached? self ⇒ %return

Whether the self view is currently attached to the same window that contains the inspected view.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

%return

Returned: a boolean.

#t if self is currently attached or #f otherwise

Method: web-inspector:show self
Method: show self

Request self to be shown.

self

Passed: a <WebKitWebInspector>.

a <WebKitWebInspector>

Signals

Signal: web-inspector:attach

Connect a handler with (connect object web-inspector:attach handler). It is called as (handler self) ⇒ %return.

Emitted when the inspector is requested to be attached to the window where the inspected web view is. If this signal is not handled the inspector view will be automatically attached to the inspected view, so you only need to handle this signal if you want to attach the inspector view yourself (for example, to add the inspector view to a browser tab).

To prevent the inspector view from being attached you can connect to this signal and simply return #t.

self

Passed: a <WebKitWebInspector>.

%return

Returned: a boolean.

#t to stop other handlers from being invoked for the event. #f to propagate the event further.

Signal: web-inspector:bring-to-front

Connect a handler with (connect object web-inspector:bring-to-front handler). It is called as (handler self) ⇒ %return.

Emitted when the inspector should be shown.

If the inspector is not attached the inspector window should be shown on top of any other windows. If the inspector is attached the inspector view should be made visible. For example, if the inspector view is attached using a tab in a browser window, the browser window should be raised and the tab containing the inspector view should be the active one. In both cases, if this signal is not handled, the default implementation calls window:present on the current toplevel <GtkWindow> of the inspector view.

self

Passed: a <WebKitWebInspector>.

%return

Returned: a boolean.

#t to stop other handlers from being invoked for the event. #f to propagate the event further.

Signal: web-inspector:closed

Connect a handler with (connect object web-inspector:closed handler). It is called as (handler self).

Emitted when the inspector page is closed. If you are using your own inspector window, you should connect to this signal and destroy your window.

self

Passed: a <WebKitWebInspector>.

Signal: web-inspector:detach

Connect a handler with (connect object web-inspector:detach handler). It is called as (handler self) ⇒ %return.

Emitted when the inspector is requested to be detached from the window it is currently attached to. The inspector is detached when the inspector page is about to be closed, and this signal is emitted right before web-inspector:closed, or when the user clicks on the detach button in the inspector view to show the inspector in a separate window. In this case the signal web-inspector:open-window is emitted after this one.

To prevent the inspector view from being detached you can connect to this signal and simply return #t.

self

Passed: a <WebKitWebInspector>.

%return

Returned: a boolean.

#t to stop other handlers from being invoked for the event. #f to propagate the event further.

Signal: web-inspector:open-window

Connect a handler with (connect object web-inspector:open-window handler). It is called as (handler self) ⇒ %return.

Emitted when the inspector is requested to open in a separate window. If this signal is not handled, a <GtkWindow> with the inspector will be created and shown, so you only need to handle this signal if you want to use your own window. This signal is emitted after web-inspector:detach to show the inspector in a separate window after being detached.

To prevent the inspector from being shown you can connect to this signal and simply return #t

self

Passed: a <WebKitWebInspector>.

%return

Returned: a boolean.

#t to stop other handlers from being invoked for the event. #f to propagate the event further.