From: Daniel Carl Date: Sat, 1 Dec 2012 13:47:15 +0000 (+0100) Subject: Added command 'inspect' to open the web inspector. X-Git-Url: https://git.owens.tech/projects.html/projects.html/git?a=commitdiff_plain;h=5a8b8d77415780ef63817fd9dda857de4079314d;p=vimb.git Added command 'inspect' to open the web inspector. --- diff --git a/src/command.c b/src/command.c index b09e368..e1c7bb0 100644 --- a/src/command.c +++ b/src/command.c @@ -61,6 +61,7 @@ static CommandInfo cmd_list[] = { {"set", command_set, {0}, VP_MODE_NORMAL}, {"complete", command_complete, {0}, VP_MODE_COMMAND | VP_MODE_COMPLETE}, {"complete-back", command_complete, {1}, VP_MODE_COMMAND | VP_MODE_COMPLETE}, + {"inspect", command_inspect, {0}, VP_MODE_NORMAL}, }; void command_init(void) @@ -256,3 +257,19 @@ gboolean command_complete(const Arg* arg) return TRUE; } + +gboolean command_inspect(const Arg* arg) +{ + gboolean enabled; + WebKitWebSettings* settings = NULL; + + settings = webkit_web_view_get_settings(vp.gui.webview); + g_object_get(G_OBJECT(settings), "enable-developer-extras", &enabled, NULL); + if (enabled) { + webkit_web_inspector_show(vp.gui.inspector); + return TRUE; + } else { + vp_echo(VP_MSG_ERROR, TRUE, "enable-developer-extras not enabled"); + return FALSE; + } +} diff --git a/src/command.h b/src/command.h index 1f10a49..8d8d569 100644 --- a/src/command.h +++ b/src/command.h @@ -45,5 +45,6 @@ gboolean command_map(const Arg* arg); gboolean command_unmap(const Arg* arg); gboolean command_set(const Arg* arg); gboolean command_complete(const Arg* arg); +gboolean command_inspect(const Arg* arg); #endif /* end of include guard: COMMAND_H */