[evolution/wip/webkit2] WebExtension - Add missing DBus methods definitions
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] WebExtension - Add missing DBus methods definitions
- Date: Fri, 6 May 2016 11:32:19 +0000 (UTC)
commit 9125808704b8713efb2db9d54c861f1e77fc8472
Author: Tomas Popela <tpopela redhat com>
Date: Fri May 6 13:31:00 2016 +0200
WebExtension - Add missing DBus methods definitions
.../composer/e-html-editor-web-extension.c | 42 ++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-web-extension.c
b/web-extensions/composer/e-html-editor-web-extension.c
index 37bb6f9..6fd7c73 100644
--- a/web-extensions/composer/e-html-editor-web-extension.c
+++ b/web-extensions/composer/e-html-editor-web-extension.c
@@ -614,6 +614,14 @@ static const char introspection_xml[] =
" <method name='DOMSelectionUnindent'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
+" <method name='DOMGetCaretWord'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='s' name='word' direction='out'/>"
+" </method>"
+" <method name='DOMSelectionHasText'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='has_text' direction='out'/>"
+" </method>"
"<!-- ********************************************************* -->"
"<!-- Functions that are used in EComposerPrivate -->"
"<!-- ********************************************************* -->"
@@ -2281,6 +2289,40 @@ handle_method_call (GDBusConnection *connection,
document = webkit_web_page_get_dom_document (web_page);
dom_selection_wrap (document, extension);
g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMGetCaretWord") == 0) {
+ gchar *word;
+
+ g_variant_get (parameters, "(t)", &page_id);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ word = dom_get_caret_word (document);
+
+ g_dbus_method_invocation_return_value (
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ word ? word : g_strdup (""))));
+ } else if (g_strcmp0 (method_name, "DOMSelectionHasText") == 0) {
+ gboolean value = FALSE;
+
+ g_variant_get (parameters, "(t)", &page_id);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ value = dom_selection_has_text (document);
+
+ g_dbus_method_invocation_return_value (
+ invocation, g_variant_new ("(b)", value));
} else if (g_strcmp0 (method_name, "DOMRemoveSignatures") == 0) {
gboolean top_signature;
gchar *active_signature;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]