* [PATCH RFC 0/2] xwidget-webkit settings @ 2016-06-06 18:18 Aaron Conole 2016-06-06 18:18 ` [PATCH RFC 1/2] Expose webkit view settings via lisp Aaron Conole 2016-06-06 18:18 ` [PATCH RFC 2/2] Expose the user-agent setting with a getter/setter Aaron Conole 0 siblings, 2 replies; 3+ messages in thread From: Aaron Conole @ 2016-06-06 18:18 UTC (permalink / raw) To: emacs-devel, joakim Expose some of the xwidget webkit settings, and specifically add a manipulator for the "user-agent" setting. Aaron Conole (2): Expose webkit view settings via lisp Expose the user-agent setting with a getter/setter lisp/xwidget.el | 12 ++++++++++++ src/xwidget.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) -- 2.5.5 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH RFC 1/2] Expose webkit view settings via lisp 2016-06-06 18:18 [PATCH RFC 0/2] xwidget-webkit settings Aaron Conole @ 2016-06-06 18:18 ` Aaron Conole 2016-06-06 18:18 ` [PATCH RFC 2/2] Expose the user-agent setting with a getter/setter Aaron Conole 1 sibling, 0 replies; 3+ messages in thread From: Aaron Conole @ 2016-06-06 18:18 UTC (permalink / raw) To: emacs-devel, joakim * src/xwidget.c (xwidget-webkit-get-web-string-setting): New function getter for webkit settings (xwidget-webkit-set-web-string-setting): New function setter for webkit settings (syms_of_xwidget): Expose the new functions --- src/xwidget.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/xwidget.c b/src/xwidget.c index 82449f7..aac5850 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -695,6 +695,45 @@ exec method. */ ) return build_string (str); } +DEFUN ("xwidget-webkit-get-web-string-setting", + Fxwidget_webkit_get_web_string_setting, + Sxwidget_webkit_get_web_string_setting, + 2, 2, 0, + doc: /* Gets the Webkit XWIDGET setting stored as string. */) + (Lisp_Object xwidget, Lisp_Object setting) +{ + WEBKIT_FN_INIT (); + CHECK_STRING(setting); + char *str = (char*)""; + WebKitWebSettings *settings = + webkit_web_view_get_settings (WEBKIT_WEB_VIEW (xw->widget_osr)); + if (settings) + { + g_object_get(settings, SSDATA(setting), &str, NULL); + } + return build_string(str); +} + +DEFUN ("xwidget-webkit-set-web-string-setting", + Fxwidget_webkit_set_web_string_setting, + Sxwidget_webkit_set_web_string_setting, + 3, 3, 0, + doc: /* Sets the Webkit XWIDGET string setting. */) + (Lisp_Object xwidget, Lisp_Object setting, Lisp_Object value) +{ + WEBKIT_FN_INIT (); + CHECK_STRING (setting); + CHECK_STRING (value); + WebKitWebSettings *settings = + webkit_web_view_get_settings (WEBKIT_WEB_VIEW (xw->widget_osr)); + if (settings) + { + g_object_set (settings, SSDATA(setting), SSDATA(value), NULL); + } + + return Qnil; +} + DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0, doc: /* Resize XWIDGET. NEW_WIDTH, NEW_HEIGHT define the new size. */ ) (Lisp_Object xwidget, Lisp_Object new_width, Lisp_Object new_height) @@ -975,6 +1014,8 @@ syms_of_xwidget (void) defsubr (&Sxwidget_webkit_goto_uri); defsubr (&Sxwidget_webkit_execute_script); defsubr (&Sxwidget_webkit_get_title); + defsubr (&Sxwidget_webkit_get_web_string_setting); + defsubr (&Sxwidget_webkit_set_web_string_setting); DEFSYM (Qwebkit, "webkit"); defsubr (&Sxwidget_size_request); -- 2.5.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH RFC 2/2] Expose the user-agent setting with a getter/setter 2016-06-06 18:18 [PATCH RFC 0/2] xwidget-webkit settings Aaron Conole 2016-06-06 18:18 ` [PATCH RFC 1/2] Expose webkit view settings via lisp Aaron Conole @ 2016-06-06 18:18 ` Aaron Conole 1 sibling, 0 replies; 3+ messages in thread From: Aaron Conole @ 2016-06-06 18:18 UTC (permalink / raw) To: emacs-devel, joakim * lisp/xwidget.el (xwidget-webkit-get-user-agent): New function to get the user agent for the current webkit session (xwidget-webkit-set-user-agent): New function to set the user agent for the current webkit session --- lisp/xwidget.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/xwidget.el b/lisp/xwidget.el index 7a0ca8b..64fe899 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -462,6 +462,18 @@ xwidget-webkit-current-url (message "url: %s" url) url)) +(defun xwidget-webkit-get-user-agent () + "Get the webkit UserAgent string." + (interactive) + (xwidget-webkit-get-web-string-setting (xwidget-webkit-current-session) + "user-agent")) + +(defun xwidget-webkit-set-user-agent (ua) + "Set the webkit UserAgent string." + (interactive) + (xwidget-webkit-set-web-string-setting (xwidget-webkit-current-session) + "user-agent" ua)) + (defun xwidget-webkit-execute-script-rv (xw script &optional default) "Same as `xwidget-webkit-execute-script' but with return value. XW is the webkit instance. SCRIPT is the script to execute. -- 2.5.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-06 18:18 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-06 18:18 [PATCH RFC 0/2] xwidget-webkit settings Aaron Conole 2016-06-06 18:18 ` [PATCH RFC 1/2] Expose webkit view settings via lisp Aaron Conole 2016-06-06 18:18 ` [PATCH RFC 2/2] Expose the user-agent setting with a getter/setter Aaron Conole
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.