Top |
WebKitWebViewBase * | webkit_web_inspector_get_web_view () |
const char * | webkit_web_inspector_get_inspected_uri () |
gboolean | webkit_web_inspector_get_can_attach () |
gboolean | webkit_web_inspector_is_attached () |
void | webkit_web_inspector_attach () |
void | webkit_web_inspector_detach () |
void | webkit_web_inspector_show () |
void | webkit_web_inspector_close () |
guint | webkit_web_inspector_get_attached_height () |
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 “enable-developer-extras” to true, otherwise no inspector is available.
1 2 3 4 5 6 7 8 9 10 |
/* Enable the developer extras */ WebKitSettings *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_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)); |
WebKitWebViewBase *
webkit_web_inspector_get_web_view (WebKitWebInspector *inspector
);
Get the WebKitWebViewBase used to display the inspector.
This might be NULL
if the inspector hasn't been loaded yet,
or it has been closed.
const char *
webkit_web_inspector_get_inspected_uri
(WebKitWebInspector *inspector
);
Get the URI that is currently being inspected. This can be NULL
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.
gboolean
webkit_web_inspector_get_can_attach (WebKitWebInspector *inspector
);
Whether the inspector
can be attached to the same window that contains
the inspected view.
TRUE
if there is enough room for the inspector view inside the
window that contains the inspected view, or FALSE
otherwise.
Since: 2.8
gboolean
webkit_web_inspector_is_attached (WebKitWebInspector *inspector
);
Whether the inspector
view is currently attached to the same window that contains
the inspected view.
void
webkit_web_inspector_attach (WebKitWebInspector *inspector
);
Request inspector
to be attached. The signal “attach”
will be emitted. If the inspector is already attached it does nothing.
void
webkit_web_inspector_detach (WebKitWebInspector *inspector
);
Request inspector
to be detached. The signal “detach”
will be emitted. If the inspector is already detached it does nothing.
void
webkit_web_inspector_show (WebKitWebInspector *inspector
);
Request inspector
to be shown.
void
webkit_web_inspector_close (WebKitWebInspector *inspector
);
Request inspector
to be closed.
guint
webkit_web_inspector_get_attached_height
(WebKitWebInspector *inspector
);
Get the height that the inspector view should have when it's attached. If the inspector view is not attached this returns 0.
“attached-height”
property“attached-height” guint
The height that the inspector view should have when it is attached.
Flags: Read
Default value: 0
“can-attach”
property“can-attach” gboolean
Whether the inspector
can be attached to the same window that contains
the inspected view.
Flags: Read
Default value: FALSE
Since: 2.8
“inspected-uri”
property“inspected-uri” gchar *
The URI that is currently being inspected.
Flags: Read
Default value: NULL
“attach”
signalgboolean user_function (WebKitWebInspector *inspector, gpointer user_data)
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 TRUE
.
inspector |
the WebKitWebInspector on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
TRUE
to stop other handlers from being invoked for the event.
FALSE
to propagate the event further.
Flags: Run Last
“bring-to-front”
signalgboolean user_function (WebKitWebInspector *inspector, gpointer user_data)
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 gtk_window_present()
on the current toplevel GtkWindow of the
inspector view.
inspector |
the WebKitWebInspector on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
TRUE
to stop other handlers from being invoked for the event.
FALSE
to propagate the event further.
Flags: Run Last
“closed”
signalvoid user_function (WebKitWebInspector *inspector, gpointer user_data)
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.
inspector |
the WebKitWebInspector on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“detach”
signalgboolean user_function (WebKitWebInspector *inspector, gpointer user_data)
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 “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 “open-window” is emitted after this one.
To prevent the inspector view from being detached you can connect to this
signal and simply return TRUE
.
inspector |
the WebKitWebInspector on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
TRUE
to stop other handlers from being invoked for the event.
FALSE
to propagate the event further.
Flags: Run Last
“open-window”
signalgboolean user_function (WebKitWebInspector *inspector, gpointer user_data)
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 “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 TRUE
inspector |
the WebKitWebInspector on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
TRUE
to stop other handlers from being invoked for the event.
FALSE
to propagate the event further.
Flags: Run Last